Ejemplo n.º 1
0
 /// <summary>
 /// Save with showing a dialog
 /// </summary>
 /// <param name="surface"></param>
 /// <param name="captureDetails"></param>
 /// <returns>Path to filename</returns>
 public static string SaveWithDialog(ISurface surface, ICaptureDetails captureDetails)
 {
     string returnValue = null;
     using (SaveImageFileDialog saveImageFileDialog = new SaveImageFileDialog(captureDetails))
     {
         DialogResult dialogResult = saveImageFileDialog.ShowDialog();
         if (dialogResult.Equals(DialogResult.OK))
         {
             try
             {
                 string fileNameWithExtension = saveImageFileDialog.FileNameWithExtension;
                 SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(FormatForFilename(fileNameWithExtension));
                 if (conf.OutputFilePromptQuality)
                 {
                     QualityDialog qualityDialog = new QualityDialog(outputSettings);
                     qualityDialog.ShowDialog();
                 }
                 // TODO: For now we always overwrite, should be changed
                 Save(surface, fileNameWithExtension, true, outputSettings, conf.OutputFileCopyPathToClipboard);
                 returnValue = fileNameWithExtension;
                 IniConfig.Save();
             }
             catch (ExternalException)
             {
                 MessageBox.Show(Language.GetFormattedString("error_nowriteaccess", saveImageFileDialog.FileName).Replace(@"\\", @"\"), Language.GetString("error"));
             }
         }
     }
     return returnValue;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Save with showing a dialog
 /// </summary>
 /// <param name="surface"></param>
 /// <param name="captureDetails"></param>
 /// <returns>Path to filename</returns>
 public static string SaveWithDialog(ISurface surface, ICaptureDetails captureDetails)
 {
     string returnValue = null;
     using (SaveImageFileDialog saveImageFileDialog = new SaveImageFileDialog(captureDetails))
     {
         DialogResult dialogResult = saveImageFileDialog.ShowDialog();
         if (dialogResult.Equals(DialogResult.OK))
         {
             try
             {
                 string fileNameWithExtension = saveImageFileDialog.FileNameWithExtension;
                 SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(FormatForFilename(fileNameWithExtension));
                 if (conf.OutputFilePromptQuality)
                 {
                     QualityDialog qualityDialog = new QualityDialog(outputSettings);
                     qualityDialog.ShowDialog();
                 }
                 // For now we always overwrite, should be changed
                 Save(surface, fileNameWithExtension, true, outputSettings, conf.OutputFileCopyPathToClipboard);
                 returnValue = fileNameWithExtension;
                 IniConfig.Save();
             }
             catch (ExternalException)
             {
                 MessageBox.Show(string.Format("Cannot save file to {0}.\r\nPlease check write accessibility of the selected storage location.",
                     saveImageFileDialog.FileName).Replace(@"\\", @"\"), "Error");
             }
         }
     }
     return returnValue;
 }