zoukankan      html  css  js  c++  java
  • Windows 8 系列 ApplicationSettings 随笔

    //向设置面板加入事件
    SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
     // 点击时触发,添加一项
            void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
            {
                //定义执行处理事件
                UICommandInvokedHandler handle = new UICommandInvokedHandler(onSettingsCommand);
                //定义设置命令项
                SettingsCommand generalCommand = new SettingsCommand("generalSettings", "general", handle);
                //将命令项添加到设置集合
                args.Request.ApplicationCommands.Add(generalCommand);
             }
     //执行命令项事件
            void onSettingsCommand(IUICommand command)
            {
                SettingsCommand settingsCommand = (SettingsCommand)command;
                showBlock.Text = settingsCommand.Label;
            }
    //定义popup窗体 
    private Popup settingsPopup;
     void onSettingsCommand1(IUICommand command)
            {
                settingsPopup = new Popup();
           //popup关闭时 settingsPopup.Closed
    += settingsPopup_Closed; Window.Current.Activated += Current_Activated; settingsPopup.IsLightDismissEnabled = true; settingsPopup.Width = settingsWidth; settingsPopup.Height = windowBounds.Height; settingsPopup.ChildTransitions = new TransitionCollection(); settingsPopup.ChildTransitions.Add(new PaneThemeTransition() { Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left }); //将用户xmal 添加到Popup中 SettingsFlyout mypane = new SettingsFlyout(); mypane.Width = settingsWidth; mypane.Height = windowBounds.Height; settingsPopup.Child = mypane; settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0); settingsPopup.SetValue(Canvas.TopProperty, 0); settingsPopup.IsOpen = true; }
    void settingsPopup_Closed(object sender, object e)
            {
                Window.Current.Activated -= Current_Activated;
            }
     void Current_Activated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
            {
                //throw new NotImplementedException();
                if (e.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated)
                {
                    settingsPopup.IsOpen = false;
                }
            }
    学徒帮-jQuery帮帮帮 欢迎更多的前端交流、Js交流、jQuery交流
  • 相关阅读:
    Unity Shader 基础(3) 获取深度纹理
    Unity Shader 基础(1): RenderType & ReplacementShader
    【Unity游戏开发】AssetBundle杂记--AssetBundle的二三事
    【Unity游戏开发】马三的游戏性能优化自留地
    【Unity游戏开发】跟着马三一起魔改LitJson
    【年终总结】马三京沪漂流记之2019年总结
    【Unity游戏开发】接入UWA_GOT的iOS版SDK以后无法正常出包
    【马三沪漂浮生记】之见闻壹
    【Unity游戏开发】性能优化之在真机上开启DeepProfile与踩坑
    【马三北漂记】之终章
  • 原文地址:https://www.cnblogs.com/Jusoc/p/2757764.html
Copyright © 2011-2022 走看看