public void Close(object args) { endSignal = false; updateThread.Abort(); updateThread = null; if (simulationThread != null) { simulationThread.Abort(); simulationThread = null; } service.Close(); service.Dispose(); service = null; }
public MainWindowViewModel(IDeviceValidator validator, INotificationService notification, IDataRepository repo) { this.validator = validator; this.notificationService = notification; this.repository = repo; StartCommand = new MyICommand(OnStart); StopCommand = new MyICommand(OnStop); Items = new BindingList <Device>(); SimulationStatus = "InActive"; try { LoadFromConfiguration(); service = new Common.WCF.WCFService("WCFService", new IPEndPoint(IPAddress.Loopback, servicePort), typeof(Service), typeof(IService)); service.Create(); service.Open(); } catch (Exception ex) { notificationService.ShowNotification("Server", $"Error: {ex.Message}, ST: {ex.StackTrace}", Notifications.Wpf.NotificationType.Error); } }