private async void OnAddDeviceExecute(object obj) { IDeviceCreator deviceCreator = (obj as IDeviceDefinitionViewModel)?.Model as IDeviceCreator; if (deviceCreator == null) { return; } if (deviceCreator.AvailableConnection == null) { return; } _comConnectionManager.SetComPortConfigurationByName((deviceCreator.AvailableConnection as IModbusRtuConnection).ComPortConfiguration, (deviceCreator.AvailableConnection as IModbusRtuConnection).PortName); var device = deviceCreator.Create(); device.DeviceSignature = device.Name; await _devicesContainerService.ConnectDeviceAsync(device, deviceCreator.AvailableConnection); if (!_devicesContainerService.ConnectableItems.Contains(device)) { _devicesContainerService.AddConnectableItem(device); } //DeviceDefinitionViewModels.Remove(obj as IDeviceDefinitionViewModel); IsDevicesNotFound = false; (obj as IDeviceDefinitionViewModel).IsAddedToProject = true; await Task.Delay(300); _flyoutService.CloseFlyout(); }
public void ExecuteAddGame() { _gamesService.Games.Add(NewGame); _flyoutService.CloseFlyout("AddGame"); NewGame = null; }