public MainWindow(MainWindowModel model) { _model = model; this.Closing += OnClosing; InitializeComponent(); this.DataContext = _model; var version = Assembly.GetExecutingAssembly().GetName().Version; _model.WindowTitle = "GTA V Eye Tracking Mod Installer " + version.Major + "." + version.Minor + "." + version.Build; _model.UpdateText(); Task.Run(() => { _model.CheckForUpdates(); }); }
private void Browse_OnClick(object sender, RoutedEventArgs e) { var openFileDialog = new OpenFileDialog { DefaultExt = ".exe", Filter = "GTA5.exe|GTA5.exe" }; var showDialog = openFileDialog.ShowDialog(); if (!showDialog.HasValue) { return; } var gtaExePath = openFileDialog.FileName; if (File.Exists(gtaExePath) && Path.GetFileName(gtaExePath).Equals("gta5.exe", StringComparison.OrdinalIgnoreCase)) { _model.SetGtaPath(Path.GetDirectoryName(gtaExePath)); _model.UpdateText(); Task.Run(() => { _model.CheckForUpdates(); }); } }