mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-03 02:36:50 +13:00
Allow notification to have a preview even when file isn't saved to disk
This commit is contained in:
parent
d4ff34aa8e
commit
9a20831dfa
3 changed files with 15 additions and 5 deletions
|
@ -183,7 +183,10 @@ public static void Show(int duration, int fadeDuration, ContentAlignment placeme
|
|||
{
|
||||
if ((duration > 0 || fadeDuration > 0) && size.Width > 0 && size.Height > 0)
|
||||
{
|
||||
config.Image = ImageHelpers.LoadImage(config.FilePath);
|
||||
if (config.Image == null)
|
||||
{
|
||||
config.Image = ImageHelpers.LoadImage(config.FilePath);
|
||||
}
|
||||
|
||||
if (config.Image != null || !string.IsNullOrEmpty(config.Text))
|
||||
{
|
||||
|
|
|
@ -421,6 +421,10 @@ private static void task_TaskCompleted(WorkerTask task)
|
|||
Text = "ShareX - " + Resources.TaskManager_task_UploadCompleted_ShareX___Task_completed + "\r\n" + result,
|
||||
URL = result
|
||||
};
|
||||
if (info.DataType == EDataType.Image)
|
||||
{
|
||||
toastConfig.Image = task.GetImage();
|
||||
}
|
||||
NotificationForm.Show((int)(info.TaskSettings.AdvancedSettings.ToastWindowDuration * 1000),
|
||||
(int)(info.TaskSettings.AdvancedSettings.ToastWindowFadeDuration * 1000),
|
||||
info.TaskSettings.AdvancedSettings.ToastWindowPlacement,
|
||||
|
|
|
@ -304,8 +304,6 @@ private void ThreadDoWork()
|
|||
}
|
||||
finally
|
||||
{
|
||||
Dispose();
|
||||
|
||||
if (Info.Job == TaskJob.Job && Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.DeleteFile) && !string.IsNullOrEmpty(Info.FilePath) && File.Exists(Info.FilePath))
|
||||
{
|
||||
File.Delete(Info.FilePath);
|
||||
|
@ -596,9 +594,9 @@ private bool DoAfterCaptureJobs()
|
|||
if (Info.TaskSettings.AfterCaptureJob.HasFlagAny(AfterCaptureTasks.SaveImageToFile, AfterCaptureTasks.SaveImageToFileWithDialog, AfterCaptureTasks.DoOCR,
|
||||
AfterCaptureTasks.UploadImageToHost))
|
||||
{
|
||||
using (tempImage)
|
||||
using (var image = (Image)tempImage.Clone())
|
||||
{
|
||||
ImageData imageData = TaskHelpers.PrepareImage(tempImage, Info.TaskSettings);
|
||||
ImageData imageData = TaskHelpers.PrepareImage(image, Info.TaskSettings);
|
||||
Data = imageData.ImageStream;
|
||||
Info.FileName = Path.ChangeExtension(Info.FileName, imageData.ImageFormat.GetDescription());
|
||||
|
||||
|
@ -956,6 +954,11 @@ public UploadResult ShareURL(string url)
|
|||
return null;
|
||||
}
|
||||
|
||||
public Image GetImage()
|
||||
{
|
||||
return tempImage;
|
||||
}
|
||||
|
||||
private UploadResult GetInvalidConfigResult(IUploaderService uploaderService)
|
||||
{
|
||||
UploadResult ur = new UploadResult();
|
||||
|
|
Loading…
Reference in a new issue