فهرست منبع

Added pivot/map and removed testcode

Kenneth van Ewijk 10 سال پیش
والد
کامیت
1782dfbb0e
5فایلهای تغییر یافته به همراه45 افزوده شده و 16 حذف شده
  1. BIN
      YJMPD-UWP/Assets/Direction.png
  2. 0 4
      YJMPD-UWP/MainPage.xaml.cs
  3. 13 4
      YJMPD-UWP/ViewModels/MatchVM.cs
  4. 29 8
      YJMPD-UWP/Views/MatchView.xaml
  5. 3 0
      YJMPD-UWP/YJMPD-UWP.csproj

BIN
YJMPD-UWP/Assets/Direction.png


+ 0 - 4
YJMPD-UWP/MainPage.xaml.cs

@@ -51,10 +51,6 @@ namespace YJMPD_UWP
         {
             if (e.Handled) return;
 
-            App.Game.MoveToStarted(new BasicGeoposition { Latitude = 44.768187, Longitude = -0.472412 });
-            e.Handled = true;
-            return;
-
             if (App.Game.Status == Model.GameHandler.GameStatus.STARTED)
             {
                 e.Handled = true;

+ 13 - 4
YJMPD-UWP/ViewModels/MatchVM.cs

@@ -26,9 +26,11 @@ namespace YJMPD_UWP.ViewModels
         {
             dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
             {
+                if (App.Game.Status != Model.GameHandler.GameStatus.STARTED)
+                    return;
+
                 Degrees = (int)(angle + -e.Heading.HeadingMagneticNorth);
                 NotifyPropertyChanged(nameof(Degrees));
-                Debug.WriteLine("Degrees " + Degrees + " / " + angle);
             });
         }
 
@@ -36,15 +38,14 @@ namespace YJMPD_UWP.ViewModels
         {
             dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
             {
-                if (App.Game.Status == Model.GameHandler.GameStatus.STARTED)
+                if (App.Game.Status != Model.GameHandler.GameStatus.STARTED)
                     return;
 
                 angle = (int)Util.DegreeBearing(e.Position.Coordinate.Point.Position, App.Game.Destination);
                 HeadingVisible = Util.Distance(e.Position.Coordinate.Point.Position, App.Game.Destination) > 500;
 
-                Debug.WriteLine(HeadingVisible);
-
                 NotifyPropertyChanged(nameof(HeadingVisible));
+                NotifyPropertyChanged(nameof(InvHeadingVisible));
             });
         }
 
@@ -87,6 +88,14 @@ namespace YJMPD_UWP.ViewModels
             get; private set;
         }
 
+        public bool InvHeadingVisible
+        {
+            get
+            {
+                return !HeadingVisible;
+            }
+        }
+
         public bool MessageVisible
         {
             get

+ 29 - 8
YJMPD-UWP/Views/MatchView.xaml

@@ -3,6 +3,7 @@
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:local="using:YJMPD_UWP.Views"
+    xmlns:map="using:Windows.UI.Xaml.Controls.Maps"
     xmlns:convert="using:YJMPD_UWP.Helpers.Converter"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -12,14 +13,33 @@
         <convert:BoolToVisibilityConverter x:Key="BoolToVisConverter" />
     </Page.Resources>
 
-    <Grid Style="{StaticResource BaseGrid}">
-        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ZoomMode="Enabled">
-            <Image Name="Photo" Stretch="UniformToFill" RenderTransformOrigin="0.5,0.5" Source="{Binding Photo}">
-                <Image.RenderTransform>
-                    <CompositeTransform Rotation="{Binding Degrees}"/>
-                </Image.RenderTransform>
-            </Image>
-        </ScrollViewer>
+    <Grid>
+        <Pivot>
+         
+            <PivotItem Header="Photo">
+                <Grid>
+                    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ZoomMode="Enabled">
+                        <Image Name="Photo" Stretch="UniformToFill" RenderTransformOrigin="0.5,0.5" Source="{Binding Photo}" />
+                    </ScrollViewer>
+                </Grid>
+            </PivotItem>
+
+            <PivotItem Header="Direction">
+                <Grid>
+                    <Image Name="Direction" Visibility="{Binding HeadingVisible, Converter={StaticResource BoolToVisConverter}}" Stretch="Uniform" RenderTransformOrigin="0.5,0.5" Source="ms-appx:///Assets/Direction.png" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+                        <Image.RenderTransform>
+                            <CompositeTransform Rotation="{Binding Degrees}"/>
+                        </Image.RenderTransform>
+                    </Image>
+
+                    <TextBlock Visibility="{Binding InvHeadingVisible, Converter={StaticResource BoolToVisConverter}}" Text="The direction hint is currently not available because you are already too close to your destination" />
+                </Grid>
+            </PivotItem>
+
+            <PivotItem Header="Map">
+                <map:MapControl Name="Map" MapServiceToken="74Y70e71HVjjN7lnx4Eh~3wugTlBDe2DbPGuR_AM2aA~AjMbg-pU2qn4gYf97oH0GZI1oY9Jc4vH-4WyIRyoYQM0Q71CnfbWalEN37bdSgms" />
+            </PivotItem>
+        </Pivot>
 
         <StackPanel Visibility="{Binding MessageVisible, Converter={StaticResource BoolToVisConverter}}" Background="DarkGreen" Padding="20" VerticalAlignment="Bottom">
             <TextBlock Foreground="White" Text="{Binding Message}" />
@@ -29,4 +49,5 @@
             <TextBlock Foreground="White" Text="{Binding Error}" />
         </StackPanel>
     </Grid>
+    
 </Page>

+ 3 - 0
YJMPD-UWP/YJMPD-UWP.csproj

@@ -159,6 +159,9 @@
   </ItemGroup>
   <ItemGroup>
     <Content Include="Assets\4-[Omgezet].png" />
+    <Content Include="Assets\Direction.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="Assets\Error.png" />
     <Content Include="Properties\Default.rd.xml" />
     <Content Include="Assets\LockScreenLogo.scale-200.png" />