private async Task UpdateState() { Source.Source = ForkHelper.GetStatus(); while (doUpdateState) { await Task.Delay(1000); ForkHelper.UpdateState(); Debug.WriteLine("Updated"); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ForkHelper.Init(); this.ShutdownMode = ShutdownMode.OnExplicitShutdown; this.notifyIcon = new System.Windows.Forms.NotifyIcon(); notifyIcon.Icon = Fork.Gui.Properties.Resources.fork_512; //notifyIcon.Icon = new System.Drawing.Icon(System.Drawing.SystemIcons.Shield, 40, 40); notifyIcon.Visible = true; notifyIcon.DoubleClick += NotifyIcon_DoubleClick; notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); var showItem = notifyIcon.ContextMenuStrip.Items.Add("Show"); showItem.Click += NotifyIcon_DoubleClick; showItem.Font = new System.Drawing.Font(showItem.Font, System.Drawing.FontStyle.Bold); notifyIcon.ContextMenuStrip.Items.Add("Exit").Click += (o, x) => Shutdown(); }