zoukankan      html  css  js  c++  java
  • Settings Pane in Charm

    using Windows.UI.ApplicationSettings;
    
            Rect _windowBounds;
            double _settingsWidth = 364;
            Popup _settingsPopup;
            public MainPage()
            {
                this.InitializeComponent();          
                Windows.UI.ApplicationSettings.SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
                Window.Current.SizeChanged += Current_SizeChanged;
                _windowBounds = Window.Current.Bounds;
            }
    
            void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
            {
                _windowBounds = Window.Current.Bounds;
            }
    
            void MainPage_CommandsRequested(Windows.UI.ApplicationSettings.SettingsPane sender, Windows.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args)
            {
                SettingsCommand cmd=new SettingsCommand ("","Help",async (x)=>{
                    Uri helpURL = new Uri("http://www.google.com");
                    await Windows.System.Launcher.LaunchUriAsync(helpURL);
                });            
                args.Request.ApplicationCommands.Add(cmd);
    
                cmd = new SettingsCommand("", "Settings", (x) =>
                {
                    _settingsPopup = new Popup();
                    _settingsPopup.Closed += _settingsPopup_Closed;
                    Window.Current.Activated += OnWindowActivated;
                    _settingsPopup.IsLightDismissEnabled = true;
                    _settingsPopup.Width = _settingsWidth;
                    _settingsPopup.Height = _windowBounds.Height;
    
                    SettingsPage sp = new SettingsPage();
                    sp.Width = _settingsWidth;
                    sp.Height = _windowBounds.Height;
    
                    _settingsPopup.Child = sp;
                    _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
                    _settingsPopup.SetValue(Canvas.TopProperty, 0);
                    _settingsPopup.IsOpen = true;
                });
                args.Request.ApplicationCommands.Add(cmd);
            }
    
          
            void _settingsPopup_Closed(object sender, object e)
            {
                Window.Current.Activated -= OnWindowActivated;
            }
            void OnWindowActivated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
            {
                if (e.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated)
                {
                    _settingsPopup.IsOpen = false;
                }
            }

    在SettingsPage中:

    using Windows.UI.ApplicationSettings;
    
               private void btgoBack_Click_1(object sender, RoutedEventArgs e)
            {
                if (this.Parent.GetType() == typeof(Popup))
                {
                    ((Popup)this.Parent).IsOpen = false;
                    SettingsPane.Show();
                }
    
            } 
  • 相关阅读:
    ubuntu-14.04.2-desktop-amd64.iso:ubuntu-14.04.2-desktop-amd64:安装Oracle11gR2
    ubuntu-15.04-desktop-amd64.iso:ubuntu-15.04-desktop-amd64:安装Oracle11gR2
    Ubuntu 使用文件 casper-rw 镜像文件 保存变更内容
    continue — Skip to the next iteration of a loop in a shell script
    Is there a TRY CATCH command in Bash
    tar 打包压缩
    oracle 重复只保留一条
    sed 删除 51, 54 行 输出到原文件
    ORA-01000: maximum open cursors exceeded
    Oracle 在字符串中输入单引号或特殊字符
  • 原文地址:https://www.cnblogs.com/qixue/p/2863090.html
Copyright © 2011-2022 走看看