protected virtual void OnButtonAddClicked(object sender, System.EventArgs e)
        {
            var dlg = new CustomExecutionModeDialog();

            try {
                dlg.Initialize(ctx, null, null);
                if (MessageService.RunCustomDialog(dlg, this) == (int)Gtk.ResponseType.Ok)
                {
                    ExecutionModeCommandService.SaveCustomCommand(ctx.Project, dlg.GetConfigurationData());
                    Fill();
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
        protected virtual void OnButtonEditClicked(object sender, System.EventArgs e)
        {
            CustomExecutionMode mode = GetSelectedMode();
            var dlg = new CustomExecutionModeDialog();

            try {
                dlg.Initialize(ctx, null, mode);
                if (MessageService.RunCustomDialog(dlg, this) == (int)Gtk.ResponseType.Ok)
                {
                    CustomExecutionMode newMode = dlg.GetConfigurationData();
                    ExecutionModeCommandService.SaveCustomCommand(ctx.Project, newMode);
                    if (newMode.Scope != mode.Scope)
                    {
                        ExecutionModeCommandService.RemoveCustomCommand(ctx.Project, mode);
                    }
                    Fill();
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
 internal static CustomExecutionMode ShowParamtersDialog(CommandExecutionContext ctx, IExecutionMode mode, CustomExecutionMode currentMode)
 {
     return(Runtime.RunInMainThread(delegate {
         CustomExecutionMode cmode = null;
         CustomExecutionModeDialog dlg = new CustomExecutionModeDialog();
         try {
             dlg.Initialize(ctx, mode, currentMode);
             if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok)
             {
                 cmode = dlg.GetConfigurationData();
                 cmode.Project = ctx.Project;
                 if (dlg.Save)
                 {
                     SaveCustomCommand(ctx.Project, cmode);
                 }
             }
             return cmode;
         } finally {
             dlg.Destroy();
             dlg.Dispose();
         }
     }).Result);
 }
		internal static CustomExecutionMode ShowParamtersDialog (CommandExecutionContext ctx, IExecutionMode mode, CustomExecutionMode currentMode)
		{
			return Runtime.RunInMainThread (delegate {
				CustomExecutionMode cmode = null;
				CustomExecutionModeDialog dlg = new CustomExecutionModeDialog ();
				try {
					dlg.Initialize (ctx, mode, currentMode);
					if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
						cmode = dlg.GetConfigurationData ();
						cmode.Project = ctx.Project;
						if (dlg.Save)
							SaveCustomCommand (ctx.Project, cmode);
					}
					return cmode;
				} finally {
					dlg.Destroy ();
					dlg.Dispose ();
				}
			}).Result;
		}
		protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
		{
			var dlg = new CustomExecutionModeDialog ();
			try {
				dlg.Initialize (ctx, null, null);
				if (MessageService.RunCustomDialog (dlg, this) == (int) Gtk.ResponseType.Ok) {
					ExecutionModeCommandService.SaveCustomCommand (ctx.Project, dlg.GetConfigurationData ());
					Fill ();
				}
			} finally {
				dlg.Destroy ();
				dlg.Dispose ();
			}
		}
		protected virtual void OnButtonEditClicked (object sender, System.EventArgs e)
		{
			CustomExecutionMode mode = GetSelectedMode ();
			var dlg = new CustomExecutionModeDialog ();
			try {
				dlg.Initialize (ctx, null, mode);
				if (MessageService.RunCustomDialog (dlg, this) == (int) Gtk.ResponseType.Ok) {
					CustomExecutionMode newMode = dlg.GetConfigurationData ();
					ExecutionModeCommandService.SaveCustomCommand (ctx.Project, newMode);
					if (newMode.Scope != mode.Scope)
						ExecutionModeCommandService.RemoveCustomCommand (ctx.Project, mode);
					Fill ();
				}
			} finally {
				dlg.Destroy ();
				dlg.Dispose ();
			}
		}