/// <summary>
 /// Prompt the user to save the file when the button is clicked.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveButton_Click(object sender, EventArgs e)
 {
     using (SaveFileDialog sfd = new SaveFileDialog())
     {
         sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
         sfd.FileName         = FileName.Replace("/", "-").Replace("\\", "-");
         if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             _screenshot.Save(sfd.FileName);
         }
     }
 }
Beispiel #2
0
        private void ReportUploadError(Screenshot screenshot)
        {
            try
            {
                Program.Tray.SetStatus(TrayIcon.Status.None);
                Program.Tray.ShowError(SR.GenericUploadFailed,
                                       SR.CheckHostConnection.With(Program.Config.FtpHostname));
                System.Media.SystemSounds.Exclamation.Play();

                var fileName = PathUtility.RemoveInvalidFilenameChars(screenshot.GetFileName());
                var target   = Path.Combine(Program.Config.FailedScreenshotsFolder, fileName);
                screenshot.Save(target);
                Trace.WriteLine("Failed screenshot saved to " + target);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }