diff --git a/Pinta.Core/Effects/BaseEffect.cs b/Pinta.Core/Effects/BaseEffect.cs
index a2bb434485..c714b1750f 100644
--- a/Pinta.Core/Effects/BaseEffect.cs
+++ b/Pinta.Core/Effects/BaseEffect.cs
@@ -25,7 +25,7 @@
// THE SOFTWARE.
using System;
-using System.Diagnostics;
+using System.Threading.Tasks;
using Cairo;
using Mono.Addins;
using Mono.Addins.Localization;
@@ -84,10 +84,13 @@ public abstract class BaseEffect
/// Launches the configuration dialog for this effect/adjustment.
/// If IsConfigurable is true, the ConfigDialogResponse event will be invoked when the user accepts or cancels the dialog.
///
- public virtual void LaunchConfiguration ()
+ /// Whether the user's response was positive or negative
+ public virtual Task LaunchConfiguration ()
{
if (IsConfigurable)
throw new NotImplementedException ($"{GetType ()} is marked as configurable, but has not implemented LaunchConfiguration");
+
+ return Task.FromResult (true); // Placeholder
}
///
@@ -97,22 +100,9 @@ public virtual void LaunchConfiguration ()
/// The localizer for the effect add-in. This is used to fetch translations for the
/// strings in the dialog.
///
- protected void LaunchSimpleEffectDialog (AddinLocalizer localizer)
+ protected Task LaunchSimpleEffectDialog (AddinLocalizer localizer)
{
- PintaCore.Chrome.LaunchSimpleEffectDialog (this, new AddinLocalizerWrapper (localizer));
- }
-
- ///
- /// Emitted when the configuration dialog is accepted or cancelled by the user.
- ///
- public event EventHandler? ConfigDialogResponse;
-
- ///
- /// Notify that the configuration dialog was accepted or cancelled by the user.
- ///
- public void OnConfigDialogResponse (bool accepted)
- {
- ConfigDialogResponse?.Invoke (this, new ConfigDialogResponseEventArgs (accepted));
+ return PintaCore.Chrome.LaunchSimpleEffectDialog (this, new AddinLocalizerWrapper (localizer));
}
#region Overridable Render Methods
@@ -188,13 +178,6 @@ public virtual BaseEffect Clone ()
return effect;
}
-
- public class ConfigDialogResponseEventArgs : EventArgs
- {
- public ConfigDialogResponseEventArgs (bool accepted) { Accepted = accepted; }
-
- public bool Accepted { get; }
- }
}
///
diff --git a/Pinta.Core/Managers/ChromeManager.cs b/Pinta.Core/Managers/ChromeManager.cs
index bd01619dfd..88cf22124e 100644
--- a/Pinta.Core/Managers/ChromeManager.cs
+++ b/Pinta.Core/Managers/ChromeManager.cs
@@ -25,15 +25,15 @@
// THE SOFTWARE.
using System;
-using Gtk;
+using System.Threading.Tasks;
using Mono.Addins.Localization;
namespace Pinta.Core;
public interface IChromeService
{
- Window MainWindow { get; }
- void LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer);
+ Gtk.Window MainWindow { get; }
+ Task LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer);
}
public sealed class ChromeManager : IChromeService
@@ -43,28 +43,25 @@ public sealed class ChromeManager : IChromeService
// NRT - These are all initialized via the Initialize* functions
// but it would be nice to rewrite it to provably non-null.
- public Application Application { get; private set; } = null!;
- public Window MainWindow { get; private set; } = null!;
- public Widget ImageTabsNotebook { get; private set; } = null!;
+ public Gtk.Application Application { get; private set; } = null!;
+ public Gtk.Window MainWindow { get; private set; } = null!;
+ public Gtk.Widget ImageTabsNotebook { get; private set; } = null!;
private IProgressDialog progress_dialog = null!;
private ErrorDialogHandler error_dialog_handler = null!;
private MessageDialogHandler message_dialog_handler = null!;
private SimpleEffectDialogHandler simple_effect_dialog_handler = null!;
- public Box? MainToolBar { get; private set; }
- public Box ToolToolBar { get; private set; } = null!;
- public Widget ToolBox { get; private set; } = null!;
- public Box StatusBar { get; private set; } = null!;
+ public Gtk.Box? MainToolBar { get; private set; }
+ public Gtk.Box ToolToolBar { get; private set; } = null!;
+ public Gtk.Widget ToolBox { get; private set; } = null!;
+ public Gtk.Box StatusBar { get; private set; } = null!;
public IProgressDialog ProgressDialog => progress_dialog;
public Gio.Menu AdjustmentsMenu { get; private set; } = null!;
public Gio.Menu EffectsMenu { get; private set; } = null!;
- public ChromeManager ()
- {
- }
+ public ChromeManager () { }
- #region Public Properties
public PointI LastCanvasCursorPoint {
get => last_canvas_cursor_point;
set {
@@ -86,40 +83,38 @@ public bool MainWindowBusy {
MainWindow.Cursor = Gdk.Cursor.NewFromName (Pinta.Resources.StandardCursors.Default, null);
}
}
- #endregion
- #region Public Methods
public void InitializeApplication (Gtk.Application application)
{
Application = application;
}
- public void InitializeWindowShell (Window shell)
+ public void InitializeWindowShell (Gtk.Window shell)
{
MainWindow = shell;
}
- public void InitializeToolToolBar (Box toolToolBar)
+ public void InitializeToolToolBar (Gtk.Box toolToolBar)
{
ToolToolBar = toolToolBar;
}
- public void InitializeMainToolBar (Box mainToolBar)
+ public void InitializeMainToolBar (Gtk.Box mainToolBar)
{
MainToolBar = mainToolBar;
}
- public void InitializeStatusBar (Box statusbar)
+ public void InitializeStatusBar (Gtk.Box statusbar)
{
StatusBar = statusbar;
}
- public void InitializeToolBox (Widget toolbox)
+ public void InitializeToolBox (Gtk.Widget toolbox)
{
ToolBox = toolbox;
}
- public void InitializeImageTabsNotebook (Widget notebook)
+ public void InitializeImageTabsNotebook (Gtk.Widget notebook)
{
ImageTabsNotebook = notebook;
}
@@ -150,12 +145,12 @@ public void InitializeSimpleEffectDialog (SimpleEffectDialogHandler handler)
simple_effect_dialog_handler = handler;
}
- public void ShowErrorDialog (Window parent, string message, string body, string details)
+ public void ShowErrorDialog (Gtk.Window parent, string message, string body, string details)
{
error_dialog_handler (parent, message, body, details);
}
- public void ShowMessageDialog (Window parent, string message, string body)
+ public void ShowMessageDialog (Gtk.Window parent, string message, string body)
{
message_dialog_handler (parent, message, body);
}
@@ -165,11 +160,10 @@ public void SetStatusBarText (string text)
OnStatusBarTextChanged (text);
}
- public void LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer)
+ public Task LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer)
{
- simple_effect_dialog_handler (effect, localizer);
+ return simple_effect_dialog_handler (effect, localizer);
}
- #endregion
private void OnLastCanvasCursorPointChanged ()
{
@@ -181,10 +175,8 @@ private void OnStatusBarTextChanged (string text)
StatusBarTextChanged?.Invoke (this, new TextChangedEventArgs (text));
}
- #region Public Events
public event EventHandler? LastCanvasCursorPointChanged;
public event EventHandler? StatusBarTextChanged;
- #endregion
}
public interface IProgressDialog
@@ -197,6 +189,6 @@ public interface IProgressDialog
event EventHandler Canceled;
}
-public delegate void ErrorDialogHandler (Window parent, string message, string body, string details);
-public delegate void MessageDialogHandler (Window parent, string message, string body);
-public delegate void SimpleEffectDialogHandler (BaseEffect effect, IAddinLocalizer localizer);
+public delegate void ErrorDialogHandler (Gtk.Window parent, string message, string body, string details);
+public delegate void MessageDialogHandler (Gtk.Window parent, string message, string body);
+public delegate Task SimpleEffectDialogHandler (BaseEffect effect, IAddinLocalizer localizer);
diff --git a/Pinta.Core/Managers/LivePreviewManager.cs b/Pinta.Core/Managers/LivePreviewManager.cs
index 44a87ae3ab..b27d911602 100644
--- a/Pinta.Core/Managers/LivePreviewManager.cs
+++ b/Pinta.Core/Managers/LivePreviewManager.cs
@@ -81,7 +81,7 @@ internal LivePreviewManager (
public event EventHandler? RenderUpdated;
public event EventHandler? Ended;
- public void Start (BaseEffect effect)
+ public async void Start (BaseEffect effect)
{
if (live_preview_enabled)
throw new InvalidOperationException ("LivePreviewManager.Start() called while live preview is already enabled.");
@@ -137,23 +137,13 @@ public void Start (BaseEffect effect)
renderer.Start (effect, layer.Surface, live_preview_surface);
if (effect.IsConfigurable) {
- EventHandler? handler = null;
- handler = (_, args) => {
- if (!args.Accepted) {
- chrome_manager.MainWindowBusy = true;
- Cancel ();
- } else {
- chrome_manager.MainWindowBusy = true;
- Apply ();
- }
- // Unsubscribe once we're done.
- effect.ConfigDialogResponse -= handler;
- };
-
- effect.ConfigDialogResponse += handler;
-
- effect.LaunchConfiguration ();
+ bool response = await effect.LaunchConfiguration ();
+ chrome_manager.MainWindowBusy = true;
+ if (response)
+ Apply ();
+ else
+ Cancel ();
} else {
chrome_manager.MainWindowBusy = true;
@@ -277,15 +267,15 @@ void EffectData_PropertyChanged (object? sender, PropertyChangedEventArgs e)
private sealed class Renderer : AsyncEffectRenderer
{
readonly LivePreviewManager manager;
- readonly ChromeManager chrome_manager;
+ readonly ChromeManager chrome;
internal Renderer (
LivePreviewManager manager,
AsyncEffectRenderer.Settings settings,
- ChromeManager chromeManager)
+ ChromeManager chrome)
: base (settings)
{
this.manager = manager;
- this.chrome_manager = chromeManager;
+ this.chrome = chrome;
}
protected override void OnUpdate (
@@ -293,7 +283,7 @@ protected override void OnUpdate (
RectangleI updatedBounds)
{
Debug.WriteLine (DateTime.Now.ToString ("HH:mm:ss:ffff") + " LivePreviewManager.OnUpdate() progress: " + progress);
- chrome_manager.ProgressDialog.Progress = progress;
+ chrome.ProgressDialog.Progress = progress;
manager.FireLivePreviewRenderUpdatedEvent (progress, updatedBounds);
}
diff --git a/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs b/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs
index 3a0a5f5997..ced0d9e14e 100644
--- a/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs
+++ b/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -50,7 +51,7 @@ void HandleEffectDataPropertyChanged (object? sender, System.ComponentModel.Prop
table_calculated = false;
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Adjustments/CurvesEffect.cs b/Pinta.Effects/Adjustments/CurvesEffect.cs
index 108787ac60..a95dc56fe2 100644
--- a/Pinta.Effects/Adjustments/CurvesEffect.cs
+++ b/Pinta.Effects/Adjustments/CurvesEffect.cs
@@ -10,6 +10,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
@@ -40,19 +41,23 @@ public CurvesEffect (IServiceProvider services)
EffectData = new CurvesData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
{
+ TaskCompletionSource completionSource = new ();
+
CurvesDialog dialog = new (chrome, Data) {
Title = Name,
IconName = Icon,
};
dialog.OnResponse += (_, args) => {
- OnConfigDialogResponse (args.ResponseId == (int) Gtk.ResponseType.Ok);
+ completionSource.SetResult (Gtk.ResponseType.Ok == (Gtk.ResponseType) args.ResponseId);
dialog.Destroy ();
};
dialog.Present ();
+
+ return completionSource.Task;
}
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Adjustments/HueSaturationEffect.cs b/Pinta.Effects/Adjustments/HueSaturationEffect.cs
index 06bcbe74ee..18c03ccf97 100644
--- a/Pinta.Effects/Adjustments/HueSaturationEffect.cs
+++ b/Pinta.Effects/Adjustments/HueSaturationEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -34,7 +35,7 @@ public HueSaturationEffect (IServiceProvider services)
EffectData = new HueSaturationData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
private UnaryPixelOp CreateOptimalOp ()
diff --git a/Pinta.Effects/Adjustments/LevelsEffect.cs b/Pinta.Effects/Adjustments/LevelsEffect.cs
index dd20240d80..80e8e62154 100644
--- a/Pinta.Effects/Adjustments/LevelsEffect.cs
+++ b/Pinta.Effects/Adjustments/LevelsEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
@@ -40,23 +41,23 @@ public LevelsEffect (IServiceProvider services)
EffectData = new LevelsData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
{
+ TaskCompletionSource completionSource = new ();
+
LevelsDialog dialog = new (chrome, workspace, Data) {
Title = Name,
IconName = Icon,
};
dialog.OnResponse += (_, args) => {
-
- if (args.ResponseId == (int) Gtk.ResponseType.None)
- return;
-
- OnConfigDialogResponse (args.ResponseId == (int) Gtk.ResponseType.Ok);
+ completionSource.SetResult (Gtk.ResponseType.Ok == (Gtk.ResponseType) args.ResponseId);
dialog.Destroy ();
};
dialog.Present ();
+
+ return completionSource.Task;
}
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Adjustments/PosterizeEffect.cs b/Pinta.Effects/Adjustments/PosterizeEffect.cs
index a4955b47fc..3d80850274 100644
--- a/Pinta.Effects/Adjustments/PosterizeEffect.cs
+++ b/Pinta.Effects/Adjustments/PosterizeEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
@@ -38,20 +39,24 @@ public PosterizeEffect (IServiceProvider services)
EffectData = new PosterizeData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
{
+ TaskCompletionSource completionSource = new ();
+
PosterizeDialog dialog = new (chrome) {
Title = Name,
IconName = Icon,
- EffectData = Data
+ EffectData = Data,
};
dialog.OnResponse += (_, args) => {
- OnConfigDialogResponse (args.ResponseId == (int) Gtk.ResponseType.Ok);
+ completionSource.SetResult (Gtk.ResponseType.Ok == (Gtk.ResponseType) args.ResponseId);
dialog.Destroy ();
};
dialog.Present ();
+
+ return completionSource.Task;
}
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Effects/AddNoiseEffect.cs b/Pinta.Effects/Effects/AddNoiseEffect.cs
index 4e6e1734e5..a895d60b42 100644
--- a/Pinta.Effects/Effects/AddNoiseEffect.cs
+++ b/Pinta.Effects/Effects/AddNoiseEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -42,7 +43,7 @@ public AddNoiseEffect (IServiceProvider services)
EffectData = new NoiseData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/AlignObjectEffect.cs b/Pinta.Effects/Effects/AlignObjectEffect.cs
index d73b733635..995f145ff1 100644
--- a/Pinta.Effects/Effects/AlignObjectEffect.cs
+++ b/Pinta.Effects/Effects/AlignObjectEffect.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -26,21 +27,27 @@ public AlignObjectEffect (IServiceProvider services)
chrome = services.GetService ();
EffectData = new AlignObjectData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
{
+ TaskCompletionSource completionSource = new ();
+
AlignmentDialog dialog = new (chrome);
// Align to the default position
Data.Position = dialog.SelectedPosition;
- dialog.PositionChanged += (_, _) => Data.Position = dialog.SelectedPosition;
+ dialog.PositionChanged += (_, _) => {
+ Data.Position = dialog.SelectedPosition;
+ };
dialog.OnResponse += (_, args) => {
- OnConfigDialogResponse (args.ResponseId == (int) Gtk.ResponseType.Ok);
+ completionSource.SetResult (Gtk.ResponseType.Ok == (Gtk.ResponseType) args.ResponseId);
dialog.Destroy ();
};
dialog.Present ();
+
+ return completionSource.Task;
}
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Effects/BulgeEffect.cs b/Pinta.Effects/Effects/BulgeEffect.cs
index 66e784041a..bc6c0d8d33 100644
--- a/Pinta.Effects/Effects/BulgeEffect.cs
+++ b/Pinta.Effects/Effects/BulgeEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -36,7 +37,7 @@ public BulgeEffect (IServiceProvider services)
EffectData = new BulgeData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/CloudsEffect.cs b/Pinta.Effects/Effects/CloudsEffect.cs
index 1cf644fcea..dd96bc7ac0 100644
--- a/Pinta.Effects/Effects/CloudsEffect.cs
+++ b/Pinta.Effects/Effects/CloudsEffect.cs
@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -50,7 +51,7 @@ public CloudsEffect (IServiceProvider services)
EffectData = new CloudsData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/DitheringEffect.cs b/Pinta.Effects/Effects/DitheringEffect.cs
index 5d9d7fcbfc..e6677c0aa6 100644
--- a/Pinta.Effects/Effects/DitheringEffect.cs
+++ b/Pinta.Effects/Effects/DitheringEffect.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -24,7 +25,7 @@ public DitheringEffect (IServiceProvider services)
EffectData = new DitheringData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
private sealed record DitheringSettings (
diff --git a/Pinta.Effects/Effects/EdgeDetectEffect.cs b/Pinta.Effects/Effects/EdgeDetectEffect.cs
index f458eeeca6..d75471deaa 100644
--- a/Pinta.Effects/Effects/EdgeDetectEffect.cs
+++ b/Pinta.Effects/Effects/EdgeDetectEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -41,7 +42,7 @@ public EdgeDetectEffect (IServiceProvider services)
EffectData = new EdgeDetectData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Effects/EmbossEffect.cs b/Pinta.Effects/Effects/EmbossEffect.cs
index 591f40d9fc..d38f5b2f8d 100644
--- a/Pinta.Effects/Effects/EmbossEffect.cs
+++ b/Pinta.Effects/Effects/EmbossEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -41,7 +42,7 @@ public EmbossEffect (IServiceProvider services)
EffectData = new EmbossData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/FeatherEffect.cs b/Pinta.Effects/Effects/FeatherEffect.cs
index 8dd4e8a311..21b437c6ca 100644
--- a/Pinta.Effects/Effects/FeatherEffect.cs
+++ b/Pinta.Effects/Effects/FeatherEffect.cs
@@ -34,7 +34,7 @@ public FeatherEffect (IServiceProvider services)
EffectData = new FeatherData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
protected override void Render (
diff --git a/Pinta.Effects/Effects/FragmentEffect.cs b/Pinta.Effects/Effects/FragmentEffect.cs
index b04de78a97..74b5222add 100644
--- a/Pinta.Effects/Effects/FragmentEffect.cs
+++ b/Pinta.Effects/Effects/FragmentEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -43,7 +44,7 @@ public FragmentEffect (IServiceProvider services)
EffectData = new FragmentData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/FrostedGlassEffect.cs b/Pinta.Effects/Effects/FrostedGlassEffect.cs
index 585277faed..bbc647aba2 100644
--- a/Pinta.Effects/Effects/FrostedGlassEffect.cs
+++ b/Pinta.Effects/Effects/FrostedGlassEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -36,7 +37,7 @@ public FrostedGlassEffect (IServiceProvider services)
EffectData = new FrostedGlassData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/GaussianBlurEffect.cs b/Pinta.Effects/Effects/GaussianBlurEffect.cs
index bb671a3e37..22fc48385a 100644
--- a/Pinta.Effects/Effects/GaussianBlurEffect.cs
+++ b/Pinta.Effects/Effects/GaussianBlurEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -37,7 +38,7 @@ public GaussianBlurEffect (IServiceProvider services)
EffectData = new GaussianBlurData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/GlowEffect.cs b/Pinta.Effects/Effects/GlowEffect.cs
index b24eb01edd..e2f111430b 100644
--- a/Pinta.Effects/Effects/GlowEffect.cs
+++ b/Pinta.Effects/Effects/GlowEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -41,7 +42,7 @@ public GlowEffect (IServiceProvider services)
this.services = services;
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/InkSketchEffect.cs b/Pinta.Effects/Effects/InkSketchEffect.cs
index e46c0f4c96..2fc864ae6b 100644
--- a/Pinta.Effects/Effects/InkSketchEffect.cs
+++ b/Pinta.Effects/Effects/InkSketchEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -60,7 +61,7 @@ static InkSketchEffect ()
);
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/JuliaFractalEffect.cs b/Pinta.Effects/Effects/JuliaFractalEffect.cs
index 5f562d9465..1d505fea2a 100644
--- a/Pinta.Effects/Effects/JuliaFractalEffect.cs
+++ b/Pinta.Effects/Effects/JuliaFractalEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -44,7 +45,7 @@ public JuliaFractalEffect (IServiceProvider services)
EffectData = new JuliaFractalData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/MandelbrotFractalEffect.cs b/Pinta.Effects/Effects/MandelbrotFractalEffect.cs
index 650c948dcf..a037e27744 100644
--- a/Pinta.Effects/Effects/MandelbrotFractalEffect.cs
+++ b/Pinta.Effects/Effects/MandelbrotFractalEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -45,7 +46,7 @@ public MandelbrotFractalEffect (IServiceProvider services)
EffectData = new MandelbrotFractalData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/MedianEffect.cs b/Pinta.Effects/Effects/MedianEffect.cs
index c53d14b5f7..ecdc1d6c46 100644
--- a/Pinta.Effects/Effects/MedianEffect.cs
+++ b/Pinta.Effects/Effects/MedianEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -39,7 +40,7 @@ public MedianEffect (IServiceProvider services)
EffectData = new MedianData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/MotionBlurEffect.cs b/Pinta.Effects/Effects/MotionBlurEffect.cs
index 8ac2bdaf8b..50881bdd38 100644
--- a/Pinta.Effects/Effects/MotionBlurEffect.cs
+++ b/Pinta.Effects/Effects/MotionBlurEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -43,7 +44,7 @@ public MotionBlurEffect (IServiceProvider services)
EffectData = new MotionBlurData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/OilPaintingEffect.cs b/Pinta.Effects/Effects/OilPaintingEffect.cs
index 00a024d85a..12740916f3 100644
--- a/Pinta.Effects/Effects/OilPaintingEffect.cs
+++ b/Pinta.Effects/Effects/OilPaintingEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -36,7 +37,7 @@ public OilPaintingEffect (IServiceProvider services)
EffectData = new OilPaintingData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/OutlineEdgeEffect.cs b/Pinta.Effects/Effects/OutlineEdgeEffect.cs
index e585ef9e42..e640f2dbf8 100644
--- a/Pinta.Effects/Effects/OutlineEdgeEffect.cs
+++ b/Pinta.Effects/Effects/OutlineEdgeEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -39,7 +40,7 @@ public OutlineEdgeEffect (IServiceProvider services)
EffectData = new OutlineEdgeData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/OutlineObjectEffect.cs b/Pinta.Effects/Effects/OutlineObjectEffect.cs
index 0861ef3b44..8b90a7f016 100644
--- a/Pinta.Effects/Effects/OutlineObjectEffect.cs
+++ b/Pinta.Effects/Effects/OutlineObjectEffect.cs
@@ -36,7 +36,7 @@ public OutlineObjectEffect (IServiceProvider services)
EffectData = new OutlineObjectData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
protected override void Render (ImageSurface src, ImageSurface dest, RectangleI roi)
diff --git a/Pinta.Effects/Effects/PencilSketchEffect.cs b/Pinta.Effects/Effects/PencilSketchEffect.cs
index 4c67eced07..c672c83fc6 100644
--- a/Pinta.Effects/Effects/PencilSketchEffect.cs
+++ b/Pinta.Effects/Effects/PencilSketchEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -49,7 +50,7 @@ public PencilSketchEffect (IServiceProvider services)
color_dodge_op = new UserBlendOps.ColorDodgeBlendOp ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/PixelateEffect.cs b/Pinta.Effects/Effects/PixelateEffect.cs
index 70d113d393..9c9bf7e690 100644
--- a/Pinta.Effects/Effects/PixelateEffect.cs
+++ b/Pinta.Effects/Effects/PixelateEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -37,7 +38,7 @@ public PixelateEffect (IServiceProvider services)
EffectData = new PixelateData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/RadialBlurEffect.cs b/Pinta.Effects/Effects/RadialBlurEffect.cs
index e6057b9bed..11fed5a39b 100644
--- a/Pinta.Effects/Effects/RadialBlurEffect.cs
+++ b/Pinta.Effects/Effects/RadialBlurEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -37,7 +38,7 @@ public RadialBlurEffect (IServiceProvider services)
EffectData = new RadialBlurData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/RedEyeRemoveEffect.cs b/Pinta.Effects/Effects/RedEyeRemoveEffect.cs
index e7ef363657..c2533a1f3b 100644
--- a/Pinta.Effects/Effects/RedEyeRemoveEffect.cs
+++ b/Pinta.Effects/Effects/RedEyeRemoveEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -37,7 +38,7 @@ public RedEyeRemoveEffect (IServiceProvider services)
EffectData = new RedEyeRemoveData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Effects/ReduceNoiseEffect.cs b/Pinta.Effects/Effects/ReduceNoiseEffect.cs
index a332b65739..7c0f2c61f7 100644
--- a/Pinta.Effects/Effects/ReduceNoiseEffect.cs
+++ b/Pinta.Effects/Effects/ReduceNoiseEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -40,7 +41,7 @@ public ReduceNoiseEffect (IServiceProvider services)
EffectData = new ReduceNoiseData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/ReliefEffect.cs b/Pinta.Effects/Effects/ReliefEffect.cs
index 0b9e6c356a..d3ee6d8413 100644
--- a/Pinta.Effects/Effects/ReliefEffect.cs
+++ b/Pinta.Effects/Effects/ReliefEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -32,7 +33,7 @@ public ReliefEffect (IServiceProvider services)
public override string EffectMenuCategory => Translations.GetString ("Stylize");
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
public override string Icon => Pinta.Resources.Icons.EffectsStylizeRelief;
diff --git a/Pinta.Effects/Effects/SharpenEffect.cs b/Pinta.Effects/Effects/SharpenEffect.cs
index a5c893e0e5..8dfd08ebd7 100644
--- a/Pinta.Effects/Effects/SharpenEffect.cs
+++ b/Pinta.Effects/Effects/SharpenEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -37,7 +38,7 @@ public SharpenEffect (IServiceProvider services)
EffectData = new SharpenData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
public override void Render (ImageSurface src, ImageSurface dest, ReadOnlySpan rois)
diff --git a/Pinta.Effects/Effects/SoftenPortraitEffect.cs b/Pinta.Effects/Effects/SoftenPortraitEffect.cs
index 8a021bd36a..8aee43911b 100644
--- a/Pinta.Effects/Effects/SoftenPortraitEffect.cs
+++ b/Pinta.Effects/Effects/SoftenPortraitEffect.cs
@@ -34,6 +34,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -73,7 +74,7 @@ public SoftenPortraitEffect (IServiceProvider services)
overlay_op = new UserBlendOps.OverlayBlendOp ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
private sealed record SoftenPortraitSettings (
diff --git a/Pinta.Effects/Effects/TileEffect.cs b/Pinta.Effects/Effects/TileEffect.cs
index 1dee738304..1e84412840 100644
--- a/Pinta.Effects/Effects/TileEffect.cs
+++ b/Pinta.Effects/Effects/TileEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -37,7 +38,7 @@ public TileEffect (IServiceProvider services)
EffectData = new TileData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/TwistEffect.cs b/Pinta.Effects/Effects/TwistEffect.cs
index 2a56b9a0cd..fcd7d7d3c3 100644
--- a/Pinta.Effects/Effects/TwistEffect.cs
+++ b/Pinta.Effects/Effects/TwistEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Immutable;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -38,7 +39,7 @@ public TwistEffect (IServiceProvider services)
EffectData = new TwistData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/UnfocusEffect.cs b/Pinta.Effects/Effects/UnfocusEffect.cs
index af7b20b51e..4d0d83b43c 100644
--- a/Pinta.Effects/Effects/UnfocusEffect.cs
+++ b/Pinta.Effects/Effects/UnfocusEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -39,7 +40,7 @@ public UnfocusEffect (IServiceProvider services)
EffectData = new UnfocusData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Effects/VignetteEffect.cs b/Pinta.Effects/Effects/VignetteEffect.cs
index bf3fada8b3..8d1ecb45c7 100644
--- a/Pinta.Effects/Effects/VignetteEffect.cs
+++ b/Pinta.Effects/Effects/VignetteEffect.cs
@@ -30,6 +30,7 @@
// THE SOFTWARE.
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -64,7 +65,7 @@ public VignetteEffect (IServiceProvider services)
EffectData = new VignetteData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
private sealed record VignetteSettings (
diff --git a/Pinta.Effects/Effects/VoronoiDiagramEffect.cs b/Pinta.Effects/Effects/VoronoiDiagramEffect.cs
index 22fdbf6b04..e9805dd6be 100644
--- a/Pinta.Effects/Effects/VoronoiDiagramEffect.cs
+++ b/Pinta.Effects/Effects/VoronoiDiagramEffect.cs
@@ -3,6 +3,7 @@
using System.Collections.Immutable;
using System.ComponentModel;
using System.Linq;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -36,7 +37,7 @@ public VoronoiDiagramEffect (IServiceProvider services)
EffectData = new VoronoiDiagramData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
private sealed record VoronoiSettings (
diff --git a/Pinta.Effects/Effects/WarpEffect.cs b/Pinta.Effects/Effects/WarpEffect.cs
index 4d801504e3..4bcf748575 100644
--- a/Pinta.Effects/Effects/WarpEffect.cs
+++ b/Pinta.Effects/Effects/WarpEffect.cs
@@ -9,6 +9,7 @@
using System;
using System.Drawing;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -48,7 +49,7 @@ public WarpEffect ()
EffectData = new WarpData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> Chrome.LaunchSimpleEffectDialog (this);
protected double DefaultRadius { get; private set; } = 0;
diff --git a/Pinta.Effects/Effects/ZoomBlurEffect.cs b/Pinta.Effects/Effects/ZoomBlurEffect.cs
index 6e82a61730..64a00146d7 100644
--- a/Pinta.Effects/Effects/ZoomBlurEffect.cs
+++ b/Pinta.Effects/Effects/ZoomBlurEffect.cs
@@ -8,6 +8,7 @@
/////////////////////////////////////////////////////////////////////////////////
using System;
+using System.Threading.Tasks;
using Cairo;
using Pinta.Core;
using Pinta.Gui.Widgets;
@@ -36,7 +37,7 @@ public ZoomBlurEffect (IServiceProvider services)
EffectData = new ZoomBlurData ();
}
- public override void LaunchConfiguration ()
+ public override Task LaunchConfiguration ()
=> chrome.LaunchSimpleEffectDialog (this);
#region Algorithm Code Ported From PDN
diff --git a/Pinta.Effects/Utilities/EffectHelper.cs b/Pinta.Effects/Utilities/EffectHelper.cs
index 2d8bcaed37..1866bda0f5 100644
--- a/Pinta.Effects/Utilities/EffectHelper.cs
+++ b/Pinta.Effects/Utilities/EffectHelper.cs
@@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using System.Threading.Tasks;
using Mono.Addins.Localization;
using Pinta.Core;
@@ -34,7 +35,7 @@ internal static class EffectHelper
///
/// Launch an effect dialog using Pinta's translation template.
///
- internal static void LaunchSimpleEffectDialog (this IChromeService chrome, BaseEffect effect)
+ internal static Task LaunchSimpleEffectDialog (this IChromeService chrome, BaseEffect effect)
=> chrome.LaunchSimpleEffectDialog (effect, new PintaLocalizer ());
}
diff --git a/Pinta.Gui.Widgets/Dialogs/SimpleEffectDialog.cs b/Pinta.Gui.Widgets/Dialogs/SimpleEffectDialog.cs
index 0152a73f71..7594ab4820 100644
--- a/Pinta.Gui.Widgets/Dialogs/SimpleEffectDialog.cs
+++ b/Pinta.Gui.Widgets/Dialogs/SimpleEffectDialog.cs
@@ -33,6 +33,7 @@
using System.ComponentModel;
using System.Linq;
using System.Reflection;
+using System.Threading.Tasks;
using Mono.Addins.Localization;
using Pinta.Core;
@@ -85,9 +86,12 @@ public SimpleEffectDialog (
/// The IAddinLocalizer provides a generic way to get translated strings both for
/// Pinta's effects and for effect add-ins.
///
- public static void Launch (BaseEffect effect, IAddinLocalizer localizer)
+ public static Task Launch (BaseEffect effect, IAddinLocalizer localizer)
{
- ArgumentNullException.ThrowIfNull (effect.EffectData);
+ if (effect.EffectData == null)
+ throw new ArgumentException ($"{effect.EffectData} should not be null", nameof (effect));
+
+ TaskCompletionSource responseCompletion = new ();
SimpleEffectDialog dialog = new (
effect.Name,
@@ -96,14 +100,16 @@ public static void Launch (BaseEffect effect, IAddinLocalizer localizer)
localizer);
// Hookup event handling for live preview.
- dialog.EffectDataChanged += (o, e) => effect.EffectData?.FirePropertyChanged (e.PropertyName);
+ dialog.EffectDataChanged += (o, e) => effect.EffectData.FirePropertyChanged (e.PropertyName);
dialog.OnResponse += (_, args) => {
- effect.OnConfigDialogResponse (args.ResponseId == (int) Gtk.ResponseType.Ok);
+ responseCompletion.SetResult (Gtk.ResponseType.Ok == (Gtk.ResponseType) args.ResponseId);
dialog.Destroy ();
};
dialog.Present ();
+
+ return responseCompletion.Task;
}
public event PropertyChangedEventHandler? EffectDataChanged;
diff --git a/tests/Pinta.Effects.Tests/Mocks/MockChromeManager.cs b/tests/Pinta.Effects.Tests/Mocks/MockChromeManager.cs
index bcc469c993..ff229b7947 100644
--- a/tests/Pinta.Effects.Tests/Mocks/MockChromeManager.cs
+++ b/tests/Pinta.Effects.Tests/Mocks/MockChromeManager.cs
@@ -1,5 +1,5 @@
using System;
-using Gtk;
+using System.Threading.Tasks;
using Mono.Addins.Localization;
using Pinta.Core;
@@ -7,10 +7,10 @@ namespace Pinta.Effects;
internal sealed class MockChromeManager : IChromeService
{
- public Window MainWindow => throw new NotImplementedException ();
+ public Gtk.Window MainWindow => throw new NotImplementedException ();
- public void LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer)
+ public Task LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer)
{
- throw new System.NotImplementedException ();
+ throw new NotImplementedException ();
}
}
diff --git a/tests/PintaBenchmarks/Mocks/MockChromeManager.cs b/tests/PintaBenchmarks/Mocks/MockChromeManager.cs
index 5f744cb144..66cd271ca8 100644
--- a/tests/PintaBenchmarks/Mocks/MockChromeManager.cs
+++ b/tests/PintaBenchmarks/Mocks/MockChromeManager.cs
@@ -1,4 +1,3 @@
-using Gtk;
using Mono.Addins.Localization;
using Pinta.Core;
@@ -6,9 +5,9 @@ namespace PintaBenchmarks;
internal sealed class MockChromeManager : IChromeService
{
- public Window MainWindow => throw new NotImplementedException ();
+ public Gtk.Window MainWindow => throw new NotImplementedException ();
- public void LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer)
+ public Task LaunchSimpleEffectDialog (BaseEffect effect, IAddinLocalizer localizer)
{
throw new NotImplementedException ();
}