private void Window_Loaded(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(ConfigureAppConfig.GetAppSettingsKeyValue("PageNum"))) { StringBuilder sb = new StringBuilder(); int pageN = Convert.ToInt32(ConfigureAppConfig.GetAppSettingsKeyValue("PageNum")); for (int i = 0; i < pageN; i++) { WebPage page = new WebPage(); page.Id = i; page.Page = ConfigureAppConfig.GetAppSettingsKeyValue($"page{i.ToString()}"); if (!string.IsNullOrWhiteSpace(page.Page)) { oldPages.Add(page); sb.Append("https://" + page.Page + "\r\n"); } } webContentes.Text = sb.ToString(); foreach (var page in oldPages) { if (string.IsNullOrEmpty(page.Page)) { continue; } System.Diagnostics.Process.Start(page.Page); } //this.WindowState = WindowState.Minimized; Hide(); } }
private void Button_Click_4(object sender, RoutedEventArgs e) { ConfigureAppConfig.DellAll(); ConfigureAppConfig.AddAndUPAppSeting("isAuto", "2"); CheckAdministrator(); AutoRun(); MessageBox.Show("初始化程序,完成!\n请重新配置!"); }
private void WriteSeting() { ConfigureAppConfig.AddAndUPAppSeting("pageNum", newPages.Count.ToString()); foreach (var page in newPages) { if (string.IsNullOrEmpty(page.Page)) { continue; } ConfigureAppConfig.AddAndUPAppSeting("page" + page.Id.ToString(), page.Page); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { //清除 newPages.Clear(); //获取文本内容 string error = FromTBGetPages(); if (!string.IsNullOrWhiteSpace(error)) { MessageBox.Show($"第{error}行网址输入错误请修改"); return; } //写入配置 WriteSeting(); //开机启动+检测 ConfigureAppConfig.AddAndUPAppSeting("isAuto", "1"); CheckAdministrator(); AutoRun(); MessageBox.Show("设置成功!欢迎使用!"); }