Esempio n. 1
0
        private void InvokeStart(StartOptions start)
        {
            var password = new SecureString();

            if (start.Password != null)
            {
                foreach (char c in start.Password)
                {
                    password.AppendChar(c);
                }
            }
            Process.Start(start.FileName, start.Arguments, start.UserName, password, start.Domain);
            HelpView.Message(ErrorInfo.Info($"Started {start.FileName}.")).Render();
        }
Esempio n. 2
0
        private void InvokeStart(StartOptions start)
        {
            var password = new SecureString();

            if (start.Password != null)
            {
                foreach (char c in start.Password)
                {
                    password.AppendChar(c);
                }
            }

            var process = Process.Start(start.FileName, start.Arguments, start.UserName, password, start.Domain);

            HelpView.Message(ErrorInfo.Info($"Started {start.FileName}.")).Render();

            if (process == null)
            {
                return;
            }
            switch (start.Operation)
            {
            case StartOperation.WaitForExit:
                process.WaitForExit();
                break;

            case StartOperation.WaitForIdle:
                process.WaitForInputIdle();
                break;

            case StartOperation.Kill:
                process.Kill();
                break;

            case StartOperation.DisplayFullName:
                HelpView.Message(ErrorInfo.Info(process.MainModule.FileName)).Render();
                break;
            }
        }