diff options
author | Mykyta Bondarenko <32954580+mykyta-bondarenko@users.noreply.github.com> | 2019-12-09 15:48:28 +0300 |
---|---|---|
committer | Mykyta Bondarenko <32954580+mykyta-bondarenko@users.noreply.github.com> | 2019-12-30 12:43:38 +0300 |
commit | 7f33c08e5ae480f0562fc070b45b816710579505 (patch) | |
tree | 270df98c229e78c088ce78b35db208cf7b8425a0 /main/src | |
parent | f3918a333cc866639229813b1112deb47e984c72 (diff) |
[947006][NewProjectController] added announcement of project creation status
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/947006
- added `OnProjectCreating` method to announce an information about the process has begun
- added `OnProjectCreated` method to announce an information about the process has completed
- added `OnProjectCreationFailed` method to announce an information about the process has failed
Diffstat (limited to 'main/src')
-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 33c9d388a1..b4fa2f72b7 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;
|