diff options
author | nosami <jasonimison@gmail.com> | 2019-11-15 14:07:03 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2019-11-15 14:37:00 +0300 |
commit | b3c360a9c15e7b9c05143ee4ec9556a58e3f8f1c (patch) | |
tree | bfc15fb64fffe85029379bb96332ba4de84fad99 | |
parent | d616954abed49439a33f60dca035939409ecc16a (diff) |
Ensure that ScaffolderSelected handler is only registered once. Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1022897
-rw-r--r-- | main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderWizard.cs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderWizard.cs b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderWizard.cs index 7a6b3bc8c0..474b02087b 100644 --- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderWizard.cs +++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderWizard.cs @@ -59,19 +59,25 @@ namespace MonoDevelop.AspNetCore.Scaffolding var rightSideWidget = new FrameBox (rightSideImage); rightSideWidget.BackgroundColor = Styles.Wizard.PageBackgroundColor; this.RightSideWidget = new XwtControl (rightSideWidget); - this.Completed += (sender, e) => Task.Run (() => OnCompletedAsync ()); this.project = project; this.parentFolder = parentFolder; args.Project = project; args.ParentFolder = parentFolder; - selectionPage.ScaffolderSelected += (_, __) => Task.Run (async () => - await Runtime.RunInMainThread (async () => { - await Xwt.Toolkit.NativeEngine.Invoke (async () => { - await this.GoNext (args.CancellationToken); - }); - })); + this.Completed += (_, __) => Task.Run (() => OnCompletedAsync ()); + selectionPage.ScaffolderSelected -= ScaffolderSelected; + selectionPage.ScaffolderSelected += ScaffolderSelected; + } + void ScaffolderSelected (object sender, EventArgs e) + { + Task.Run (async () => + await Runtime.RunInMainThread (async () => { + LoggingService.LogInfo ($"{args.Scaffolder.Name} selected"); + await Xwt.Toolkit.NativeEngine.Invoke (async () => { + await this.GoNext (args.CancellationToken); + }); + })); } const string toolName = "dotnet-aspnet-codegenerator"; |