Esempio n. 1
0
 public async void RemoveIncident(IncidentIcon incident)
 {
     await _mapControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         _mapItems.Items.Remove(incident);
     });
 }
Esempio n. 2
0
 public async void AddAvailableIncidents(IncidentIcon incident)
 {
     await incident.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         _availableIncidentList.Add(incident.Incident);
     });
 }
Esempio n. 3
0
        public async void NavigateToDetailsPane(object sender, IncidentSelectedEventArgs args)
        {
            // always show tickets
            SelectedIncident      = IncidentList.FirstOrDefault(x => x.Id == args.IncidentId);
            _selectedIncidentIcon = await _mapService.UpdateSelectedItem(SelectedIncident);

            ToggleDetailsPane(args.IncidentId, args.ShowDetails, true);
        }
Esempio n. 4
0
 public async void RemoveIncidentFromActiveList(IncidentIcon incident)
 {
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
         CoreDispatcherPriority.Normal,
         () =>
     {
         _incidentList.Remove(incident);
     });
 }
Esempio n. 5
0
 public async Task CreateIncidentIcon(IncidentModel incident)
 {
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
         CoreDispatcherPriority.Normal,
         () =>
     {
         var icon = new IncidentIcon(incident);
         _incidentList.Add(icon);
         IncidentAdded?.Invoke(this, new IncidentChangedEventArgs(icon));
     });
 }
        protected override void AddIncidentToMap(IncidentModel incident)
        {
            var incidentIcon = new IncidentIcon(incident);

            var markerOptions = incidentIcon.MarkerOptions;

            markerOptions.SetPosition(new LatLng(incident.Latitude, incident.Longitude));

            Marker marker = _nativeMap.AddMarker(markerOptions);

            _incidentPushpinMappings.Add(incident.Id, marker);
        }
Esempio n. 7
0
        public async Task <IncidentIcon> UpdateSelectedItem(IncidentModel incident)
        {
            IncidentIcon icon = null;
            await _mapControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                _selectedItems.Items.Clear();
                if (incident != null)
                {
                    icon = new IncidentIcon(incident, true);
                    _selectedItems.Items.Add(icon);
                    MapControl.SetLocation(icon, incident.GeoLocation);
                    MapControl.SetNormalizedAnchorPoint(icon, new Point(0.5, 1));
                }
            });

            return(icon);
        }
Esempio n. 8
0
        public async void RemoveSelectedIncident()
        {
            if (_selectedIncidentIcon != null)
            {
                _selectedIncidentIcon.IncidentIconNavigate -= OnEnrouteToIncident;
            }
            SelectedIncident      = null;
            _selectedIncidentIcon = null;
            await _mapService.UpdateSelectedItem(null);

            if (!_isEnrouteToIncident)
            {
                _mapService.ClearNavigation();
            }
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            SystemNavigationManager.GetForCurrentView().BackRequested -= OnIncidentListBackRequested;
        }
Esempio n. 9
0
        private async void OnIncidentIconSelected(object sender, IncidentSelectedEventArgs e)
        {
            if (_isMainViewZoom)
            {
                SelectedIncident = e.ShowDetails ? IncidentList.FirstOrDefault(x => x.Id == e.IncidentId) : null;
                if (SelectedIncident != null)
                {
                    _selectedIncidentIcon = await _mapService.UpdateSelectedItem(SelectedIncident);

                    _selectedIncidentIcon.IncidentIconNavigate += OnEnrouteToIncident;

                    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                    SystemNavigationManager.GetForCurrentView().BackRequested += OnIncidentListBackRequested;
                }

                ToggleDetailsPane(e.IncidentId, e.ShowDetails, true);
                if (!_isEnrouteToIncident)
                {
                    NavigateToIncident();
                }
            }
        }
Esempio n. 10
0
        private async Task OnIncidentResolved(IncidentIcon incidentIcon)
        {
            foreach (var responder in incidentIcon.Incident.Responders)
            {
                if (responder != null)
                {
                    var responderIcon = responder.ResponseUnit;
                    await responderIcon.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        responderIcon.UpdateStatus(ResponseStatus.Available);
                    });

                    responderIcon.Responder.Incident = null;
                    responderIcon.Responder.Request  = null;
                }
            }

            IncidentRemoved?.Invoke(this, new IncidentChangedEventArgs(incidentIcon));
            RemoveIncidentFromActiveList(incidentIcon);
            var incident = incidentIcon.Incident;

            incident.ResetModel();
            AddIncidentToPendingList(incident);
        }
Esempio n. 11
0
 public IncidentChangedEventArgs(IncidentIcon incident)
 {
     IncidentIcon = incident;
 }