add initial ShellRun support for JsonRPC

This commit is contained in:
Spencer Hedrick 2021-10-09 02:36:38 -07:00
parent 3baaa2d406
commit d41dd780ce
2 changed files with 16 additions and 0 deletions

View file

@ -29,6 +29,12 @@ namespace Flow.Launcher.Plugin
/// </summary>
void RestartApp();
/// <summary>
/// Run a shell command or external program
/// </summary>
/// <param name="cmd">The command or program to run</param>
void ShellRun(string cmd);
/// <summary>
/// Save everything, all of Flow Launcher and plugins' data and settings
/// </summary>

View file

@ -103,6 +103,16 @@ namespace Flow.Launcher
});
}
public void ShellRun(string cmd)
{
System.Diagnostics.Process process = new();
var startInfo = process.StartInfo;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = $"/C {cmd}";
startInfo.CreateNoWindow = true;
process.Start();
}
public void StartLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Visible;
public void StopLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Collapsed;