Selaa lähdekoodia

Fixed Equipment List "Maps" Tab Page Crash

Frank van den Bos 2 vuotta sitten
vanhempi
commit
84f8caf89c

+ 30 - 2
prs.mobile.new/PRS.Mobile/Modules/Equipment/Edit/Views/EquipmentEditMapView.xaml

@@ -16,18 +16,46 @@
             Margin="0"
             HasShadow="False">
             <Grid>
-                <xForms:SfMaps x:Name="Map" BackgroundColor="White" VerticalOptions="StartAndExpand" IsVisible="False"> 
+                <xForms:SfMaps 
+                    x:Name="Map" 
+                    BackgroundColor="White" 
+                    VerticalOptions="Fill" 
+                    HorizontalOptions="Fill" 
+                    IsVisible="True">
+                     
                     <xForms:SfMaps.Layers>
                         <xForms:ImageryLayer x:Name="Layer">
                             <xForms:ImageryLayer.Markers>
                             </xForms:ImageryLayer.Markers>
+                            <xForms:ImageryLayer.MarkerSettings>
+                                <xForms:MapMarkerSetting 
+                                    MarkerIcon="Image"
+                                    ImageSource="circle_green"
+                                    IconColor="Blue" 
+                                    FontAttributes="Bold" 
+                                    LabelSize="20" 
+                                    LabelColor="DarkBlue" >
+                                    
+                                    <xForms:MapMarkerSetting.IconSize>
+                                        <OnPlatform x:TypeArguments="x:Double">
+                                            <OnPlatform.Platforms>
+                                                <On Platform="iOS" Value="15" />
+                                                <On Platform="Android" Value="35" />
+                                            </OnPlatform.Platforms>
+                                        </OnPlatform>
+                                    </xForms:MapMarkerSetting.IconSize>
+                                    
+                                </xForms:MapMarkerSetting>
+                                
+                            </xForms:ImageryLayer.MarkerSettings>
                         </xForms:ImageryLayer>
                     </xForms:SfMaps.Layers>
                 </xForms:SfMaps>
+                
                 <Label 
                     x:Name="NoMap"
                     Text="No Map Available" 
-                    IsVisible="True" 
+                    IsVisible="False" 
                     VerticalOptions="CenterAndExpand" 
                     VerticalTextAlignment="Center"
                     HorizontalOptions="CenterAndExpand"

+ 13 - 24
prs.mobile.new/PRS.Mobile/Modules/Equipment/Edit/Views/EquipmentEditMapView.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Globalization;
 using System.Linq;
 using System.Text;
@@ -18,8 +19,11 @@ namespace PRS.Mobile
             InitializeComponent();
         }
 
+        
+        
         public override void Refresh()
         {
+            
             if (ViewModel.Coordinates.Equals(Point.Zero))
             {
                 NoMap.IsVisible = true;
@@ -29,32 +33,17 @@ namespace PRS.Mobile
                 
             NoMap.IsVisible = false;
             Map.IsVisible = true;
-
             
-
-            if (Device.RuntimePlatform.Equals(Device.iOS))
-            {
-                Layer.MarkerSettings.MarkerIcon = MapMarkerIcon.Circle;
-                Layer.MarkerSettings.IconColor = Color.DarkBlue;
-                Layer.MarkerSettings.IconSize = 15;
-            }
-            else
-            {
-                Layer.MarkerSettings.MarkerIcon = MapMarkerIcon.Image;
-                Layer.MarkerSettings.ImageSource = "mapmarker";
-                Layer.MarkerSettings.IconSize = 35;
-            }
-
-
-            Layer.MarkerSettings.FontAttributes = FontAttributes.Bold;
-            Layer.MarkerSettings.LabelSize = 20;
-            Layer.MarkerSettings.LabelColor = Color.DarkBlue;
+            Layer.Markers = new ObservableCollection<MapMarker>() 
+            { 
+                new MapMarker()
+                {
+                    Label = ViewModel.Item.Code,
+                    Latitude = ViewModel.Coordinates.X.ToString(CultureInfo.CurrentCulture),
+                    Longitude = ViewModel.Coordinates.Y.ToString(CultureInfo.CurrentCulture)
+                }
+            };
             
-            MapMarker marker = new MapMarker();
-            marker.Label = "";
-            marker.Latitude = ViewModel.Coordinates.X.ToString(CultureInfo.InvariantCulture);
-            marker.Longitude = ViewModel.Coordinates.Y.ToString(CultureInfo.InvariantCulture);
-            Layer.Markers.Add(marker);    
             Layer.GeoCoordinates = ViewModel.Coordinates;
             Map.ZoomLevel = 14;
         }

+ 1 - 1
prs.mobile.new/PRS.Mobile/Modules/Equipment/LiveMaps/LiveMaps.xaml

@@ -17,7 +17,7 @@
                 <RowDefinition Height="*"/>
             </Grid.RowDefinitions>
             
-            <maps:SfMaps Grid.Row="0" Grid.RowSpan="2" x:Name="Map" BackgroundColor="White" VerticalOptions="StartAndExpand"> 
+            <maps:SfMaps Grid.Row="0" Grid.RowSpan="2" x:Name="Map" BackgroundColor="White" VerticalOptions="Fill" HorizontalOptions="Fill"> 
                 <maps:SfMaps.Layers>
                     <maps:ImageryLayer x:Name="JobLayer">
                         <maps:ImageryLayer.Markers>

+ 2 - 0
prs.mobile.new/PRS.Mobile/Modules/Notifications/NotificationList.xaml

@@ -4,9 +4,11 @@
              xmlns:mobile="clr-namespace:InABox.Mobile;assembly=InABox.Mobile.Shared"
              x:Class="PRS.Mobile.NotificationList"
              Title="Notifications">
+    
     <mobile:MobilePage.PrimaryMenu>
         <ImageButton Source="tick" Clicked="DismissAll_Clicked"/>
     </mobile:MobilePage.PrimaryMenu>
+    
     <mobile:MobilePage.PageContent>
         <StackLayout>
             <Grid Margin="5">