RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
WPF如何开发SurfaceDial

这篇文章主要介绍了WPF如何开发Surface Dial,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

为望都等地区用户提供了全套网页设计制作服务,及望都网站建设行业解决方案。主营业务为成都做网站、成都网站制作、望都网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

示例:

public MainWindow()
        {
            InitializeComponent();//SetRadialControllerConfiguration();var interop = (IRadialControllerInterop)System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal
                .GetActivationFactory(typeof(RadialController));

            Guid guid = typeof(RadialController).GetInterface("IRadialController").GUID;

            Window window = Window.GetWindow(this);var wih = new WindowInteropHelper(window);
            IntPtr hWnd = wih.Handle;// Create a reference to the RadialController.radialController = interop.CreateForWindow(hWnd, ref guid);string iconFileName = "Assets\\dial_icon_custom_item.png";string filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, iconFileName);var getItemImageOperation = StorageFile.GetFileFromPathAsync(filePath);
            getItemImageOperation.Completed += new AsyncOperationCompletedHandler(AddMenuItemFromImage);// Declare input handlers for the RadialController.radialController.RotationChanged += RadialController_RotationChanged; ;
        }

还有个很关键的类RadialControllerInterfaces.cs

  [System.Runtime.InteropServices.Guid("787cdaac-3186-476d-87e4-b9374a7b9970")]
    [System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIInspectable)]interface IRadialControllerConfigurationInterop
    {
        RadialControllerConfiguration GetForWindow(IntPtr hwnd, [System.Runtime.InteropServices.In]ref Guid riid);
    }

    [System.Runtime.InteropServices.Guid("1B0535C9-57AD-45C1-9D79-AD5C34360513")]
    [System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIInspectable)]interface IRadialControllerInterop
    {
        RadialController CreateForWindow(IntPtr hwnd, [System.Runtime.InteropServices.In]ref Guid riid);
    }

这个类提供了CreateForWindow方法可以让我们创建RadialController对象,个人觉得这个接口很玄乎,上边的Guid特性(这个是叫特性吧?)是写死的,问了工程师说这个不用改,这不就很坑了,如果不是有个demo,我怎么知道怎么写,,,

作为弱鸡,这里我也有问题请教大家:

1.这些特性的作用,平时自己写代码貌似只用过【datacontract】


[System.Runtime.InteropServices.Guid("1B0535C9-57AD-45C1-9D79-AD5C34360513")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIInspectable)]    

2.MainWindow中代码

var interop = (IRadialControllerInterop)System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal
                .GetActivationFactory(typeof(RadialController));

总觉得阅读性这么差呢,看不懂,或许是我从未见过,对这个方法不熟?

微软工程师给我的这个Demo我发现有两个Bug(他本人也表示还没写完,是Dirty Demo),一个是SetRadialControllerConfiguration这个方法里异常,不能用,导致不能初始化Dial的菜单,每次启动应用都会往菜单里

添加一项;另一个是焦点问题,当长按dial选择了其他菜单,例如音量,再返回我们的demo,发现此时dial仍然控制的是音量

感谢你能够认真阅读完这篇文章,希望小编分享的“WPF如何开发Surface Dial”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!


当前标题:WPF如何开发SurfaceDial
分享网址:http://scyingshan.cn/article/jjoeii.html