Beispiel #1
0
 public QuickCommand(QuickCommand quickCommand)
     : this(true)
 {
     alias         = quickCommand.alias + "_Copy";
     command       = quickCommand.command;
     path          = quickCommand.path;
     autoStart     = 0;
     workDirectory = quickCommand.workDirectory;
     customeIcon   = quickCommand.customeIcon;
 }
Beispiel #2
0
        public static QuickCommand Copy(QuickCommand quickCommand)
        {
            var cmd = new QuickCommand();

            cmd.alias         = quickCommand.alias;
            cmd.command       = quickCommand.command;
            cmd.path          = quickCommand.path;
            cmd.autoStart     = 0;
            cmd.uuid          = quickCommand.uuid;
            cmd.workDirectory = quickCommand.workDirectory;
            cmd.customeIcon   = quickCommand.customeIcon;
            return(cmd);
        }
        public EnvironmentVariableEditor(QuickCommand qc)
        {
            InitializeComponent();
            QuickCommandObject = qc;
            if (QuickCommandObject == null)
            {
                MessageBox.Show("Null QuickCommand object.", "Error");
                return;
            }
            if(QuickCommandObject.QuickCommandEnvConfigs != null)
            {
                foreach(var o in QuickCommandObject.QuickCommandEnvConfigs)
                {
                    quickCommands.Add(o);
                }
            }

            this.listView.ItemsSource = quickCommands;
        }
        private void startProcess(QuickCommand qc, bool asAdmin)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(qc.Path, qc.Command);
            if (asAdmin)
            {
                startInfo.Verb = "runas";
            }
            string workingDir = qc.WorkDirectory;
            if(workingDir.Length == 0)
            {
                try
                {
                    workingDir = FileUtil.getParentDir(qc.Path);
                }
                catch (UnauthorizedAccessException e)
                {
                    MessageBox.Show(e.Message);
                }
            }

            startInfo.WorkingDirectory = workingDir;
            if(qc.QuickCommandEnvConfigs != null)
            {
                foreach(var o in qc.QuickCommandEnvConfigs)
                {
                    startInfo.EnvironmentVariables[o.EnvKey] = o.EnvValue;
                }
                if (qc.QuickCommandEnvConfigs.Count > 0)
                {
                    startInfo.UseShellExecute = false;
                }
            }
            try
            {
                System.Diagnostics.Process.Start(startInfo);
                if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                {

                }
                else
                {
                    this.WindowState = System.Windows.WindowState.Minimized;
                }

            }
            catch(System.ComponentModel.Win32Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
 private void searchWithEverything(string key)
 {
     var results = searchEverything.search(key, 50);
     foreach(string r in results)
     {
         QuickCommand qc = new QuickCommand();
         qc.Path = r;
         qc.WorkDirectory = FileUtil.getParentDir(qc.Path);
         quickCommands.Add(qc);
     }
 }
 private void Qle_AddedNewQuickCommand(Model.QuickCommand command)
 {
     loadQuickCommandsFromDb("");
 }
 public QuickLancherEditor()
 {
     InitializeComponent();
     QCommand = new QuickCommand();
 }