コード例 #1
0
ファイル: TrayIconForm.cs プロジェクト: isabel1991/Clonado
        private void RefreshDisplayTextForDynamicMenuItems()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new SimpleDelegate(RefreshDisplayTextForDynamicMenuItems));
                return;
            }

            if (LibraryRegistry.GetBooleanValue(RegSettingNames.AutomaticUpdatesEnabled).GetValueOrDefault(true))
            {
                toggleAutomaticUpdatesToolStripMenuItem.Text = "Disable automatic updates";
            }
            else
            {
                toggleAutomaticUpdatesToolStripMenuItem.Text = "Enable automatic updates";
            }

            if (LibraryRegistry.GetBooleanValue(RegSettingNames.StartupWithWindowsEnabled).GetValueOrDefault(true))
            {
                toggleStartupWithWindowsToolStripMenuItem.Text = "Disable startup with Windows";
            }
            else
            {
                toggleStartupWithWindowsToolStripMenuItem.Text = "Enable startup with Windows";
            }

            trayIcon.Text = "DesktopBootstrap";
        }
コード例 #2
0
ファイル: TrayIconForm.cs プロジェクト: isabel1991/Clonado
        private void toggleAutomaticUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // we have three things to do:
            //
            // first, update the flag in our currentuser settings
            // second, update the display text for the menu item
            // third, update the flag in localmachine, by signaling to the service

            LibraryRegistry.SetValue(RegSettingNames.AutomaticUpdatesEnabled, !LibraryRegistry.GetBooleanValue(
                                         RegSettingNames.AutomaticUpdatesEnabled).GetValueOrDefault(true));

            RefreshDisplayTextForDynamicMenuItems();


            if (LibraryRegistry.GetBooleanValue(RegSettingNames.AutomaticUpdatesEnabled).GetValueOrDefault(true))
            {
                ServiceIpc.SignalEnableAutoUpdates();
                Log.Logger.Debug("User reenabled automatic updates.");
            }
            else
            {
                // updates were enabled, but have now been disabled
                ServiceIpc.SignalEnableAutoUpdates();
                Log.Logger.Debug("User disabled automatic updates.");
            }
        }
コード例 #3
0
ファイル: TrayIconForm.cs プロジェクト: isabel1991/Clonado
        private void toggleStartWithWindowsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LibraryRegistry.SetValue(RegSettingNames.StartupWithWindowsEnabled, !LibraryRegistry.GetBooleanValue(
                                         RegSettingNames.StartupWithWindowsEnabled).GetValueOrDefault(true));

            RefreshDisplayTextForDynamicMenuItems();

            if (LibraryRegistry.GetBooleanValue(RegSettingNames.StartupWithWindowsEnabled).GetValueOrDefault(true))
            {
                // add the Windows 'Run' registry value back in
                ServiceIpc.SignalEnableWindowsStartup();

                Log.Logger.Debug("User reenabled startup with Windows.");
            }
            else
            {
                // delete the Windows 'Run' registry value
                ServiceIpc.SignalDisableWindowsStartup();

                Log.Logger.Debug("User disabled startup with Windows.");
            }
        }