void OnSelectOrganisation(SelectOrganisationEventArg selectOrganisationEventArg) { var cameraSelectionViewModel = new OrganisationSelectionViewModel(selectOrganisationEventArg.Organisation); selectOrganisationEventArg.Cancel = !ServiceFactory.DialogService.ShowModalWindow(cameraSelectionViewModel); selectOrganisationEventArg.Organisation = selectOrganisationEventArg.Cancel || cameraSelectionViewModel.SelectedOrganisation == null ? null : cameraSelectionViewModel.SelectedOrganisation.Organisation; }
public static bool SelectObject(ObjectType objectType, ExplicitValueViewModel currentExplicitValue) { if (objectType == ObjectType.Device) { var selectGKDeviceEventArg = new SelectGKDeviceEventArg { Device = currentExplicitValue.Device }; ServiceFactory.Events.GetEvent<SelectGKDeviceEvent>().Publish(selectGKDeviceEventArg); if (!selectGKDeviceEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKDeviceEventArg.Device; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.Zone) { var selectGKZoneEventArg = new SelectGKZoneEventArg { Zone = currentExplicitValue.Zone }; ServiceFactory.Events.GetEvent<SelectGKZoneEvent>().Publish(selectGKZoneEventArg); if (!selectGKZoneEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKZoneEventArg.Zone; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.GuardZone) { var selectGKGuardZoneEventArg = new SelectGKGuardZoneEventArg { GuardZone = currentExplicitValue.GuardZone }; ServiceFactory.Events.GetEvent<SelectGKGuardZoneEvent>().Publish(selectGKGuardZoneEventArg); if (!selectGKGuardZoneEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKGuardZoneEventArg.GuardZone; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.GKDoor) { var selectGKDoorEventArg = new SelectGKDoorEventArg { Door = currentExplicitValue.GKDoor }; ServiceFactory.Events.GetEvent<SelectGKDoorEvent>().Publish(selectGKDoorEventArg); if (!selectGKDoorEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKDoorEventArg.Door; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.Direction) { var selectGKDirectionEventArg = new SelectGKDirectionEventArg { Direction = currentExplicitValue.Direction }; ServiceFactory.Events.GetEvent<SelectGKDirectionEvent>().Publish(selectGKDirectionEventArg); if (!selectGKDirectionEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKDirectionEventArg.Direction; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.PumpStation) { var selectGKPumpStationEventArg = new SelectGKPumpStationEventArg { PumpStation = currentExplicitValue.PumpStation }; ServiceFactory.Events.GetEvent<SelectGKPumpStationEvent>().Publish(selectGKPumpStationEventArg); if (!selectGKPumpStationEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKPumpStationEventArg.PumpStation; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.MPT) { var selectGKMPTEventArg = new SelectGKMPTEventArg { MPT = currentExplicitValue.MPT }; ServiceFactory.Events.GetEvent<SelectGKMPTEvent>().Publish(selectGKMPTEventArg); if (!selectGKMPTEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKMPTEventArg.MPT == null; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.VideoDevice) { var selectCameraEventArg = new SelectCameraEventArg { Camera = currentExplicitValue.Camera }; ServiceFactory.Events.GetEvent<SelectCameraEvent>().Publish(selectCameraEventArg); if (!selectCameraEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectCameraEventArg.Camera; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.Delay) { var selectGKDelayEventArg = new SelectGKDelayEventArg { Delay = currentExplicitValue.Delay }; ServiceFactory.Events.GetEvent<SelectGKDelayEvent>().Publish(selectGKDelayEventArg); if (!selectGKDelayEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKDelayEventArg.Delay; currentExplicitValue.Initialize(); } return true; } if (objectType == ObjectType.Organisation) { var selectGKOrganisationEventArg = new SelectOrganisationEventArg { Organisation = currentExplicitValue.Organisation }; ServiceFactory.Events.GetEvent<SelectOrganisationEvent>().Publish(selectGKOrganisationEventArg); if (!selectGKOrganisationEventArg.Cancel) { currentExplicitValue.ExplicitValue.Value = selectGKOrganisationEventArg.Organisation; currentExplicitValue.Initialize(); } return true; } return false; }