public BatchProcessorViewModel() { State = new BatchProcessorState(); Start = new ButtonCommand(() => { State.ConsoleText = "Starting Local BatchProcessorServer..." + System.Environment.NewLine; RunProcess("", false); }); Stop = new ButtonCommand(() => { StopProcess(); }); Install = new ButtonCommand(() => { State.ConsoleText = "Installing BatchProcessorServer Service..." + System.Environment.NewLine; RunProcess("install", true); }); Uninstall = new ButtonCommand(() => { State.ConsoleText = "Uninstalling BatchProcessorServer Service..." + System.Environment.NewLine; RunProcess("uninstall", true); }); StartService = new ButtonCommand(() => { State.ConsoleText = "Start BatchProcessorServer Service..." + System.Environment.NewLine; RunProcess("start", true); }); StopService = new ButtonCommand(() => { State.ConsoleText = "Stop BatchProcessorServer Service..." + System.Environment.NewLine; RunProcess("stop", true); }); CheckStatus = new ButtonCommand(() => { State.ConsoleText += System.Environment.NewLine + $"Launching http://localhost:{State.Port}..." + System.Environment.NewLine; Process.Start($"http://localhost:{State.Port}"); }); Save = new ButtonCommand(() => { State.ConsoleText += "Saving Config, Restarting BatchProcessorServer Service..." + System.Environment.NewLine; State.Save(); RunProcess("stop", true); RunProcess("start", true); }); Load = new ButtonCommand(() => { State.Load(); }); Application.Current.MainWindow.Closing += MainWindow_Closing; }
public BatchProcessorViewModel() { State = new BatchProcessorState(); Start = new ButtonCommand(() => { State.ConsoleText = "Starting Local BatchProcessor..." + System.Environment.NewLine; RunProcess("", false); }); Stop = new ButtonCommand(() => { StopProcess(); }); Install = new ButtonCommand(() => { State.ConsoleText = "Installing BatchProcessor Service..." + System.Environment.NewLine; RunProcess("install", true); MessageBoxResult result = MessageBox.Show( "If you need to use Network Files, please make sure to:" + System.Environment.NewLine + System.Environment.NewLine + "Options 1) Edit the installed service. Go to: Services -> Batch Processor -> Properties -> Log On and set an account with appropriate credentials." + System.Environment.NewLine + System.Environment.NewLine + "Options 2) Add credentials for the NetworkService user via Administrator Command Line.", "Network Credential Info", MessageBoxButton.OK, MessageBoxImage.Information); }); Uninstall = new ButtonCommand(() => { State.ConsoleText = "Uninstalling BatchProcessor Service..." + System.Environment.NewLine; RunProcess("uninstall", true); }); StartService = new ButtonCommand(() => { State.ConsoleText = "Start BatchProcessor Service..." + System.Environment.NewLine; RunProcess("start", true); }); StopService = new ButtonCommand(() => { State.ConsoleText = "Stop BatchProcessor Service..." + System.Environment.NewLine; RunProcess("stop", true); }); CheckStatus = new ButtonCommand(() => { State.ConsoleText += System.Environment.NewLine + $"Launching http://{State.ServerAddress}:{State.ServerPort}..." + System.Environment.NewLine; Process.Start($"http://{State.ServerAddress}:{State.ServerPort}"); }); Save = new ButtonCommand(() => { State.ConsoleText = "Saving Config, Restarting BatchProcessor Service..." + System.Environment.NewLine; State.Save(); RunProcess("stop", true); RunProcess("start", true); }); Load = new ButtonCommand(() => { State.Load(); }); Application.Current.MainWindow.Closing += MainWindow_Closing; }