Ejemplo n.º 1
0
 protected override void OnProgressChanged()
 {
     if (showTaskTitles)
     {
         statusBar.ShowMessage(icon, CurrentTask);
     }
     if (!UnknownWork)
     {
         statusBar.SetProgressFraction(GlobalWork);
     }
     RunPendingEvents();
 }
        void UpdateReferences(IList <WebReferenceItem> items)
        {
            try {
                UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext();
                UpdateReferenceContext.BeginProgress(GettextCatalog.GetPluralString("Updating web reference", "Updating web references", items.Count));

                DispatchService.ThreadDispatch(() => {
                    for (int i = 0; i < items.Count; i++)
                    {
                        DispatchService.GuiDispatch(() => UpdateReferenceContext.SetProgressFraction(Math.Max(0.1, (double)i / items.Count)));
                        items [i].Update();
                    }

                    DispatchService.GuiDispatch(() => {
                        // Make sure that we save all relevant projects, there should only be 1 though
                        foreach (var project in items.Select(i => i.Project).Distinct())
                        {
                            IdeApp.ProjectOperations.Save(project);
                        }

                        IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
                        DisposeUpdateContext();
                    });
                });
            } catch {
                DisposeUpdateContext();
                throw;
            }
        }
 protected override void OnProgressChanged()
 {
     if (showTaskTitles)
     {
         statusBar.ShowMessage(icon, CurrentTaskName);
     }
     if (!ProgressIsUnknown)
     {
         statusBar.SetProgressFraction(Progress);
         DesktopService.SetGlobalProgress(Progress);
     }
     else
     {
         DesktopService.ShowGlobalProgressIndeterminate();
     }
 }
 protected override void OnProgressChanged()
 {
     if (showTaskTitles)
     {
         statusBar.ShowMessage(icon, CurrentTask);
     }
     if (!UnknownWork)
     {
         statusBar.SetProgressFraction(GlobalWork);
         DesktopService.SetGlobalProgress(GlobalWork);
     }
     else
     {
         DesktopService.ShowGlobalProgressIndeterminate();
     }
     RunPendingEvents();
 }
Ejemplo n.º 5
0
        void UpdateReferences(IList <WebReferenceItem> items)
        {
            try {
                UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext();
                UpdateReferenceContext.BeginProgress(GettextCatalog.GetPluralString("Updating web reference", "Updating web references", items.Count));

                Task.Run(() => {
                    for (int i = 0; i < items.Count; i++)
                    {
                        Runtime.RunInMainThread(() => UpdateReferenceContext.SetProgressFraction(Math.Max(0.1, (double)i / items.Count)));
                        try {
                            items [i].Update();
                        } catch (Exception ex) {
                            Runtime.RunInMainThread(() => {
                                MessageService.ShowError(GettextCatalog.GetString("Failed to update Web Reference '{0}'", items [i].Name), ex);
                                DisposeUpdateContext();
                            }).Wait();
                            return;
                        }
                    }

                    Runtime.RunInMainThread(() => {
                        // Make sure that we save all relevant projects, there should only be 1 though
                        foreach (var project in items.Select(i => i.Project).Distinct())
                        {
                            IdeApp.ProjectOperations.SaveAsync(project);
                        }

                        IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
                        DisposeUpdateContext();
                    });
                });
            } catch {
                DisposeUpdateContext();
                throw;
            }
        }
		void UpdateReferences (IList<WebReferenceItem> items)
		{
			try {
				UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext ();
				UpdateReferenceContext.BeginProgress (GettextCatalog.GetPluralString ("Updating web reference", "Updating web references", items.Count));
				
				DispatchService.ThreadDispatch (() => {
					for (int i = 0; i < items.Count; i ++) {
						DispatchService.GuiDispatch (() => UpdateReferenceContext.SetProgressFraction (Math.Max (0.1, (double)i / items.Count)));
						items [i].Update();
					}
					
					DispatchService.GuiDispatch (() => {
						// Make sure that we save all relevant projects, there should only be 1 though
						foreach (var project in items.Select (i =>i.Project).Distinct ())
							IdeApp.ProjectOperations.Save (project);
						
						IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString ("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
						DisposeUpdateContext ();
					});
				});
			} catch {
				DisposeUpdateContext ();
				throw;
			}
		}
		void UpdateReferences (IList<WebReferenceItem> items)
		{
			try {
				UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext ();
				UpdateReferenceContext.BeginProgress (GettextCatalog.GetPluralString ("Updating web reference", "Updating web references", items.Count));
				
				Task.Run (() => {
					for (int i = 0; i < items.Count; i ++) {
						Runtime.RunInMainThread (() => UpdateReferenceContext.SetProgressFraction (Math.Max (0.1, (double)i / items.Count)));
						try {
							items [i].Update();
						} catch (Exception ex) {
							Runtime.RunInMainThread (() => {
								MessageService.ShowError (GettextCatalog.GetString ("Failed to update Web Reference '{0}'", items [i].Name), ex);
								DisposeUpdateContext ();
							}).Wait ();
							return;
						}
					}
					
					Runtime.RunInMainThread (() => {
						// Make sure that we save all relevant projects, there should only be 1 though
						foreach (var project in items.Select (i =>i.Project).Distinct ())
							IdeApp.ProjectOperations.SaveAsync (project);
						
						IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString ("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
						DisposeUpdateContext ();
					});
				});
			} catch {
				DisposeUpdateContext ();
				throw;
			}
		}