private void MniSearch_Click(object sender, RoutedEventArgs e) { bool isWindowOpen = false; foreach (Window w in Application.Current.Windows) { if (w is SearchFile) { isWindowOpen = true; w.Activate(); } } if (!isWindowOpen) { SearchFile newwindow = new SearchFile(); newwindow.ShowDialog(); } string settedPath = (string)App.Current.Properties["FirstValue"]; if (string.IsNullOrEmpty(settedPath)) { settedPath = System.Configuration.ConfigurationManager.AppSettings["OverwatchRoute"].ToString(); } initializeOSS(settedPath); }
public MainWindow() { string overwatchPath = System.Configuration.ConfigurationManager.AppSettings["OverwatchRoute"].ToString(); Handler = new RegionBlockerHandler(); if (string.IsNullOrEmpty(overwatchPath)) { SearchFile win2 = new SearchFile(); win2.ShowDialog(); if (!string.IsNullOrEmpty((string)App.Current.Properties["FirstValue"])) { overwatchPath = (string)App.Current.Properties["FirstValue"]; } else { this.Close(); } } initializeOSS(overwatchPath); }