public override void Execute(object parameter) { Updater.Updater updater = new Updater.Updater(); IEnumerable <string> files = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.dll").Concat(Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.exe")); Dictionary <string, Version> clientVersions = new Dictionary <string, Version>(); foreach (string file in files) { Version clientVersion = AssemblyName.GetAssemblyName(file).Version; clientVersions[Path.GetFileName(file)] = clientVersion; } Dictionary <string, Version> newAvailableVersions; if (updater.AreNewVersionsAvailable(clientVersions, out newAvailableVersions) && ExolutioYesNoBox.ShowYesNoCancel("New version available", "New version is available. \r\nDo you wish to update?") == MessageBoxResult.Yes) { System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("Exolutio.Updater.exe"); info.UseShellExecute = true; (Current.MainWindow).Close(); System.Diagnostics.Process.Start(info); } else { ExolutioMessageBox.Show("Exolutio Update", "Updates checked", "This is the latest version."); } }
private void lCheckForUpdates_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Updater.Updater updater = new Updater.Updater(); IEnumerable <string> files = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.dll").Concat(Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.exe")); Dictionary <string, Version> clientVersions = new Dictionary <string, Version>(); foreach (string file in files) { Version clientVersion = AssemblyName.GetAssemblyName(file).Version; clientVersions[Path.GetFileName(file)] = clientVersion; } Dictionary <string, Version> newAvailableVersions; if (updater.AreNewVersionsAvailable(clientVersions, out newAvailableVersions) && XCaseYesNoBox.ShowYesNoCancel("New version available", "New version is available. \r\nDo you wish to update?") == MessageBoxResult.Yes) { System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("Updater.exe"); info.UseShellExecute = true; this.Close(); (Application.Current.MainWindow as MainWindow).Close(); System.Diagnostics.Process.Start(info); } else { OkCancelDialog d = new OkCancelDialog(); d.CancelButtonVisibility = Visibility.Collapsed; d.Title = "XCase Update"; d.PrimaryContent = "Check for updates: "; d.SecondaryContent = "This is the latest version."; d.ShowDialog(); } }