Example #1
0
 private void RestoreFromTray()
 {
     if (SystemTrayIcon.IsVisible)
     {
         Show();
         SystemTrayIcon.Hide();
     }
 }
Example #2
0
 private void TrayContextMenuEnable(Boolean value)
 {
     if (!value)
     {
         SystemTrayIcon.SetContextMenuStrip(null); // disable context menu
     }
     else
     {
         System.Windows.Forms.ContextMenuStrip  contextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
         System.Windows.Forms.ToolStripMenuItem menuItem         = new System.Windows.Forms.ToolStripMenuItem();
         menuItem.Text   = "Cancel";
         menuItem.Click += new EventHandler(CancelDemoPlaybackToolStripMenuItem_Click);
         contextMenuStrip.Items.Add(menuItem);
         SystemTrayIcon.SetContextMenuStrip(contextMenuStrip);
     }
 }
Example #3
0
        public void LaunchedProcessClosed()
        {
            Procedure action = () =>
            {
                try
                {
                    FileOperationList.Execute();
                }
                catch (Exception)
                {
                    // suppress cleanup errors
                }

                Demo demo = uiDemoListView.GetSelectedDemo();
                if (demo != null && UseHlae(demo))
                {
                    Debug.Assert(launcher as SteamLauncher != null);
                }

                // If the system tray still has a context menu, then connecting must have been cancelled.
                // Don't apply the "close when finished" functionality in this case.
                if (!SystemTrayIcon.HasContextMenuStrip && Config.Settings.PlaybackCloseWhenFinished)
                {
                    SystemTrayIcon.Hide();
                    Close();
                }
                else
                {
                    RestoreFromTray();
                    canOpenDemo = true;
                }
            };

            if (Thread.CurrentThread != Dispatcher.Thread)
            {
                Dispatcher.Invoke(DispatcherPriority.Normal, action);
            }
            else
            {
                action();
            }
        }
Example #4
0
 private void MinimiseToTray()
 {
     Hide();
     SystemTrayIcon.Show(new EventHandler(notifyIcon_Click));
 }