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; } }
private void MenuItem_Click(object sender, System.Windows.RoutedEventArgs e) { System.Windows.Controls.MenuItem menuItem = sender as System.Windows.Controls.MenuItem; switch (menuItem.Header) { case "打开壁纸": if (wallpaper == null || wallpaper.IsClosed) { wallpaper = new Wallpaper(this); wallpaper.Show(); } wallpaper.Activate(); wallpaper.WindowState = System.Windows.WindowState.Normal; break; case "软件设置": Setting setting = new Setting(); setting.ChangeConfigEvent += Setting_ChangeConfigEvent; setting.ShowDialog(); break; case "立即屏保": timerS.Stop(); screensaver = new Screensaver(); screensaver.ShowDialog(); break; case "调试": //string url = "http://localhost:53054/Update/CheckUpdate"; AutoUpdate.Helper.UpdateHelper.CheckUpdateAsyn(); break; } }
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(); })); }