コード例 #1
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = sender as MenuItem;

            switch (menuItem.Header)
            {
            case "搜索":
                tabControl.Visibility = Visibility.Hidden;
                searchGrid.Visibility = Visibility.Visible;
                break;

            case "屏保":
                Screensaver screen = new Screensaver();
                screen.Show();
                break;

            case "设置":
                Setting setting = new Setting();
                setting.ChangeConfigEvent += Setting_ChangeConfigEvent;
                setting.ShowDialog();
                break;

            case "关于":
                About about = new About();
                about.ShowDialog();
                break;
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: HaiqTop/HWallpaper
 private void ShowScreen()
 {
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         timerS.Stop();
         System.Drawing.Rectangle?rect = GetShowScreenRect();
         // 判断是否存在全屏应用
         if (rect == null)
         {
             timerS.Interval = 15000d;
             timerS.Start();
             return;
         }
         this.Left           = (double)rect?.Left;
         screensaver         = new Screensaver((double)rect?.Left);
         screensaver.Closed += Screensaver_Closed;
         screensaver.Show();
     }));
 }