public static void Main(string[] args) { try { if (mutex.WaitOne(TimeSpan.Zero, true)) { try { App app = new App(); app.Run(); } finally { mutex.ReleaseMutex(); } } else { if (args.Length > 0 && args[0].StartsWith("chrome-extension://")) { ChromeHost.ForwardMessage(Console.OpenStandardInput()); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public MainWindow() { InitializeComponent(); ServicePointManager.DefaultConnectionLimit = 128; this.TaskbarItemInfo = new TaskbarItemInfo() { ProgressState = TaskbarItemProgressState.Normal }; downloadList.ItemsSource = downloads; ChromeHost.StartHost(this.OnChromeMessage, this.OnChromeError); this.Closing += (s, e) => { ChromeHost.StopHost(); }; updateTimer = new DispatcherTimer(); updateTimer.Interval = TimeSpan.FromMilliseconds(200); updateTimer.Tick += UpdateUI; }