mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
Proper event usage in WebpageCaptureForm
This commit is contained in:
parent
7a8547208e
commit
83f998c576
|
@ -37,7 +37,7 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public partial class ScrollingCaptureForm : Form
|
||||
{
|
||||
public event Action<Image> ProcessRequested;
|
||||
public event Action<Image> ImageProcessRequested;
|
||||
|
||||
public ScrollingCaptureOptions Options { get; set; }
|
||||
public Image Result { get; set; }
|
||||
|
@ -96,11 +96,11 @@ protected override void Dispose(bool disposing)
|
|||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected void OnProcessRequested(Image image)
|
||||
protected void OnImageProcessRequested(Image img)
|
||||
{
|
||||
if (ProcessRequested != null)
|
||||
if (ImageProcessRequested != null)
|
||||
{
|
||||
ProcessRequested(image);
|
||||
ImageProcessRequested(img);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ private void StartProcess()
|
|||
{
|
||||
if (Result != null)
|
||||
{
|
||||
OnProcessRequested((Image)Result.Clone());
|
||||
OnImageProcessRequested((Image)Result.Clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public partial class WebpageCaptureForm : Form
|
||||
{
|
||||
public event Action<Image> OnImageUploadRequested;
|
||||
public event Action<Image> OnImageCopyRequested;
|
||||
public event Action<Image> ImageUploadRequested;
|
||||
public event Action<Image> ImageCopyRequested;
|
||||
|
||||
public WebpageCaptureOptions Options { get; set; }
|
||||
public bool IsBusy { get; private set; }
|
||||
|
@ -166,6 +166,22 @@ private void UpdateControls()
|
|||
btnCapture.Enabled = txtURL.TextLength > 0;
|
||||
}
|
||||
|
||||
protected void OnImageUploadRequested(Image img)
|
||||
{
|
||||
if (ImageUploadRequested != null)
|
||||
{
|
||||
ImageUploadRequested(img);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnImageCopyRequested(Image img)
|
||||
{
|
||||
if (ImageCopyRequested != null)
|
||||
{
|
||||
ImageCopyRequested(img);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (pbResult.Image != null)
|
||||
|
|
|
@ -430,7 +430,7 @@ public static void OpenScrollingCapture(TaskSettings taskSettings = null, bool f
|
|||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
ScrollingCaptureForm scrollingCaptureForm = new ScrollingCaptureForm(taskSettings.CaptureSettingsReference.ScrollingCaptureOptions, forceSelection);
|
||||
scrollingCaptureForm.ProcessRequested += image => UploadManager.RunImageTask(image, taskSettings);
|
||||
scrollingCaptureForm.ImageProcessRequested += img => UploadManager.RunImageTask(img, taskSettings);
|
||||
scrollingCaptureForm.Show();
|
||||
}
|
||||
|
||||
|
@ -444,8 +444,8 @@ public static void OpenWebpageCapture(TaskSettings taskSettings = null)
|
|||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
WebpageCaptureForm webpageCaptureForm = new WebpageCaptureForm(Program.Settings.WebpageCaptureOptions);
|
||||
webpageCaptureForm.OnImageUploadRequested += img => UploadManager.RunImageTask(img, taskSettings);
|
||||
webpageCaptureForm.OnImageCopyRequested += img =>
|
||||
webpageCaptureForm.ImageUploadRequested += img => UploadManager.RunImageTask(img, taskSettings);
|
||||
webpageCaptureForm.ImageCopyRequested += img =>
|
||||
{
|
||||
using (img)
|
||||
{
|
||||
|
@ -601,7 +601,7 @@ public static void OpenImageCombiner(TaskSettings taskSettings = null)
|
|||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
ImageCombinerForm imageCombinerForm = new ImageCombinerForm(taskSettings.ToolsSettingsReference.ImageCombinerOptions);
|
||||
imageCombinerForm.ProcessRequested += image => UploadManager.RunImageTask(image, taskSettings);
|
||||
imageCombinerForm.ProcessRequested += img => UploadManager.RunImageTask(img, taskSettings);
|
||||
imageCombinerForm.Show();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue