in snipinsights/windows/SnipInsight/AppManager.cs [1605:1673]
void OnShareEmailWithImage()
{
Telemetry.ApplicationLogger.Instance.SubmitButtonClickEvent(Telemetry.EventName.SaveImageEmailButton, Telemetry.ViewName.ActionRibbon);
try
{
//<moderate-emails>
OnSaveImage();
string file = ViewModel.SavedCaptureImage;
if (!String.IsNullOrWhiteSpace(ViewModel.SavedInkedImage))
{
file = ViewModel.SavedInkedImage;
}
string subject = Resources.Sharing_Snip;
// TODO: Fix the attachment name
string attachmentName = "Capture.png";
if (UserSettings.IsAutoTaggingEnabled && ImageMetadata.CaptionAvailable)
{
subject = string.Format(Resources.Sharing_Snip_Name, ImageMetadata.Caption);
attachmentName = string.Format("{0}.png",ImageMetadata.Caption);
if (attachmentName.Length > 255)
{
attachmentName = attachmentName.Substring(0, 255);
}
}
// Try and open email client with attachment.
if (!EmailManager.OpenEmailClientWithEmbeddedImage(file, subject, attachmentName, "image/png"))
{
File.Delete(file);
bool success;
// Do Work
if (ViewModel.InkedImage != null)
{
success = ClipboardManager.Copy(ViewModel.InkedImage);
}
else if (ViewModel.CapturedImage != null)
{
success = ClipboardManager.Copy(ViewModel.CapturedImage);
}
else
{
throw new InvalidOperationException("no image to share");
}
if (success)
{
string mailToImageFormat = "mailto:?subject=" + subject + "&body=Capture copied to clipboard. please paste here";
Process.Start(mailToImageFormat);
}
else
{
ToastControl toast = new ToastControl(Resources.Message_CopyToClipboardFailed);
toast.ShowInMainWindow();
}
}
}
catch (Exception ex)
{
Diagnostics.ReportException(ex);
}
finally
{
// Trigger
ViewModel.StateMachine.Fire(SnipInsightTrigger.SharingWithImageCompleted);
}
}