Пример #1
0
        protected override void Run()
        {
            var dlg = new NewStashDialog();

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok)
                {
                    string comment       = dlg.Comment;
                    var    monitor       = new MessageDialogProgressMonitor(true, false, false, true);
                    var    statusTracker = IdeApp.Workspace.GetFileStatusTracker();
                    ThreadPool.QueueUserWorkItem(delegate {
                        try {
                            Stash stash;
                            if (Repository.TryCreateStash(monitor, comment, out stash))
                            {
                                string msg;
                                if (stash != null)
                                {
                                    msg = GettextCatalog.GetString("Changes successfully stashed");
                                }
                                else
                                {
                                    msg = GettextCatalog.GetString("No changes were available to stash");
                                }

                                DispatchService.GuiDispatch(delegate {
                                    IdeApp.Workbench.StatusBar.ShowMessage(msg);
                                });
                            }
                        } catch (Exception ex) {
                            MessageService.ShowError(GettextCatalog.GetString("Stash operation failed"), ex);
                        }
                        finally {
                            monitor.Dispose();
                            statusTracker.Dispose();
                        }
                    });
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
Пример #2
0
		protected override void Run ()
		{
			var dlg = new NewStashDialog ();
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
					string comment = dlg.Comment;
					var monitor = new MessageDialogProgressMonitor (true, false, false, true);
					var statusTracker = IdeApp.Workspace.GetFileStatusTracker ();
					ThreadPool.QueueUserWorkItem (delegate {
						try {
							Stash stash;
							if (Repository.TryCreateStash (monitor, comment, out stash)) {
								string msg;
								if (stash != null) {
									msg = GettextCatalog.GetString ("Changes successfully stashed");
								} else {
									msg = GettextCatalog.GetString ("No changes were available to stash");
								}

								DispatchService.GuiDispatch (delegate {
									IdeApp.Workbench.StatusBar.ShowMessage (msg);
								});
							}

						} catch (Exception ex) {
							MessageService.ShowError (GettextCatalog.GetString ("Stash operation failed"), ex);
						}
						finally {
							monitor.Dispose ();
							statusTracker.Dispose ();
						}
					});
				}
			} finally {
				dlg.Destroy ();
				dlg.Dispose ();
			}
		}