예제 #1
0
        static public string CreateLogFile()
        {
            var fd = new SaveFileDialog()
            {
                FileName        = "log_of_translations",
                DefaultExt      = "log",
                CreatePrompt    = false,
                OverwritePrompt = false,
                AddExtension    = true,
                Title           = LanguageData.GetStringFromResource("LogWayTitle"),
                CheckFileExists = false
            };

            DialogResult result = fd.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (File.Exists(fd.FileName))
                {
                    MessageBoxResult answer = System.Windows.MessageBox.Show
                                                  (LanguageData.GetStringFromResource("DeleteFileMess"),
                                                  LanguageData.GetStringFromResource("Delete"),
                                                  MessageBoxButton.YesNo,
                                                  MessageBoxImage.Question);

                    if (answer == MessageBoxResult.Yes)
                    {
                        File.Delete(fd.FileName);
                        using (Stream stream = fd.OpenFile())
                        {
                            StreamWriter writer = new StreamWriter(stream);
                            writer.WriteLine(System.DateTime.Now + "\nLog has been created");
                            writer.Close();
                        }
                    }
                }
            }
            else
            {
                return("");
            }
            return(fd.FileName);
        }
 void ShowTextNotification(object text)
 {
     ShowNotification(LanguageData.GetStringFromResource("aTranslation"), ((ClipboardText)text).TranslatedText, Notifications.Wpf.NotificationType.Information);
 }
예제 #3
0
        void ShowTextNotification(object CursorRectangle)
        {
            var screenText = new ScreenText((MouseRectangle)CursorRectangle);

            ShowNotification(LanguageData.GetStringFromResource("aTranslation") + ":", screenText.TranslatedText, NotificationType.Information);
        }