diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs | 21 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs | 34 |
2 files changed, 32 insertions, 23 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs index 8b4d8c9f6f..03306ff44a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs @@ -78,23 +78,7 @@ namespace MonoDevelop.Ide.Projects actionHandler.PerformShowMenu += PerformShowMenu;
} - void ProjectCreationFailed (object obj, EventArgs args) => ShowProjectCreationAccessibityNotification (true);
- void ProjectCreated(object obj, EventArgs args) => ShowProjectCreationAccessibityNotification (false);
async void NextButtonClicked (object sender, EventArgs e) => await MoveToNextPage ();
-
- void ShowProjectCreationAccessibityNotification (bool hasError)
- {
- var projectTemplate = controller.SelectedTemplate;
-
- string messageText; -
- if (hasError) - messageText = GettextCatalog.GetString ("{0} failed to create", projectTemplate.Name); - else - messageText = GettextCatalog.GetString ("{0} successfully created", projectTemplate.Name);
-
- this.Accessible.MakeAccessibilityAnnouncement (messageText); - }
public void ShowDialog ()
{
@@ -114,8 +98,6 @@ namespace MonoDevelop.Ide.Projects public void RegisterController (INewProjectDialogController controller)
{
this.controller = controller;
- controller.ProjectCreationFailed += ProjectCreationFailed;
- controller.ProjectCreated += ProjectCreated;
languageCellRenderer.SelectedLanguage = controller.SelectedLanguage;
topBannerLabel.Text = controller.BannerText;
LoadTemplates ();
@@ -299,9 +281,6 @@ namespace MonoDevelop.Ide.Projects if (!controller.IsLastPage)
projectConfigurationWidget.Destroy ();
- controller.ProjectCreationFailed -= ProjectCreationFailed;
- controller.ProjectCreated -= ProjectCreated;
-
base.OnDestroyed ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs index 455929c782..41705740a0 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs @@ -613,6 +613,8 @@ namespace MonoDevelop.Ide.Projects public async Task Create ()
{
+ Runtime.AssertMainThread (); + OnProjectCreating (); projectCreated = new TaskCompletionSource<bool> ();
if (wizardProvider.HasWizard)
@@ -620,7 +622,7 @@ namespace MonoDevelop.Ide.Projects if (!await CreateProject ()) { projectCreated.SetResult (false);
- ProjectCreationFailed?.Invoke (this, EventArgs.Empty);
+ OnProjectCreationFailed (); return;
}
@@ -714,13 +716,41 @@ namespace MonoDevelop.Ide.Projects UpdateDefaultSettings (); projectCreated.SetResult (true); - await Runtime.RunInMainThread (() => ProjectCreated?.Invoke (this, EventArgs.Empty)); + OnProjectCreated (); } catch (Exception ex) { projectCreated.SetException (ex); throw; }
} + void OnProjectCreating () + { + if (IdeServices.DesktopService.AccessibilityInUse) { + var announcement = GettextCatalog.GetString ("Creating project {0}", SelectedTemplate.Name); + IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement); + } + } + + void OnProjectCreationFailed () + { + ProjectCreationFailed?.Invoke (this, EventArgs.Empty); + + if (IdeServices.DesktopService.AccessibilityInUse) { + var announcement = GettextCatalog.GetString ("{0} failed to create", SelectedTemplate.Name); + IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement); + } + } + + void OnProjectCreated () + { + ProjectCreated?.Invoke (this, EventArgs.Empty); + + if (IdeServices.DesktopService.AccessibilityInUse) { + var announcement = GettextCatalog.GetString ("{0} successfully created", SelectedTemplate.Name); + IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement); + } + } + public Task<bool> ProjectCreation => projectCreated?.Task; TaskCompletionSource<bool> projectCreated;
|