private async void bSelectBar2_Click(object sender, RoutedEventArgs e) { mainMenu.IsEnabled = false; SpinnerFile1.Visibility = Visibility.Visible; tbFile.Text = "Opening"; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Settings.Default.lastOpenedPath; openFileDialog.Filter = "Age of Empires 3 .BAR files (*.bar)|*.bar"; string filePath; if (openFileDialog.ShowDialog() == true) { filePath = openFileDialog.FileName; Settings.Default.lastOpenedPath = Path.GetDirectoryName(filePath); Settings.Default.Save(); tbBar2Name.ToolTip = filePath; } else { SpinnerFile1.Visibility = Visibility.Collapsed; tbFile.Text = "Open"; mainMenu.IsEnabled = true; return; } try { barComparer = null; NotifyPropertyChanged("barComparer"); Bar2 = null; NewOpen.IsChecked = false; NotifyPropertyChanged("Bar2"); Bar2 = await BarViewModel.Load(filePath, true); NotifyPropertyChanged("Bar2"); NewOpen.IsChecked = true; if (Bar2.barFile.barFileHeader.Version > 5) { gvcEntryNewlastModifiedDate.Width = 0; gvcEntryNewFileName.Width = 345; } else { gvcEntryNewlastModifiedDate.Width = 160; gvcEntryNewFileName.Width = 185; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } SpinnerFile1.Visibility = Visibility.Collapsed; tbFile.Text = "Open"; mainMenu.IsEnabled = true; }
private async void bSelectBar2_Click(object sender, RoutedEventArgs e) { mainMenu.IsEnabled = false; SpinnerFile1.Visibility = Visibility.Visible; tbFile.Text = "Opening"; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Age of Empires 3 .BAR files (*.bar)|*.bar"; string filePath; if (openFileDialog.ShowDialog() == true) { filePath = openFileDialog.FileName; tbBar2Name.ToolTip = filePath; } else { SpinnerFile1.Visibility = Visibility.Collapsed; tbFile.Text = "Open"; mainMenu.IsEnabled = true; return; } try { barComparer = null; NotifyPropertyChanged("barComparer"); Bar2 = null; NewOpen.IsChecked = false; NotifyPropertyChanged("Bar2"); Bar2 = await BarViewModel.Load(filePath, true); NotifyPropertyChanged("Bar2"); NewOpen.IsChecked = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } SpinnerFile1.Visibility = Visibility.Collapsed; tbFile.Text = "Open"; mainMenu.IsEnabled = true; }
private async void Button_Click(object sender, RoutedEventArgs e) { mainMenu.IsEnabled = false; SpinnerFile2.Visibility = Visibility.Visible; tbCompare.Text = "Comparing"; if (Bar1 != null && Bar2 != null) { barComparer = await BarComparer.Compare(Bar1, Bar2); NotifyPropertyChanged("barComparer"); } else { MessageBox.Show("You should open 2 files for comparison !"); } SpinnerFile2.Visibility = Visibility.Collapsed; tbCompare.Text = "Compare"; mainMenu.IsEnabled = true; }