static void Main(string[] args) { ConsoleHelper.HideConsole(); AutoSettingHelper autoSettingHelper = new AutoSettingHelper(); autoSettingHelper.AutoActive(); Console.WriteLine("执行结束!"); Console.ReadLine(); }
/// <summary> /// 【确定】按钮单击时执行的代码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_OK_Click(object sender, RoutedEventArgs e) { ConfigHelper configHelper = new ConfigHelper(); AutoSettingHelper autoSettingHelper = new AutoSettingHelper("setting"); //分辨率的设置 if (radioButton_Resolving1080.IsChecked == true) { configHelper.SetValue("BINGPHOTO", "RESOV", "1920x1080"); } else { configHelper.SetValue("BINGPHOTO", "RESOV", "1366x768"); } //复选框的设置 if (CheckBox_AutoDownload.IsChecked == true) { configHelper.SetValue("BINGPHOTO", "AUTODOWN", true.ToString()); } else { configHelper.SetValue("BINGPHOTO", "AUTODOWN", false.ToString()); } if (CheckBox_AutoSetWall.IsChecked == true) { configHelper.SetValue("BINGPHOTO", "AUTOSET", true.ToString()); } else { configHelper.SetValue("BINGPHOTO", "AUTOSET", false.ToString()); } //开机启动项的设置 if ((CheckBox_AutoDownload.IsChecked == true) || (CheckBox_AutoSetWall.IsChecked == true)) { //设置启动项 string exePath = configHelper.GetValue("BINGPHOTO", "EXEPATH"); autoSettingHelper.SetSetupWindowOpenRun("-autoActive", "开机自动下载、设置壁纸"); //设置计划任务 TaskSchedulerHelper.DeleteTaskScheduler("New BingPhoto"); SchtasksHelper schtasksHelper = new SchtasksHelper("New BingPhoto", exePath, "-autoActive", "DAILY", "1", "00:01:00"); schtasksHelper.CreateSchtask(); } else { //删除启动项 autoSettingHelper.UnSetSetupWindowOpenRun(); //删除计划任务 TaskSchedulerHelper.DeleteTaskScheduler("New BingPhoto"); } //保存mkt参数 configHelper.SetValue("AUTO", "MKT", (new HttpHelper()).GetRequestMkt(Combox_country.Text)); //其他设置写在这 Close(); }