public void Close() { this.OnClosing(EventArgs.Empty); this.StopServices(); CremaService.Dispatcher.Invoke(() => { this.descriptorServiceHost.Close(); this.descriptorServiceHost = null; this.descriptorService = null; this.logService.Info(Resources.ServiceStop, nameof(DescriptorServiceHost)); }); if (this.cremaHost.IsOpened == true) { this.cremaHost.Opened -= CremaHost_Opened; this.cremaHost.Closing -= CremaHost_Closing; this.cremaHost.Close(this.token); this.cremaHost.SaveConfigs(); } this.token = Guid.Empty; this.OnClosed(EventArgs.Empty); }
public void Open() { this.OnOpening(EventArgs.Empty); this.cremaHost = this.GetService(typeof(ICremaHost)) as ICremaHost; this.logService = this.cremaHost.GetService(typeof(ILogService)) as ILogService; this.token = this.cremaHost.Open(); this.cremaHost.Opened += CremaHost_Opened; this.cremaHost.Closing += CremaHost_Closing; CremaService.Dispatcher.Invoke(() => { this.descriptorService = new DescriptorService(this, this.cremaHost); this.descriptorServiceHost = new DescriptorServiceHost(this.cremaHost, this.descriptorService, this.port); this.descriptorServiceHost.Open(); this.logService.Info(Resources.ServiceStart, nameof(DescriptorServiceHost)); }); this.StartServices(); this.OnOpened(EventArgs.Empty); }