/// <summary> /// 已设置开机启动时,自动最小化 /// </summary> private void CheckAutoStart() { if (AutoStartHelper.IsAutoStart(this.Text)) { 开机启动ToolStripMenuItem.Checked = true; this.WindowState = FormWindowState.Minimized; } }
private void applyAutostartSetting(bool enabled) { if (_allowAutoStartApplication) { return; } string command = String.Format("{0} -m", Application.ExecutablePath); AutoStartHelper.ApplyAutostartSetting(enabled, "mrHelper", command); }
private void 开机启动ToolStripMenuItem_Click(object sender, System.EventArgs e) { var checkedStatus = !开机启动ToolStripMenuItem.Checked; try { AutoStartHelper.AutoStart(this.Text, checkedStatus); 开机启动ToolStripMenuItem.Checked = checkedStatus; } catch (Exception exp) { MessageBox.Show("请先获取管理员权限:" + exp.Message); } }
public void Execute(object parameter) { if ((string)parameter == "OK") { var devOpsServerConfig = _configManager.Get <DevOpsServerConfig>(); var urlChanged = devOpsServerConfig.Url != _configurationViewModel.DevOpsServerUrl; var ageChanged = devOpsServerConfig.AgeOfBuilds != _configurationViewModel.SelectedBuildAge; devOpsServerConfig.Url = _configurationViewModel.DevOpsServerUrl; devOpsServerConfig.BuildRefreshTime = _configurationViewModel.SelectedRefreshTime; devOpsServerConfig.AgeOfBuilds = _configurationViewModel.SelectedBuildAge; var completeRefresh = urlChanged || ageChanged; _buildsOverviewViewModel.RestartTimer(completeRefresh); var autostartConfig = _configManager.Get <AutostartConfig>(); autostartConfig.Enabled = _configurationViewModel.AutostartEnabled; autostartConfig.Hidden = _configurationViewModel.AutostartHidden; AutoStartHelper.SetAutoStart(autostartConfig.Enabled, autostartConfig.Hidden); } _pageViewModel.CurrentPage = Page.Builds; }