/// <summary> /// Callback d'initialisation de la map /// </summary> public override void OnMapReady(GoogleMap googleMap) { if (googleMap != null) { MapWrapperLayout.Init(googleMap); // Initialisation de la map _mapControlManager = new MapControlManager(googleMap , this , null , null , CenterSeekiosSvgImageView , MapViewModelBase.Seekios.Idseekios.ToString()); App.Locator.Historic.MapControlManager = _mapControlManager; App.Locator.Historic.InitMap(); _mapControlManager.RegisterMethodes(); } base.OnMapReady(googleMap); }
public override void OnMapReady(GoogleMap googleMap) { if (googleMap != null) { MapWrapperLayout.Init(googleMap); if (App.Locator.ModeTracking.MapControlManager != null) { App.Locator.ModeTracking.MapControlManager.OnInitTrackingRouteComplete -= OnInitTrackingRouteComplete; } _mapControlManager = new MapControlManager(googleMap , this , CenterSeekiosSvgImageView , MapViewModelBase.Seekios.Idseekios.ToString()); // subscribe to tracking Route Drawing events _mapControlManager.OnInitTrackingRouteComplete += OnInitTrackingRouteComplete; if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeDontMove) { if (MapViewModelBase.Mode.StatusDefinition_idstatusDefinition == (int)StatutDefinitionEnum.SeekiosMoved) { MapControlManager.IsInAlert = true; } App.Locator.ModeDontMove.MapControlManager = _mapControlManager; App.Locator.ModeDontMove.InitMap(); App.Locator.ModeDontMove.InitModeDontMove(); if (App.Locator.Map.LsSeekiosOnTracking.Any(x => x.Seekios.Idseekios == App.Locator.DetailSeekios.SeekiosSelected.Idseekios)) { using (var handler = new Handler(Looper.MainLooper)) { handler.Post(() => { App.Locator.ModeDontMove.InitDontMoveTrackingRouteAsync(); }); } } } else if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeZone) { if (MapViewModelBase.Mode.StatusDefinition_idstatusDefinition == (int)StatutDefinitionEnum.SeekiosOutOfZone) { MapControlManager.IsInAlert = true; } App.Locator.ModeZone.MapControlManager = _mapControlManager; App.Locator.ModeZone.InitMap(); var isInAlert = MapViewModelBase.Mode != null && MapViewModelBase.Mode.StatusDefinition_idstatusDefinition != 1; _mapControlManager.CreateZone(App.Locator.ModeZone.DecodeTrame(MapViewModelBase.Mode.Trame), isInAlert); if (App.Locator.Map.LsSeekiosOnTracking.Any(x => x.Seekios.Idseekios == App.Locator.DetailSeekios.SeekiosSelected.Idseekios)) { using (var handler = new Handler(Looper.MainLooper)) { handler.Post(() => { App.Locator.ModeZone.InitZoneTrackingRouteAsync(); }); } } CenterOnZoneButton.Visibility = ViewStates.Visible; } else if (MapViewModelBase.Mode != null && MapViewModelBase.Mode.ModeDefinition_idmodeDefinition == (int)ModeDefinitionEnum.ModeTracking) { MapControlManager.IsInAlert = false; App.Locator.ModeTracking.MapControlManager = _mapControlManager; App.Locator.ModeTracking.InitMap(); LoadingLayout.Visibility = ViewStates.Visible; using (var handler = new Handler(Looper.MainLooper)) { handler.Post(() => { App.Locator.ModeTracking.InitTrackingRoute(); }); } } else { MapControlManager.IsInAlert = false; App.Locator.Map.MapControlManager = _mapControlManager; App.Locator.Map.InitMap(); } _mapControlManager.RegisterMethodes(); } base.OnMapReady(googleMap); //the call to the function is made before the map is initialized => _mapControlManager = null //we need to Hide & Show the markerInfo once we have initialized the control manager in order to reflect the right //internet connection state if (!App.DeviceIsConnectedToInternet) { UpdateUIOnConnectionStateChanged(false); } }