/// <summary> /// 主动呼叫 /// </summary> /// <param name="mmachineId"></param> public void ConnectRemote(string machineId) { var newcontrol = this.findRemoteController(machineId); if (newcontrol == null) { newcontrol = new RemoteController( ); this.OnPropertyChanged(nameof(this.controllers)); newcontrol.onCloseEvent += RemoteController_onCloseEvent; newcontrol.ConnectRemote(machineId); this.controllers.Add(newcontrol); this.OnPropertyChanged(nameof(controllers)); } this.currentController = newcontrol; }
private void removeController(RemoteController controller) { if (this.controllers.IndexOf(controller) < 0) { return; } this.controllers.Remove(controller); if (controller == this.currentController) { this.currentController = null; } if (controllers.Count < 1) { this.onClose?.Invoke(this, null); } if (controllers.Count > 0) { this.currentController = this.controllers[0]; } this.OnPropertyChanged(nameof(controllers)); }