示例#1
0
        private async Task UpdateState()
        {
            Source.Source = ForkHelper.GetStatus();
            while (doUpdateState)
            {
                await Task.Delay(1000);

                ForkHelper.UpdateState();
                Debug.WriteLine("Updated");
            }
        }
示例#2
0
文件: App.xaml.cs 项目: Cpa3y/fork
        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();
        }