private void MainWindow_Loaded(object sender, RoutedEventArgs e) { try { string fileName = "patcher.xml"; string exeFileName = "XWingAlliance.exe"; if (!System.IO.File.Exists(fileName)) { fileName = this.GetOpenFileName(fileName, ".xml", "Patcher (*.xml)|*.xml", fileName); } if (System.IO.File.Exists(fileName)) { if (!System.IO.File.Exists(exeFileName)) { exeFileName = this.GetOpenFileName(exeFileName, ".exe", "XWingAlliance.exe (*.exe)|*.exe", exeFileName); } } if (!System.IO.File.Exists(fileName) || !System.IO.File.Exists(exeFileName)) { this.Close(); } else { this.Patcher = new PatcherModel(fileName, exeFileName); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } this.DataContext = this; }
private void UpdateModel() { this.DataContext = null; this.Patcher = new PatcherModel(this.Patcher.FileName, this.Patcher.ExeFileName); this.DataContext = this; }