public void SetVM(MapVM map) { this.map = map; this.map.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName.Equals("Zoom")) { try { Dispatcher.Invoke(() => { myMap.ZoomLevel = map.Zoom; double x = Double.Parse(map.Location.Split(',')[0]); double y = Double.Parse(map.Location.Split(',')[1]); myMap.Center = new Location(x, y); }); } catch (Exception ex) { } } else if (e.PropertyName.Equals("Location")) { try { Dispatcher.Invoke(() => { double x = Double.Parse(map.Location.Split(',')[0]); double y = Double.Parse(map.Location.Split(',')[1]); myMap.Center = new Location(x, y); }); } catch (Exception ex) { } } }; DataContext = map; }
public NavigationVM(ViewModelBase favVM_) { FromToggle = true; Pins = new ObservableCollection <Pushpin>(); FavVM = favVM_ as FavouritesVM; ToAddressessSearch = new MixedSearch(); ToAddressessSearch.OnSelectedAction += ToAddressessSearch_OnSelectedAction; FromAddressessSearch = new MixedSearch(); FromAddressessSearch.OnSelectedAction += FromAddressessSearch_OnSelectedAction; MainMap = new MapVM(); FindRouteCommand = new Command(arg => FindRoute()); CenterOnRouteCommand = new Command(arg => CenterOnRoute(arg)); CenterOnUserLocationCommand = new Command(arg => CenterOnUserLocation(arg)); SwapAddressesCommand = new Command(arg => SwapAddresses()); SearchLocationEnterClick = new Command(arg => FindRoute()); MapDoubleClickCommand = new Command(arg => MapDoubleClick(arg)); FromAddressessSearch.StoredLocations = FavVM.Locations; ToAddressessSearch.StoredLocations = FavVM.Locations; FavVM.PropertyChanged += (s, e) => { if (e.PropertyName == "Locations") { if (FavVM.Locations.Count > 0) { MainMap.Center = MapVM.GetLocation(FavVM.Locations.First().Address); } else { MainMap.Center = new Location(52.0, 19.0); MainMap.ZoomLevel = 5; } } }; }
public WorkOrderListVM(MapVM mapVM) { MapVM = mapVM; StartStopTimerCommand = new Command.StartStopTimerCommand(this); ZoomToCommand = new Command.ZoomToCommand(MapVM); PanToCommand = new Command.PanToCommand(MapVM); FlashCommand = new Command.FlashCommand(MapVM); DeleteLocalWoCommand = new Command.DeleteLocalWoCommand(MapVM); FilterList = new List <FilterDomain>(); FilterList.Add(new FilterDomain("Work Assigned to My Crew", FilterType.ALLDISPTCHD)); FilterList.Add(new FilterDomain("Closed Workorder", FilterType.NODISPTCHD)); if (((App)Application.Current).AppType == "PM") { FilterList.Add(new FilterDomain("PM Work", FilterType.PMDISPTCHD)); FilterList.Add(new FilterDomain("Emergency Work", FilterType.EMERGDISPTCHD)); FilterList.Add(new FilterDomain("Non PM Work", FilterType.NOPMDISPTCHD)); } OrderList = new List <OrderDomain>(); OrderList.Add(new OrderDomain("Scheduled Start", OrderType.SCHEDSTART)); OrderList.Add(new OrderDomain("Status", OrderType.STATUS)); OrderList.Add(new OrderDomain("Work Type", OrderType.WORKTYPE)); Order = OrderType.SCHEDSTART; Filter = FilterType.ALLDISPTCHD; Update(); PropertyChanged += SelectedIndexChanged; }
public async Task <IActionResult> Map(string t) { var state = _service.GetStateByToken(t); if (state == null) { var hvm = await CreateHomeVmAsync(); hvm.Error = SharedResource.InvalidQrCode; return(View(nameof(Index), hvm)); } var steamId = SteamHelper.GetSteamId(User); if (!string.IsNullOrEmpty(steamId) && state.SteamId == steamId) { state.IsAuthenticated = true; } var vm = new MapVM() { Token = state.Token, InitialMap = state.LastMission?.WorldName?.ToLowerInvariant() ?? "altis", SpectatorToken = state.SpectatorToken, }; SetupTacMap(vm); return(View(vm)); }
private void CenterOnUserLocation(object sender) { if (sender is UserLocation ul) { MainMap.Center = MapVM.GetLocation(ul.Address); //TODO W zależności od ul.Address.Type można dostosować zoom } }
// ObservableDataSource<Point> planeLocations = null; public Map() { InitializeComponent(); vm = new MapVM(); this.DataContext = vm; }
private void SetupTacMap(MapVM vm) { if (!string.IsNullOrEmpty(_tacMap.TacMapEndpoint)) { vm.TacMapDomain = new Uri(_tacMap.TacMapEndpoint).Host; vm.TacMapEndpoint = _tacMap.TacMapEndpoint; } }
private void CenterOnUserLocation(object arg) { if (arg is UserLocation ul) { FavMap.Center = MapVM.GetLocation(ul.Address); //TODO W zależności od ul.Address.Type można dostosować zoom } }
public MapView() { InitializeComponent(); vm5 = new MapVM(); this.DataContext = vm5; vm5.GetData(); googlemap.Source = new Uri(vm5.ItemData, UriKind.RelativeOrAbsolute); }
public void Init() { MapVM = new MapVM(); //Farms = new ObservableCollection<FarmVM>(); //FarmsLV.ItemsSource = Farms; //FarmsLVItemsControl.ItemsSource = Farms; // myFarm = new FarmVM(); //Farm1.DataContext = myFarm; }
public SearchVM(MapVM mapVM) { MapVM = mapVM; GeoCodeCommand = new Commands.GeoCodeCommand(this); SearchInLayerCommand = new Commands.SearchInLayerCommand(this); SearchFlashCommand = new Commands.SearchFlashCommand(this); SearchZoomToCommand = new Commands.SearchZoomToCommand(this); GeoCodeFlashCommand = new Commands.GeoCodeFlashCommand(this); GeoCodeZoomToCommand = new Commands.GeoCodeZoomToCommand(this); ZoomToStreetCoomand = new Commands.ZoomToStreetCoomand(this); FlashStreetCoomand = new Commands.FlashStreetCoomand(this); ReLoadStreetCoomand = new Commands.ReLoadStreetCoomand(this); var baseMap = MapVM.Map.OperationalLayers.FirstOrDefault(layer => layer.Name == "BaseMap"); if (baseMap != null && baseMap is GroupLayer) { var streetGroupLayer = ((GroupLayer)baseMap).Layers.FirstOrDefault(_layer => _layer.Name == "Street Names"); if (streetGroupLayer != null && streetGroupLayer is GroupLayer) { StreetLayer = (FeatureLayer)((GroupLayer)streetGroupLayer).Layers.FirstOrDefault(__layer => __layer.Name == "Street Name"); } } FillStreetData(); foreach (var item in MapVM.Map.OperationalLayers) { if (item is FeatureLayer) { Layers.Add(item); } if (item is GroupLayer) { foreach (var subitem in ((GroupLayer)item).Layers) { if (subitem is FeatureLayer) { Layers.Add(subitem); } } } } }
public FavouritesVM(MainVM mainVM_) { MainVM = mainVM_; FavMap = new MapVM(); Locations = new ObservableCollection <UserLocation>(); FavAddressSearch = new AddressesSearch(); DeleteCommand = new Command(arg => DeleteLocation(arg)); EditCommand = new Command(arg => EditLocation(arg)); MapDoubleClickCommand = new Command(arg => MapDoubleClick(arg)); CenterOnUserLocationCommand = new Command(arg => CenterOnUserLocation(arg)); AddLocationCommand = new Command(arg => AddLocation()); ClearAddingCommand = new Command(arg => ClearAdding()); Pins = new ObservableCollection <Pushpin>(); FavAddressSearch.OnSelectedAction += FavAddressSearch_OnSelectedAction; LoadData(); }
private static void MapVMPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { MapView mv = (MapView)d; mv.grid_Content.Children.Clear(); MapVM vm = (MapVM)e.NewValue; Map map = new Map(); map.SnapToLevels = true; map.IsLogoVisible = false; Binding bind = new Binding("LayerCollection"); bind.Source = vm; BindingOperations.SetBinding(map, Map.LayersProperty, bind); mv.MapNavigator.Map = map; mv.grid_Content.Children.Add(map); }
private void ListView_ItemTapped(object sender, ItemTappedEventArgs e) { ListView listView = sender as ListView; MapVM mapVM = new MapVM(); try { //MapVM mapVM = (MapVM)this.Resources["mapVM"]; //MapPage mapPage = new MapPage((MapVM)this.Resources["mapVM"]); this.Navigation.PushAsync(new MapPage(mapVM)); if (listView.SelectedItem != null) { mapVM.PortalItem = listView.SelectedItem as PortalItem; } } catch (Exception ex) { } }
public async Task <IActionResult> Shared(string t) { var state = _service.GetStateBySpectatorToken(t); if (state == null) { var hvm = await CreateHomeVmAsync(); hvm.Error = SharedResource.InvalidQrCode; return(View(nameof(Index), hvm)); } var vm = new MapVM() { InitialMap = state.LastMission?.WorldName?.ToLowerInvariant() ?? "altis", SpectatorToken = state.SpectatorToken, IsSpectator = true }; SetupTacMap(vm); return(View(nameof(Map), vm)); }
private void _updateMarkersOnMap() { switch (_selectedChoice) { case "Show All GIS Records": MapVM.SetFilteredMarkers(); break; case "Show Records Have NO Match": _recordComparer.GetUnmatchedResults(MapVM); break; case "Show Records Have Matchs": _recordComparer.GetMatchedResults(MapVM, _selectedDistanceFilter, _selectedCompareSign); break; default: break; } MapVM.UpdateMarkersOnMap(); }
private void ToAddressessSearch_OnSelectedAction(object sender, System.EventArgs e) { if (sender is MixedSearch ms) { if (!double.IsNaN(ms.SelectedLocation?.Address.Lat ?? double.NaN)) { var pin = Pins.FirstOrDefault(p => (string)p.Content == "Do"); if (pin != null) { if (Math.Abs(pin.Location.Latitude - ms.SelectedLocation.Address.Lat) > 1 && Math.Abs(pin.Location.Longitude - ms.SelectedLocation.Address.Lon) > 1) { MainMap.Center = MapVM.GetLocation(ms.SelectedLocation.Address); } Pushpin newPin = new Pushpin() { Content = "Do", Location = MapVM.GetLocation(ms.SelectedLocation.Address) }; if (pin != null) { Pins.Remove(pin); } Pins.Add(newPin); } else { Pushpin newPin = new Pushpin() { Content = "Do", Location = MapVM.GetLocation(ms.SelectedLocation.Address) }; if (pin != null) { Pins.Remove(pin); } Pins.Add(newPin); MainMap.Center = MapVM.GetLocation(ms.SelectedLocation.Address); } } } }
private void LoadData() { Task.Run(async() => { System.Windows.Application.Current.Dispatcher.Invoke(() => MainVM.Loading = true); return(await Client.GetMyAddresses()); }).ContinueWith(task => { Locations.Clear(); Locations.AddRange(task.Result); if (Locations.Count > 0) { FavMap.Center = MapVM.GetLocation(Locations.First().Address); } else { FavMap.Center = new Location(52.0, 19.0); FavMap.ZoomLevel = 5; } OnPropertyChanged(nameof(Locations)); MainVM.Loading = false; }, TaskScheduler.FromCurrentSynchronizationContext()); }
public IdentifyVM(MapVM mapVM) { MapVM = mapVM; var _fakeLayer = new FeatureLayer(); _fakeLayer.Name = "<All>"; LayerList.Add(_fakeLayer); SelectedLayer = _fakeLayer; GraphicsOverlay = new GraphicsOverlay(); MapVM.MapView.GraphicsOverlays.Add(GraphicsOverlay); IdentifyLayerResults = new ObservableCollection <LayerResult>(); IdentifyLayerResults.CollectionChanged += IdentifyLayerResults_CollectionChanged; foreach (var item in MapVM.Map.OperationalLayers) { if (item is FeatureLayer) { LayerList.Add(item); } if (item is GroupLayer) { foreach (var subitem in ((GroupLayer)item).Layers) { if (subitem is FeatureLayer) { LayerList.Add(subitem); } } } } MapVM.MapView.GeoViewTapped += Identify; }
public MeasureCommand(MapVM mapVM) : base(mapVM) { }
private bool canBeDownloaded(MapVM vm) { return vm.Model == null && !vm.IsDownloading; }
public MapPage() { InitializeComponent(); viewmodel = new MapVM(locationsMap); }
public PanToGPSCommand(MapVM mapVM) : base(mapVM) { }
public override void Execute(object parameter) { MapVM.DoPanToGPS((Esri.ArcGISRuntime.UI.Controls.MapView)parameter); }
public MapPage(MapVM mapVM) { this.BindingContext = mapVM; InitializeComponent(); }
public SettingsVM(MapVM mapVM) { MapVM = mapVM; CancelCommand = new Command.CancelCommand <SettingsVM>(this); SaveCommand = new Command.SaveCommand <SettingsVM>(this); UpdateReferenceDataCommand = new Command.UpdateReferenceDataCommand(); DriverList = new List <MaximoPerson>(); if (AppType == "PM") { secondManIsVisible = true; } else { secondManIsVisible = false; } VehicleList = MaximoServiceLibrary.AppContext.inventoryRepository.findAll().ToList(); List <string> craftrate; if (AppType == "PM") { craftrate = new string[] { "SSWR", "SSLR", "SSWL" }.ToList(); } else { craftrate = new string[] { "SSWR", "SSLR", "SSWL", "SCRW", "CNRW" }.ToList(); } var labors = MaximoServiceLibrary.AppContext.laborRepository.findAll().Where(labor => labor.laborcraftrate.Where(laborcraftrate => craftrate.Contains(laborcraftrate.craft)).Count() > 0); LaborList = new List <MaximoPerson>(); foreach (var labor in labors) { LaborList.AddRange(labor.person.Where(per => per.status == "ACTIVE").ToList()); } MaximoPersonGroup = MaximoServiceLibrary.AppContext.synchronizationService.mxuser?.userPreferences?.setting; // find leadMan var leadList = LaborList.Where(person => person.personid == MaximoPersonGroup.leadMan).ToList(); if (leadList.Count > 0) { DriverList.Add(leadList[0]); } if (AppType == "PM") { var secondList = LaborList.Where(person => person.personid == MaximoPersonGroup.secondMan).ToList(); if (secondList.Count > 0) { DriverList.Add(secondList[0]); } } Crew = MaximoPersonGroup.persongroup; LeadMan = MaximoPersonGroup.leadMan; if (AppType == "PM") { SecondMan = MaximoPersonGroup.secondMan; } DriverMan = MaximoPersonGroup.driverMan; Vehicle = MaximoPersonGroup.vehiclenum; if (LeadMan.ToUpper() == MaximoServiceLibrary.AppContext.synchronizationService.mxuser.personId.ToUpper()) { LeadManIsEnabled = false; SecondManIsEnabled = true; } else if (SecondMan?.ToUpper() == MaximoServiceLibrary.AppContext.synchronizationService.mxuser.personId.ToUpper()) { LeadManIsEnabled = true; SecondManIsEnabled = false; } else { LeadManIsEnabled = false; SecondManIsEnabled = false; } PropertyChanged += SettingsVM_PropertyChanged; }
public SketchCommand(MapVM mapVM) : base(mapVM) { }
public override void Execute(object parameter) { MapVM.ShowTOC(); }
public TOCCommand(MapVM mapVM) : base(mapVM) { }
public SearchCommand(MapVM mapVM) : base(mapVM) { }
public override void Execute(object parameter) { MapVM.ShowMeasure(); }