Exemple #1
0
        public Launcher()
        {
            this.fForm = new DansposéForm();

            this.fTrayIcon = new NotifyIcon();
            this.fTrayIcon.Text = "Dansposé: Running";
            this.fTrayIcon.Icon = DansposéLauncher.Properties.Resources.Icon;
            this.fTrayIcon.BalloonTipText = "To exit Dansposé, right click on this icon and click exit";
            this.fTrayIcon.BalloonTipIcon = ToolTipIcon.Info;
            this.fTrayIcon.BalloonTipTitle = "Dansposé is running";

            ContextMenu menu = new ContextMenu();

            MenuItem settingsItem = menu.MenuItems.Add("Settings");
            menu.MenuItems.Add("-");
            MenuItem activeItem = menu.MenuItems.Add("Disable");
            menu.MenuItems.Add("-");
            MenuItem exitItem = menu.MenuItems.Add("Exit");

            settingsItem.Click += delegate {
                SettingsForm configForm = new SettingsForm(this);
                configForm.ShowDialog();
            };
            activeItem.Click += delegate {
                this.fForm.TriggerManager.IsActive = !this.fForm.TriggerManager.IsActive;
                activeItem.Text = (this.fForm.TriggerManager.IsActive ? "Disable" : "Enable");
                this.fTrayIcon.Text = (this.fForm.TriggerManager.IsActive ? "Dansposé: Running" : "Dansposé: Disabled");
            };
            exitItem.Click += delegate {
                this.fTrayIcon.Visible = false;
                this.Shutdown();
            };

            this.fTrayIcon.ContextMenu = menu;
        }
Exemple #2
0
        public static void Main()
        {
            DansposéForm form = new DansposéForm();

            try {

                Application.Run(form);
            } catch ( Exception e ) {
                form.Hide();

                int x = 5;
                int y = x + x;
            }
        }