コード例 #1
0
        public static IExecutionHandler GetExecutionModeForCommand(object data)
        {
            CommandItem item = (CommandItem)data;

            if (item.Mode == null)
            {
                using (var dlg = new CustomExecutionModeManagerDialog(item.Context))
                    MessageService.ShowCustomDialog(dlg);
                return(null);
            }

            if (item.Mode.ExecutionHandler is ParameterizedExecutionHandler)
            {
                ParameterizedExecutionHandler        cmode = (ParameterizedExecutionHandler)item.Mode.ExecutionHandler;
                ParameterizedExecutionHandlerWrapper pw    = new ParameterizedExecutionHandlerWrapper();
                pw.Handler    = cmode;
                pw.Context    = item.Context;
                pw.ParentMode = item.Mode;
                return(pw);
            }

            // If control key is pressed, show the parameters dialog
            Gdk.ModifierType mtype;
            if (Gtk.Global.GetCurrentEventState(out mtype) && (mtype & Gdk.ModifierType.ControlMask) != 0)
            {
                RunWithPromptHandler cmode = new RunWithPromptHandler();
                cmode.Context = item.Context;
                cmode.Mode    = item.Mode;
                return(cmode);
            }

            return(item.Mode.ExecutionHandler);
        }
コード例 #2
0
        public static IExecutionHandler GetExecutionModeForCommand(object data)
        {
            CommandItem item = (CommandItem) data;
            if (item.Mode == null) {
                var dlg = new CustomExecutionModeManagerDialog (item.Context);
                MessageService.ShowCustomDialog (dlg);
                return null;
            }

            if (item.Mode.ExecutionHandler is ParameterizedExecutionHandler) {
                ParameterizedExecutionHandler cmode = (ParameterizedExecutionHandler) item.Mode.ExecutionHandler;
                ParameterizedExecutionHandlerWrapper pw = new ParameterizedExecutionHandlerWrapper ();
                pw.Handler = cmode;
                pw.Context = item.Context;
                pw.ParentMode = item.Mode;
                return pw;
            }

            // If control key is pressed, show the parameters dialog
            Gdk.ModifierType mtype;
            if (Gtk.Global.GetCurrentEventState (out mtype) && (mtype & Gdk.ModifierType.ControlMask) != 0) {
                RunWithPromptHandler cmode = new RunWithPromptHandler ();
                cmode.Context = item.Context;
                cmode.Mode = item.Mode;
                return cmode;
            }

            return item.Mode.ExecutionHandler;
        }