public static void ReinstallWithProgress(SnapInDescriptor descriptor) { try { using (ProgressWindowThread thread = new ProgressWindowThread()) { thread.ShowAsynchronously(); ProgressViewer.SetTitle(thread.Window, "SnapIn Hosting Engine Progress..."); ProgressViewer.SetHeading(thread.Window, "Installing " + descriptor.MetaData.Title); ProgressViewer.SetDescription(thread.Window, "This operation may take several seconds."); System.Threading.Thread.Sleep(1000); SnapInHostingEngine.Install(descriptor, false, thread.Window); System.Threading.Thread.Sleep(1000); } } catch(System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } }
public static bool StopWithProgress(SnapInDescriptor descriptor) { bool result = false; try { using (ProgressWindowThread thread = new ProgressWindowThread()) { thread.ShowAsynchronously(); ProgressViewer.SetTitle(thread.Window, "SnapIn Hosting Engine Progress..."); ProgressViewer.SetHeading(thread.Window, "Stopping " + descriptor.MetaData.Title); ProgressViewer.SetDescription(thread.Window, "This operation may take several seconds."); System.Threading.Thread.Sleep(1000); result = SnapInHostingEngine.Stop(descriptor, true, thread.Window); System.Threading.Thread.Sleep(1000); } } catch(System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } return result; }