protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); MainWindow = new PL.MainWindow(); // MainWindow.Closing += MainWindow_Closing; // PL.MainWindow.window.Closing += Window_Closing; this.icone = new System.Windows.Forms.NotifyIcon(); this.icone.DoubleClick += (s, args) => ShowMainWindow(); this.icone.Icon = StudUP.Properties.Resources.MyIcon; this.icone.Visible = true; CreateContextMenu(); }
private void ShowMainWindow() { try { if (PL.MainWindow.window.IsVisible) { if (PL.MainWindow.window.WindowState == WindowState.Minimized) { PL.MainWindow.window.WindowState = WindowState.Normal; } PL.MainWindow.window.Activate(); } else { PL.MainWindow.window.Show(); } } catch { PL.MainWindow window = new PL.MainWindow(); window.Show(); } }