/// <summary> /// Opens command prompt. /// </summary> private bool OpenCommandPrompt() { var path = _shellHelperService.GetSelectedItemPath(); if (string.IsNullOrEmpty(path) || !Directory.Exists(path)) { return(false); } var commandToolsPath = _packageService.VSInstallDir; if (!string.IsNullOrEmpty(commandToolsPath)) { commandToolsPath = Path.Combine(commandToolsPath, @"Common7\Tools", "vsdevcmd.bat"); } if (string.IsNullOrEmpty(commandToolsPath) || !File.Exists(commandToolsPath)) { this.Log.LogMessage(this.KnownFeature, $"Command Prompt - failed to find command tools: {commandToolsPath}"); return(false); } var startInfo = new ProcessStartInfo("cmd.exe", "/K \"" + commandToolsPath + "\"") { WorkingDirectory = path }; if (_utilsService.ControlKeyDown()) { startInfo.Verb = "runas"; } if (Process.Start(startInfo) != null) { this.Log.LogMessage(this.KnownFeature, $"Command Prompt - failed to start: {startInfo.Arguments}"); } return(true); }
/// <summary> /// Executes Open Files command. /// </summary> /// <param name="obj">Optional Xaml defined parameter.</param> private void OnOpenFiles(object obj) { this.SelectionCode = !_utilsService.ControlKeyDown(); this.Selection = GetSelectedFiles(obj); this.CloseWindow = true; }