EquipmentEditMapView.xaml.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Syncfusion.SfMaps.XForms;
  9. using Xamarin.Forms;
  10. using Xamarin.Forms.Xaml;
  11. namespace PRS.Mobile
  12. {
  13. [XamlCompilation(XamlCompilationOptions.Compile)]
  14. public partial class EquipmentEditMapView
  15. {
  16. public EquipmentEditMapView()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void Refresh()
  21. {
  22. if (ViewModel.Coordinates.Equals(Point.Zero))
  23. {
  24. NoMap.IsVisible = true;
  25. Map.IsVisible = false;
  26. return;
  27. }
  28. NoMap.IsVisible = false;
  29. Map.IsVisible = true;
  30. Layer.Markers = new ObservableCollection<MapMarker>()
  31. {
  32. new MapMarker()
  33. {
  34. Label = ViewModel.Item.Code,
  35. Latitude = ViewModel.Coordinates.X.ToString(CultureInfo.CurrentCulture),
  36. Longitude = ViewModel.Coordinates.Y.ToString(CultureInfo.CurrentCulture)
  37. }
  38. };
  39. Layer.GeoCoordinates = ViewModel.Coordinates;
  40. Map.ZoomLevel = 14;
  41. }
  42. }
  43. }