示例#1
0
        public DashboardViewModel(CoreDispatcher dispatcher, Action onLogoutNavigation)
        {
            _onLogoutNavigation = onLogoutNavigation;
            if (DesignMode.DesignModeEnabled)
            {
                var incidentData = DataRepository.LoadIncidentData();
                foreach (var incident in incidentData)
                {
                    IncidentList.Add(incident);
                }

                SelectedIncident = IncidentList.First();
            }

            _isMainViewZoom      = true;
            _isEnrouteToIncident = false;
            _incidentIconManager = new IncidentManagerService();
            _incidentIconManager.IncidentAdded   += OnIncidentDataAdded;
            _incidentIconManager.IncidentRemoved += OnIncidentDataRemoved;
            _responderManager       = new ResponderManagerService();
            _incidentListViewModel  = new IncidentListViewModel();
            _responderListViewModel = new ResponderListViewModel(dispatcher);

            _responderManager.ResponderUpdated      += OnResponderUpdated;
            _incidentListViewModel.IncidentSelected += OnIncidentIconSelected;

            LogoutButtonClickCommand          = CommandWrapper(OnLogoutButtonClick);
            PowerBiClickCommand               = CommandWrapper(OnPowerBiButtonClick);
            IncidentToggleButtonClickCommand  = CommandWrapper(OnIncidentToggleButtonClick);
            ResponderToggleButtonClickCommand = CommandWrapper(OnResponderToggleButtonClick);
        }
        public MainViewModel(
            IResponderService responderService, IAuthenticationService authenticationService,
            IIncidentsService incidentsService, IHeatmapService heatmapService)
        {
            _responderService = responderService;
            _heatmapService   = heatmapService;

            IncidentToggleButtonChecked  = true;
            ResponderToggleButtonChecked = false;

            _incidentListViewModel   = new IncidentListViewModel(incidentsService);
            _responderListViewModel  = new ResponderListViewModel(_responderService);
            _incidentDetailViewModel = new IncidentDetailViewModel();

            MessagingCenter.Subscribe <IncidentModel>(this, MessengerKeys.NavigateToCurrentIncident, (incident) => ForceNavigation = true);
        }
 private void UpdateCurrentIncidentFromMessage(IncidentListViewModel list)
 {
     Incident = list.SelectedIncident;
 }