public void webmanager_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { if (!e.Cancelled) { try { Process.Start(Document.Editor.My.Computer.FileSystem.SpecialDirectories.Temp + "\\Semagsoft\\DocumentEditor\\setup.exe", "/D=" + Document.Editor.My.Application.Info.DirectoryPath); Document.Editor.My.Application.Shutdown(); } catch (Exception ex) { if (ex.Message.EndsWith("canceled by the user")) { MessageBoxDialog m = new MessageBoxDialog("The update has been canceled!", "Update Canceled", null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/info32.png")); m.Owner = this; m.ShowDialog(); CancelUpdateButton_Click(null, null); } else { MessageBoxDialog m = new MessageBoxDialog("Error running update installer", "Error", null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png")); m.Owner = this; m.ShowDialog(); } } } }
private void TranslateButton_Click(System.Object sender, System.Windows.RoutedEventArgs e) { try { if (Document.Editor.My.Computer.Network.IsAvailable) { Microsoft.DetectedLanguage froml = new Microsoft.DetectedLanguage(); Microsoft.Language tol = new Microsoft.Language(); froml.Code = FromBox.Items.Item(FromBox.SelectedIndex).Tag; tol.Code = ToBox.Items.Item(ToBox.SelectedIndex).Tag; Semagsoft.Translator.TranslatorHelper translator = new Semagsoft.Translator.TranslatorHelper(); string transres = translator.Translate(intContent, froml, tol); TranslatedText.Content = transres; OKButton.IsEnabled = true; } else { MessageBoxDialog m = new MessageBoxDialog("No Internet Found", "Error", null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png")); m.Owner = this; m.ShowDialog(); } } catch (Exception ex) { MessageBoxDialog m = new MessageBoxDialog(ex.Message, ex.ToString(), null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png")); m.Owner = this; m.ShowDialog(); } }
private void ClearRecentButton_Click(System.Object sender, System.Windows.RoutedEventArgs e) { Document.Editor.My.Settings.Options_RecentFiles.Clear(); MessageBoxDialog m = new MessageBoxDialog("Documents Cleared", "Cleared", null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/info32.png")); m.Owner = this; m.ShowDialog(); }
private void TemplatesFolderButton_Click(System.Object sender, System.Windows.RoutedEventArgs e) { try { Process.Start(Document.Editor.My.Application.Info.DirectoryPath + "\\Templates"); } catch (Exception ex) { MessageBoxDialog m = new MessageBoxDialog(ex.Message, ex.ToString(), null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png")); m.Owner = this; m.ShowDialog(); } }
private void ResetButton_Click(System.Object sender, System.Windows.RoutedEventArgs e) { MessageBoxDialog m = new MessageBoxDialog(Document.Editor.My.Application.Info.ProductName + " needs to restart, restart now?", "Are You Sure?", "YesNo", null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/info32.png")); m.Owner = this; m.ShowDialog(); if (m.Result == "Yes") { Document.Editor.My.Settings.Reset(); Document.Editor.My.Application.Shutdown(); } }
private void CheckForUpdateWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { if (e.Result == true) { System.IO.TextReader textreader = System.IO.File.OpenText(Document.Editor.My.Computer.FileSystem.SpecialDirectories.Temp + "\\Semagsoft\\DocumentEditor\\updatechecker.ini"); string version = textreader.ReadLine(); int versionyear = Convert.ToInt16(version.Substring(0, 4)); int versionnumber = Convert.ToInt16(version.Substring(5)); if (versionyear >= Document.Editor.My.Application.Info.Version.Major && versionnumber > Document.Editor.My.Application.Info.Version.Minor) { Collection whatsnew = new Collection(); string line = null; do { line = textreader.ReadLine(); if (line != null) { whatsnew.Add(line.ToString()); } } while (!(line == null)); textreader.Close(); UpdateText.Text = "An update(" + version + ") was found, do you want to apply it?"; ProgressBox.Visibility = System.Windows.Visibility.Collapsed; ApplyUpdateButton.Visibility = System.Windows.Visibility.Visible; CancelUpdateButton.Visibility = System.Windows.Visibility.Visible; WhatsNewTextBox.Clear(); foreach (string s in whatsnew) { WhatsNewTextBox.AppendText(s + Constants.vbNewLine); } WhatsNewTextBlock.Visibility = System.Windows.Visibility.Visible; WhatsNewTextBox.Visibility = System.Windows.Visibility.Visible; } else { MessageBoxDialog m = new MessageBoxDialog("Document.Editor is already up to date", "Up To Date", null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/info32.png")); m.Owner = this; m.ShowDialog(); UpdateBox.Visibility = System.Windows.Visibility.Hidden; AppLogo.Visibility = System.Windows.Visibility.Visible; LicenseButton.Visibility = System.Windows.Visibility.Visible; OKButton.Visibility = System.Windows.Visibility.Visible; UpdateButton.Visibility = System.Windows.Visibility.Visible; } } }
private void UpdateButton_Click(object sender, System.Windows.RoutedEventArgs e) { if (Document.Editor.My.Computer.Network.IsAvailable) { AppLogo.Visibility = System.Windows.Visibility.Hidden; LicenseButton.Visibility = System.Windows.Visibility.Hidden; OKButton.Visibility = System.Windows.Visibility.Hidden; UpdateButton.Visibility = System.Windows.Visibility.Hidden; UpdateBox.Visibility = System.Windows.Visibility.Visible; CheckForUpdateWorker.RunWorkerAsync(); } else { MessageBoxDialog m = new MessageBoxDialog("Internet not found.", "Error", null, null); m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png")); m.Owner = this; m.ShowDialog(); } }