Esempio n. 1
0
        private async void EnableDisableAutostart(bool enable)
        {
            ConfiguringAutostart = true;

            try
            {
                if (enable)
                {
                    await AutostartManager.EnableAsync();
                }
                else
                {
                    await AutostartManager.DisableAsync();
                }

                // Show the user some awesome animation to indicate we are working on it :)
                await Task.Delay(2000);
            }
            catch (Exception ex)
            {
                await dialogCoordinator.ShowMessageAsync(this, LocalizationManager.GetStringByKey("String_Header_Error"), ex.Message, MessageDialogStyle.Affirmative, AppearanceManager.MetroDialog);
            }

            ConfiguringAutostart = false;
        }
Esempio n. 2
0
        public TrayIconController()
        {
            // Instantiate the NotifyIcon object.
            TrayIcon = new NotifyIcon();
            Mapper   = new KeyboardMapper();

            // autostart manager
            bool registerShortcutForAllUser = false;

            AutostartHelper = new AutostartManager(Application.ProductName, Application.ExecutablePath, registerShortcutForAllUser);
        }
Esempio n. 3
0
        private void chkRunWhenStartup_CheckedChanged(object sender, EventArgs e)
        {
            var        autostartEnabled           = chkRunWhenStartup.Checked;
            const bool registerShortcutForAllUser = false;
            var        autostartManager           = new AutostartManager(Application.ProductName, Application.ExecutablePath,
                                                                         registerShortcutForAllUser);

            if (autostartEnabled)
            {
                if (!autostartManager.IsAutostartEnabled())
                {
                    autostartManager.EnableAutostart();
                }
            }
            else
            {
                if (autostartManager.IsAutostartEnabled())
                {
                    autostartManager.DisableAutostart();
                }
            }
        }
 private void SetupAutostartManager()
 {
     _autostartManager = new AutostartManager(AutostartCheckbox);
     _autostartManager.Initialize();
 }