static void HostedMain() { //Initialize sync context SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext()); var comm = new CommChannel(Console.OpenStandardInput(), Console.OpenStandardOutput()); Console.SetOut(new NullTextWriter()); Console.SetError(new NullTextWriter()); comm.Disposed += () => Process.GetCurrentProcess().Kill(); comm.SendMessage(new StateMessage("Staying awhile and listening...")); var service = new PerspexAppHost(comm); service.Start(); Application.Run(); }
public void Start(string targetExe, string initialXaml) { if (_proc != null) { _proc.Exited -= OnExited; try { _proc.Kill(); } catch { } HandleExited(); State = "Restarting..."; } var msg = new InitMessage(Path.GetFullPath(targetExe), initialXaml); var exe = typeof(ProcessHost).Assembly.GetModules()[0].FullyQualifiedName; _proc = new Process() { StartInfo = new ProcessStartInfo(exe, "--hosted") { UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }, EnableRaisingEvents = true }; _proc.Exited += OnExited; try { _proc.Start(); State = "Launching designer process..."; _comm = new CommChannel(_proc.StandardOutput.BaseStream, _proc.StandardInput.BaseStream); _comm.OnMessage += OnMessage; _comm.Start(); _comm.SendMessage(msg); } catch (Exception e) { State = e.ToString(); HandleExited(); } IsAlive = true; }
public void Start(string targetExe, string initialXaml) { if (_proc != null) { _proc.Exited -= OnExited; try { _proc.Kill(); } catch { } HandleExited(); State = "Restarting..."; } var msg = new InitMessage(Path.GetFullPath(targetExe), initialXaml); var exe = typeof (ProcessHost).Assembly.GetModules()[0].FullyQualifiedName; _proc = new Process() { StartInfo = new ProcessStartInfo(exe, "--hosted") { UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }, EnableRaisingEvents = true }; _proc.Exited += OnExited; try { _proc.Start(); State = "Launching designer process..."; _comm = new CommChannel(_proc.StandardOutput.BaseStream, _proc.StandardInput.BaseStream); _comm.OnMessage += OnMessage; _comm.Start(); _comm.SendMessage(msg); } catch (Exception e) { State = e.ToString(); HandleExited(); } IsAlive = true; }
public PerspexAppHost(CommChannel channel) { _comm = channel; _appModel = new HostedAppModel(this); }
public PerspexAppHost(CommChannel channel) { _comm = channel; }