protected override void Dispose(bool isDisposing) { if (isDisposing) { if (_serviceHost != null) { _serviceHost.Dispose(); _serviceHost = null; } } base.Dispose(isDisposing); }
private void StartServiceHost(CommandLine commandLine) { Console.WriteLine("-> service will listen for connection on " + commandLine.Binding); Console.WriteLine("-> service will identify controls using " + commandLine.AutomationIdentification); _serviceHost = new ServiceHostController { AutomationIdentification = commandLine.AutomationIdentification }; _serviceHost.Trace += (sender, args) => Console.WriteLine("-> " + args.Message); _serviceHost.Start(new Uri(commandLine.Binding)); Console.WriteLine("-> service started"); Console.WriteLine(); }
public void Stop() { if (_hostController != null) { _hostController.Stop(); _hostController = null; } if (DeviceController != null) { DeviceController.ReleaseDeviceConnection(); ShutDown(); DeviceController = null; } }
protected void StartPhoneAutomationController(AutomationIdentification automationIdentification, Uri bindingAddress) { try { var hostController = new ServiceHostController() { AutomationIdentification = automationIdentification, }; hostController.Trace += (sender, args) => InvokeTrace(args); hostController.Start(bindingAddress); _hostController = hostController; } catch (Exception exception) { throw new AutomationException("Failed to start ApplicationAutomationController", exception); } }