Exemple #1
0
        private App()
        {
            icon = new NotifyIcon()
            {
                Text        = "Sentinel",
                Icon        = sentinel_icon,
                Visible     = true,
                ContextMenu = new ContextMenu(new MenuItem[]
                {
                    new MenuItem("Sentinel v1.0.1")
                    {
                        Enabled = false
                    },
                    new MenuItem("Settings", (sender, ev) =>
                    {
                        new AboutWindow(sentinel.settings).Show();
                    }),
                    new MenuItem("Quit", (a, b) => Shutdown())
                })
            };
            icon.Click += (a, b) =>
            {
                // Only open about if left mouse is used (otherwise right clicking opens both context menu and about).
                if (b is MouseEventArgs args && args.Button == MouseButtons.Left)
                {
                    new AboutWindow(sentinel.settings).Show();
                }
            };

            if (!StartMenuHelpers.IsInstalled())
            {
                // We're not yet installed, show the wizard first.
                var wizard = new SetupWizard();
                wizard.Closed += (a, b) => sentinel = new Sentinel();
                wizard.Show();
            }
            else
            {
                // We're already installed, construct immediately.
                sentinel = new Sentinel();
            }
        }
Exemple #2
0
 public static void Log(string context, string message)
 {
     Sentinel.Log($"{context} : {message}");
 }