private bool checkPath(string path, string errmsg) { bool ret = true; string caption = ""; if (path == "") { caption = errmsg + "没有设置"; ret = false; } else if (!Directory.Exists(path)) { caption = errmsg + "不存在"; ret = false; } if (!ret && MessageBox.Show("是否现在设置?", caption, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { SettingWindow.open(); } return(ret); }
public MainWindow() { instance = this; InitializeComponent(); initialized = true; loadIni(); this.Left = (SystemParameters.PrimaryScreenWidth - this.Width) * 0.5; this.Top = (SystemParameters.PrimaryScreenHeight - this.Height) * 0.5; logRichTextBox.Document.Blocks.Add(consoleLines); progressBar.Visibility = Visibility.Hidden; //if (SettingWindow.checkValid()) if (Properties.Settings.Default.firstRun) { Properties.Settings.Default.firstRun = false; Properties.Settings.Default.Save(); SettingWindow.open(); } else if (Properties.Settings.Default.excelPath != "") { addLog("表格目录:" + Properties.Settings.Default.excelPath, lightColor); showList(); } else { addLog("表格目录没有指定", errColor); } bool defaultClient = Properties.Settings.Default.defaultClient; if (!defaultClient) { comboBox.SelectedIndex = 1; } }
private void settingBtn_Click(object sender, RoutedEventArgs e) { SettingWindow.open(); }