public override void Execute(object parameter = null) { if (parameter is Fluent.ToggleButton) { ToggleButton = (ToggleButton)parameter; } if (CommandLogger.LoggingStarted) { MessageBoxResult result = ExolutioYesNoBox.ShowYesNoCancel("Save log", "Do you wish to save recorded log file?"); if (result == MessageBoxResult.Cancel) { return; } if (result == MessageBoxResult.Yes) { SaveFileDialog dlg = new SaveFileDialog { DefaultExt = ".eXoL", Filter = "eXolutio log files (*.eXoL)|*.eXoL|XML files (*.xml)|*.xml|All files (*.*)|*.*||" }; bool?sresult = dlg.ShowDialog(); if (sresult == true) { XDocument doc = CommandLogger.SerializationDocument; doc.Save(dlg.FileName); CommandLogger.StopLogging(); } } else { CommandLogger.StopLogging(); } } }
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."); } }