zoukankan      html  css  js  c++  java
  • UWP 协议启动

    • 1.创建通过协议启动的项目 AppDemo
    • 2.在项目的Package.appxmanifest 文件里 Extensions 目录下
          <Extensions>
            <uap:Extension Category="windows.protocol">
              <uap:Protocol Name="uridemo">
                <uap:Logo>AssetsStoreLogo.png</uap:Logo>
                <uap:DisplayName>AppDemo</uap:DisplayName>
              </uap:Protocol>
            </uap:Extension>
          </Extensions>
    View Code
    • 3.在App.xaml.cs里
            protected override void OnActivated(IActivatedEventArgs args)
            {
                base.OnActivated(args);
                // Window management
                Frame rootFrame = Window.Current.Content as Frame;
                if (rootFrame == null)
                {
                    rootFrame = new Frame();
                    Window.Current.Content = rootFrame;
                }
                switch (args.Kind)
                {
                    case ActivationKind.VoiceCommand:
                        {
                            break;
                        }
                    case ActivationKind.Protocol:
                        {
                            // Code specific to launch for results
                            var command = args as ProtocolActivatedEventArgs;
    
                            if (command.Uri.ToString().StartsWith("uridemo://"))
                            {
                                // Open the page that we created to handle activation for results.
                                rootFrame.Navigate(typeof(MainPage), command);
    
                            }
                            else
                            {
                                //.....
                            }
                            break;
                        }
                }
    
                // Ensure the current window is active.
                Window.Current.Activate();
            }
    View Code
    • 4.在创建一个要启动的项目AppClient
            private async void button_Click(object sender, RoutedEventArgs e)
            {
                await Windows.System.Launcher.LaunchUriAsync(new Uri("uridemo://appdata"));
            }
    View Code
    • 5.部署完成,启动AppClient
  • 相关阅读:
    SQL Function(方法)
    SQL Cursor(游标)
    SQL Proc(存储过程)/tran(事物)
    AAABBBBCCCC
    Visual Studio2012中搭建WCF项目
    关于抽象工厂模式
    C#面向对象的学习笔记
    休假回来 更博-MySQL以月为单位的客户综合情况表_20161008
    结合Mysql和kettle邮件发送日常报表_20161001
    MySQL-with rollup函数运用 _20160930
  • 原文地址:https://www.cnblogs.com/androllen/p/7722827.html
Copyright © 2011-2022 走看看