First overhaul to new application

This commit is contained in:
2016-01-14 23:04:53 +01:00
parent 9f51305b0d
commit a5c991ee41
38 changed files with 562 additions and 731 deletions
+61 -18
View File
@@ -3,7 +3,6 @@ using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Globalization;
using Windows.Graphics.Display;
using Windows.UI.Core;
using Windows.UI.ViewManagement;
@@ -16,37 +15,46 @@ namespace YJMPD_UWP
sealed partial class App : Application
{
public static Frame rootFrame;
// =======================
// SINGLETONS
// =======================
private static GeoTracker geo = new GeoTracker();
private static GeoHandler geohandler = new GeoHandler();
public static GeoTracker Geo
public static GeoHandler Geo
{
get
{
return geo;
return geohandler;
}
}
private static CompassTracker cm = new CompassTracker();
private static CompassHandler compasshandler = new CompassHandler();
public static CompassTracker CompassTracker
public static CompassHandler Compass
{
get
{
return cm;
return compasshandler;
}
}
public static CoreDispatcher Dispatcher
private static NetworkHandler networkhandler = new NetworkHandler();
public static NetworkHandler Network
{
get
{
return Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
return networkhandler;
}
}
private static GameHandler gamehandler = new GameHandler();
public static GameHandler Game
{
get
{
return gamehandler;
}
}
@@ -66,6 +74,23 @@ namespace YJMPD_UWP
}
}
public static CoreDispatcher Dispatcher
{
get
{
return Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
}
}
public static Frame MainFrame
{
get
{
Frame f = Window.Current.Content as Frame;
return f;
}
}
public static MainPage MainPage
{
get
@@ -76,6 +101,29 @@ namespace YJMPD_UWP
}
}
public static Frame ContentFrame
{
get
{
Frame f = Window.Current.Content as Frame;
MainPage mp = f.Content as MainPage;
Frame cf = mp.ContentFrame;
return cf;
}
}
public static bool Navigate(Type type)
{
return ContentFrame.Navigate(type);
}
public static bool Navigate(Type type, object param)
{
return ContentFrame.Navigate(type, param);
}
// ===============================
@@ -109,7 +157,7 @@ namespace YJMPD_UWP
}
#endif
rootFrame = Window.Current.Content as Frame;
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
@@ -120,11 +168,6 @@ namespace YJMPD_UWP
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
@@ -0,0 +1,29 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace YJMPD_UWP.Helpers.Converter
{
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
bool b = (bool)value;
if (b)
return Visibility.Visible;
else
return Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
Visibility v = (Visibility)value;
if (v == Visibility.Visible)
return true;
else
return false;
}
}
}
@@ -0,0 +1,14 @@
using YJMPD_UWP.Model;
namespace YJMPD_UWP.Helpers.EventArgs
{
public class GameStatusUpdatedEventArgs : System.EventArgs
{
public GameHandler.GameStatus GameStatus { get; private set; }
public GameStatusUpdatedEventArgs(GameHandler.GameStatus status)
{
this.GameStatus = status;
}
}
}
@@ -0,0 +1,14 @@
using Windows.Devices.Sensors;
namespace YJMPD_UWP.Helpers.EventArgs
{
public class HeadingUpdatedEventArgs : System.EventArgs
{
public CompassReading Heading;
public HeadingUpdatedEventArgs(CompassReading heading)
{
Heading = heading;
}
}
}
@@ -0,0 +1,14 @@
using YJMPD_UWP.Model;
namespace YJMPD_UWP.Helpers.EventArgs
{
public class NetworkStatusUpdatedEventArgs : System.EventArgs
{
public NetworkHandler.NetworkStatus NetworkStatus { get; private set; }
public NetworkStatusUpdatedEventArgs(NetworkHandler.NetworkStatus status)
{
this.NetworkStatus = status;
}
}
}
@@ -0,0 +1,14 @@
using Windows.Devices.Geolocation;
namespace YJMPD_UWP.Helpers.EventArgs
{
public class PositionStatusUpdatedEventArgs : System.EventArgs
{
public PositionStatus Status { get; private set; }
public PositionStatusUpdatedEventArgs(PositionStatus status)
{
Status = status;
}
}
}
@@ -0,0 +1,16 @@
using Windows.Devices.Geolocation;
namespace YJMPD_UWP.Helpers.EventArgs
{
public class PositionUpdatedEventArgs : System.EventArgs
{
public Geoposition Old { get; private set; }
public Geoposition New { get; private set; }
public PositionUpdatedEventArgs(Geoposition old, Geoposition notold)
{
Old = old;
New = notold;
}
}
}
+3 -33
View File
@@ -1,45 +1,15 @@
using System;
using System.Threading.Tasks;
using Windows.Globalization;
using Windows.Foundation.Collections;
using Windows.Storage;
namespace YJMPD_UWP.Helpers
{
static class Settings
{
private static ApplicationDataContainer LOCAL_SETTINGS = ApplicationData.Current.LocalSettings;
public delegate void OnLanguageUpdateHandler(EventArgs e);
public static event OnLanguageUpdateHandler OnLanguageUpdate;
public static bool Tracking
{
get
{
return (bool)LOCAL_SETTINGS.Values["tracking"];
}
set
{
LOCAL_SETTINGS.Values["tracking"] = value;
}
}
public static IPropertySet Values = ApplicationData.Current.LocalSettings.Values;
static Settings()
{
LOCAL_SETTINGS.Values["tracking"] = true;
if (CurrentLanguage == "")
ApplicationLanguages.PrimaryLanguageOverride = "en";
//Define default settings here
}
public static async void ChangeLanguage(string lang)
{
ApplicationLanguages.PrimaryLanguageOverride = lang;
await Task.Delay(TimeSpan.FromMilliseconds(100));
//App.rootFrame.Navigate(typeof(MainPage));
OnLanguageUpdate(new EventArgs());
}
public static string CurrentLanguage { get { return ApplicationLanguages.PrimaryLanguageOverride; } }
}
}
+18 -27
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.ApplicationModel.Resources;
using Windows.Data.Xml.Dom;
using Windows.Devices.Geolocation;
using Windows.Services.Maps;
@@ -17,14 +16,6 @@ namespace YJMPD_UWP.Helpers
{
public enum DialogType { YESNO, OKCANCEL }
public static ResourceLoader Loader
{
get
{
return new Windows.ApplicationModel.Resources.ResourceLoader();
}
}
public static double Now { get { return (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; } }
public static string MillisecondsToTime(double millis)
@@ -169,13 +160,13 @@ namespace YJMPD_UWP.Helpers
MessageDialog dlg = new MessageDialog(content, title);
if (type == DialogType.YESNO)
{
dlg.Commands.Add(new UICommand(Util.Loader.GetString("Yes")) { Id = 0 });
dlg.Commands.Add(new UICommand(Util.Loader.GetString("No")) { Id = 1 });
dlg.Commands.Add(new UICommand("Yes") { Id = 0 });
dlg.Commands.Add(new UICommand("No") { Id = 1 });
}
else if (type == DialogType.OKCANCEL)
{
dlg.Commands.Add(new UICommand(Util.Loader.GetString("Ok")) { Id = 0 });
dlg.Commands.Add(new UICommand(Util.Loader.GetString("Cancel")) { Id = 1 });
dlg.Commands.Add(new UICommand("Ok") { Id = 0 });
dlg.Commands.Add(new UICommand("Cancel") { Id = 1 });
}
dlg.DefaultCommandIndex = 0;
@@ -200,53 +191,53 @@ namespace YJMPD_UWP.Helpers
switch (maneuver.Kind)
{
default:
response = Util.Loader.GetString("RouteSeeMap");
response = "RouteSeeMap";
meters = false;
break;
case MapRouteManeuverKind.End:
response = Util.Loader.GetString("RouteEnd");
response = "RouteEnd";
break;
case MapRouteManeuverKind.GoStraight:
response = Util.Loader.GetString("RouteGoStraight");
response = "RouteGoStraight";
onstreet = true;
break;
case MapRouteManeuverKind.None:
response = Util.Loader.GetString("RouteNone");
response = "RouteNone";
meters = false;
break;
case MapRouteManeuverKind.Start:
response = Util.Loader.GetString("RouteStart");
response = "RouteStart";
meters = false;
break;
case MapRouteManeuverKind.TurnHardLeft:
case MapRouteManeuverKind.TurnLeft:
response = Util.Loader.GetString("RouteLeft");
response = "RouteLeft";
onstreet = true;
break;
case MapRouteManeuverKind.TurnHardRight:
case MapRouteManeuverKind.TurnRight:
response = Util.Loader.GetString("RouteRight");
response = "RouteRight";
onstreet = true;
break;
case MapRouteManeuverKind.TrafficCircleLeft:
response = Util.Loader.GetString("RouteTrafficCircleLeft");
response = "RouteTrafficCircleLeft";
onstreet = true;
break;
case MapRouteManeuverKind.TrafficCircleRight:
response = Util.Loader.GetString("RouteTrafficCircleRight");
response = "RouteTrafficCircleRight";
onstreet = true;
break;
case MapRouteManeuverKind.TurnKeepLeft:
case MapRouteManeuverKind.TurnLightLeft:
response = Util.Loader.GetString("RouteKeepLeft");
response = "RouteKeepLeft";
break;
case MapRouteManeuverKind.TurnKeepRight:
case MapRouteManeuverKind.TurnLightRight:
response = Util.Loader.GetString("RouteKeepRight");
response = "RouteKeepRight";
break;
case MapRouteManeuverKind.UTurnLeft:
case MapRouteManeuverKind.UTurnRight:
response = Util.Loader.GetString("RouteUTurn");
response = "RouteUTurn";
break;
}
@@ -258,10 +249,10 @@ namespace YJMPD_UWP.Helpers
if (onstreet)
response += " " + Util.Loader.GetString("RouteOn") + " " + maneuver.StreetName;
response += " " + "RouteOn" + " " + maneuver.StreetName;
if (meters)
response = Util.Loader.GetString("RouteIn") + " " + distance + "m" + " " + response.ToLower();
response = "RouteIn" + " " + distance + "m" + " " + response.ToLower();
return response;
}
+42 -40
View File
@@ -3,11 +3,15 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:YJMPD_UWP"
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"
mc:Ignorable="d">
<Page.Resources>
<convert:BoolToVisibilityConverter x:Key="BoolToVisConverter" />
<Style x:Key="NavStackPanel" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="VerticalAlignment" Value="Center" />
@@ -26,19 +30,19 @@
</Style>
<Style x:Key="GPSInfoPanel" TargetType="StackPanel">
<Style x:Key="GameInfoPanel" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,0,10,0" />
</Style>
<Style x:Key="GPSInfoIcon" TargetType="TextBlock">
<Style x:Key="GameInfoIcon" TargetType="TextBlock">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Margin" Value="5,5,0,0" />
</Style>
<Style x:Key="GPSInfoText" TargetType="TextBlock">
<Style x:Key="GameInfoText" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="Margin" Value="15,0,0,0" />
</Style>
@@ -54,7 +58,7 @@
<Button RelativePanel.AlignLeftWithPanel="True" Name="NavButton" Click="NavButton_Click" VerticalAlignment="Stretch" FontFamily="Segoe MDL2 Assets" Content="&#xE700;" FontSize="28" />
<Viewbox RelativePanel.RightOf="NavButton" RelativePanel.AlignBottomWith="NavButton" StretchDirection="DownOnly" Stretch="UniformToFill" Margin="10,0,10,0">
<TextBlock FontSize="28" Name="PageTitle" Text="{Binding Map}" />
<TextBlock FontSize="28" Name="PageTitle" Text="YJMPD-UWP" />
</Viewbox>
</RelativePanel>
@@ -66,67 +70,65 @@
<Viewbox Stretch="Uniform" StretchDirection="DownOnly" HorizontalAlignment="Stretch" RelativePanel.AlignTopWithPanel="True">
<ListBox SelectionMode="Single" Name="NavList" SelectionChanged="NavList_SelectionChanged" Tapped="NavList_Tapped">
<ListBoxItem Name="NavListMap" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<ListBoxItem Name="NavListHome" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE909;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Map}"/>
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE80F;"/>
<TextBlock Style="{StaticResource NavText}" Text="Home"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="NavListRoute" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<ListBoxItem Name="NavListAccount" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE7AD;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Route}"/>
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE8B8;"/>
<TextBlock Style="{StaticResource NavText}" Text="Account"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="NavListLandmarks" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<ListBoxItem Name="NavListStatistics" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE913;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Landmarks}" />
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE8F1;"/>
<TextBlock Style="{StaticResource NavText}" Text="Statistics"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="NavListHelp" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<ListBoxItem Name="NavListAbout" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE897;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Help}"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="NavListSearch" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE71E;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Search}"/>
<TextBlock Style="{StaticResource NavText}" Text="About"/>
</StackPanel>
</ListBoxItem>
<ListBoxItem Name="NavListSettings" ManipulationMode="TranslateX" ManipulationCompleted="Pane_ManipulationCompleted">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE713;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Settings}"/>
<TextBlock Style="{StaticResource NavText}" Text="Settings"/>
</StackPanel>
</ListBoxItem>
</ListBox>
</Viewbox>
<StackPanel RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Background="Transparent" Tapped="GPSRefresh_Tapped">
<StackPanel Style="{StaticResource GPSInfoPanel}">
<TextBlock Margin="5,0,0,0" FontSize="16" FontWeight="Bold" Text="{Binding GPSInfo}"/>
</StackPanel>
<StackPanel RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Background="Transparent">
<StackPanel Visibility="{Binding GameVisible, Converter={StaticResource BoolToVisConverter}}">
<StackPanel Style="{StaticResource GameInfoPanel}">
<TextBlock Margin="5,0,0,0" FontSize="16" FontWeight="Bold" Text="Currently game"/>
</StackPanel>
<StackPanel Style="{StaticResource GPSInfoPanel}" Tapped="GPSRefresh_Tapped">
<TextBlock Style="{StaticResource GPSInfoIcon}" Text="&#xE81D;"/>
<TextBlock Style="{StaticResource GPSInfoText}" Text="{Binding Status}"/>
</StackPanel>
<StackPanel Style="{StaticResource GameInfoPanel}">
<TextBlock Style="{StaticResource GameInfoIcon}" Text="&#xE8A1;"/>
<TextBlock Style="{StaticResource GameInfoText}" Text="{Binding GameState}"/>
</StackPanel>
<StackPanel Style="{StaticResource GPSInfoPanel}">
<TextBlock Style="{StaticResource GPSInfoIcon}" Text="&#xE774;"/>
<TextBlock Style="{StaticResource GPSInfoText}" Text="{Binding Source}"/>
</StackPanel>
<StackPanel Style="{StaticResource GameInfoPanel}">
<TextBlock Style="{StaticResource GameInfoIcon}" Text="&#xE716;"/>
<TextBlock Style="{StaticResource GameInfoText}" Text="{Binding People}"/>
</StackPanel>
<StackPanel Style="{StaticResource GPSInfoPanel}">
<TextBlock Style="{StaticResource GPSInfoIcon}" Text="&#xE707;"/>
<TextBlock Style="{StaticResource GPSInfoText}" Text="{Binding Accuracy}"/>
<StackPanel Style="{StaticResource GameInfoPanel}">
<Button Content="Back to Game" Background="DarkGreen" Foreground="White" Tapped="BackToGame_Tapped" HorizontalAlignment="Stretch"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="15,5">
<TextBlock Text="Nav City Breda @"/>
<TextBlock Text="YJMPD-UWP @"/>
<TextBlock Text="{Binding Year}" Margin="5,0,0,0" />
</StackPanel>
@@ -147,7 +149,7 @@
</StackPanel>
<StackPanel Name="BackMessage" Background="LightGray" Opacity="0.7" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="0,0,0,40" Visibility="Collapsed" Height="Auto">
<TextBlock Text="{Binding BackText}" Margin="5" HorizontalAlignment="Center" TextAlignment="Center"/>
<TextBlock Text="Press back again to exit" Margin="5" HorizontalAlignment="Center" TextAlignment="Center"/>
</StackPanel>
</Grid>
</SplitView.Content>
+59 -39
View File
@@ -9,6 +9,7 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
using System.Diagnostics;
namespace YJMPD_UWP
{
@@ -17,16 +18,33 @@ namespace YJMPD_UWP
double bptime;
double lastbptime;
public Frame ContentFrame
{
get
{
return Frame;
}
}
public string Title { get { return PageTitle.Text; } set { PageTitle.Text = value; } }
MainPageVM mainpagevm;
public MainPage()
{
this.InitializeComponent();
Frame.Navigated += Frame_Navigated;
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
bptime = Util.Now;
this.DataContext = new MainPageVM();
Frame.Navigate(typeof(MapView));
mainpagevm = new MainPageVM();
this.DataContext = mainpagevm;
this.InitializeComponent();
Frame.Navigated += Frame_Navigated;
Frame.Navigate(typeof(MatchView));
}
private void OnBackRequested(object sender, BackRequestedEventArgs e)
@@ -45,9 +63,12 @@ namespace YJMPD_UWP
if (bptime - lastbptime > 2000)
{
ShowHideBackMessage();
e.Handled = true;
ShowHideBackMessage();
return;
}
BackMessage.Visibility = Visibility.Collapsed;
}
public async Task<String> ShowHideBackMessage()
@@ -58,18 +79,6 @@ namespace YJMPD_UWP
return "success";
}
public void Navigate(Type type)
{
Frame.Navigate(type);
}
public void Navigate(Type type, object param)
{
Frame.Navigate(type, param);
}
public string Title { get { return PageTitle.Text; } set { PageTitle.Text = value; } }
public void NavButton_Click(object sender, RoutedEventArgs arg)
{
NavView.IsPaneOpen = !NavView.IsPaneOpen;
@@ -84,29 +93,25 @@ namespace YJMPD_UWP
switch (pagename.ToLower())
{
default:
PageTitle.Text = "Nav City Breda";
case "matchview":
NavList.SelectedIndex = 0;
break;
case "helpview":
case "accountview":
NavList.SelectedIndex = 1;
break;
case "statisticsview":
NavList.SelectedIndex = 2;
break;
case "aboutview":
NavList.SelectedIndex = 3;
break;
case "settingsview":
NavList.SelectedIndex = 5;
break;
case "mapview":
NavList.SelectedIndex = 0;
break;
case "routeview":
case "routedetailview":
NavList.SelectedIndex = 1;
break;
case "landmarkdetailview":
case "landmarkview":
NavList.SelectedIndex = 2;
break;
case "searchview":
Debug.WriteLine("Yes " + pagename);
NavList.SelectedIndex = 4;
break;
default:
PageTitle.Text = "YJMPD-UWP";
break;
}
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
@@ -118,6 +123,21 @@ namespace YJMPD_UWP
private void NavList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
NavView.IsPaneOpen = false;
if (NavListHome.IsSelected)
Frame.Navigate(typeof(MatchView));
else
if (NavListAccount.IsSelected)
Frame.Navigate(typeof(AccountView));
else
if (NavListStatistics.IsSelected)
Frame.Navigate(typeof(StatisticsView));
else
if (NavListAbout.IsSelected)
Frame.Navigate(typeof(AboutView));
else
if (NavListSettings.IsSelected)
Frame.Navigate(typeof(SettingsView));
}
private void NavList_Tapped(object sender, TappedRoutedEventArgs e)
@@ -125,6 +145,11 @@ namespace YJMPD_UWP
NavView.IsPaneOpen = false;
}
private async void BackToGame_Tapped(object sender, TappedRoutedEventArgs e)
{
bool b = await Util.ShowConfirmDialog("Not implemented", "", Util.DialogType.OKCANCEL);
}
private void Content_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
if (e.Cumulative.Translation.X > 20)
@@ -140,10 +165,5 @@ namespace YJMPD_UWP
NavView.IsPaneOpen = false;
}
}
private void GPSRefresh_Tapped(object sender, TappedRoutedEventArgs e)
{
App.Geo.ForceRefresh();
}
}
}
@@ -1,10 +1,11 @@
using YJMPD_UWP.Helpers;
using System;
using Windows.Devices.Sensors;
using YJMPD_UWP.Helpers.EventArgs;
namespace YJMPD_UWP.Model
{
public class CompassTracker
public class CompassHandler
{
public delegate void OnHeadingUpdateHandler(object sender, HeadingUpdatedEventArgs e);
public event OnHeadingUpdateHandler OnHeadingUpdate;
@@ -20,7 +21,7 @@ namespace YJMPD_UWP.Model
private CompassReading lastreading;
private double lastreadingtime;
public CompassTracker()
public CompassHandler()
{
comp = Compass.GetDefault();
@@ -68,14 +69,4 @@ namespace YJMPD_UWP.Model
}
}
}
public class HeadingUpdatedEventArgs : EventArgs
{
public CompassReading Heading;
public HeadingUpdatedEventArgs(CompassReading heading)
{
Heading = heading;
}
}
}
+19
View File
@@ -0,0 +1,19 @@
using YJMPD_UWP.Helpers.EventArgs;
namespace YJMPD_UWP.Model
{
public class GameHandler
{
public delegate void OnStatusUpdateHandler(object sender, GameStatusUpdatedEventArgs e);
public event OnStatusUpdateHandler OnStatusUpdate;
public enum GameStatus { STOPPED, SEARCHING, WAITING, ENDED, STARTING, STARTED }
private void UpdateGameStatus(GameStatus status)
{
if (OnStatusUpdate == null) return;
OnStatusUpdate(this, new GameStatusUpdatedEventArgs(status));
}
}
}
@@ -5,10 +5,11 @@ using System.Threading.Tasks;
using Windows.Devices.Geolocation;
using Windows.Devices.Geolocation.Geofencing;
using Windows.System;
using YJMPD_UWP.Helpers.EventArgs;
namespace YJMPD_UWP.Model
{
public class GeoTracker
public class GeoHandler
{
private Geolocator geo;
@@ -30,13 +31,13 @@ namespace YJMPD_UWP.Model
}
//Events
public delegate void PositionUpdateHandler(object sender, PositionUpdatedEventArgs e);
public event PositionUpdateHandler OnPositionUpdate;
public delegate void OnPositionUpdateHandler(object sender, PositionUpdatedEventArgs e);
public event OnPositionUpdateHandler OnPositionUpdate;
public delegate void StatusUpdateHandler(object sender, StatusUpdatedEventArgs e);
public event StatusUpdateHandler OnStatusUpdate;
public delegate void OnStatusUpdateHandler(object sender, PositionStatusUpdatedEventArgs e);
public event OnStatusUpdateHandler OnStatusUpdate;
public GeoTracker()
public GeoHandler()
{
_status = PositionStatus.NotInitialized;
Connected = false;
@@ -140,7 +141,7 @@ namespace YJMPD_UWP.Model
if (OnStatusUpdate == null) return;
OnStatusUpdate(this, new StatusUpdatedEventArgs(s));
OnStatusUpdate(this, new PositionStatusUpdatedEventArgs(s));
}
private void UpdatePosition(Geoposition old, Geoposition newp)
@@ -152,26 +153,4 @@ namespace YJMPD_UWP.Model
OnPositionUpdate(this, new PositionUpdatedEventArgs(old, newp));
}
}
public class PositionUpdatedEventArgs : EventArgs
{
public Geoposition Old { get; private set; }
public Geoposition New { get; private set; }
public PositionUpdatedEventArgs(Geoposition old, Geoposition notold)
{
Old = old;
New = notold;
}
}
public class StatusUpdatedEventArgs : EventArgs
{
public PositionStatus Status { get; private set; }
public StatusUpdatedEventArgs(PositionStatus status)
{
Status = status;
}
}
}
+24
View File
@@ -0,0 +1,24 @@
using YJMPD_UWP.Helpers.EventArgs;
namespace YJMPD_UWP.Model
{
public class NetworkHandler
{
public delegate void OnStatusUpdatedHandler(object sender, NetworkStatusUpdatedEventArgs e);
public OnStatusUpdatedHandler OnStatusUpdated;
public enum NetworkStatus { DISCONNECTED, CONNECTING, CONNECTED }
private void UpdateNetworkStatus(NetworkStatus status)
{
if (OnStatusUpdated == null) return;
OnStatusUpdated(this, new NetworkStatusUpdatedEventArgs(status));
}
public NetworkHandler()
{
}
}
}
+9 -29
View File
@@ -1,49 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="40d891d0-d02f-4aae-ab7d-a48efa630a65"
Publisher="CN=kenny"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="40d891d0-d02f-4aae-ab7d-a48efa630a65" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="40d891d0-d02f-4aae-ab7d-a48efa630a65" Publisher="CN=kenny" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="40d891d0-d02f-4aae-ab7d-a48efa630a65" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>YJMPD-UWP</DisplayName>
<PublisherDisplayName>kenny</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="YJMPD_UWP.App">
<uap:VisualElements
DisplayName="YJMPD-UWP"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="YJMPD-UWP"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="YJMPD_UWP.App">
<uap:VisualElements DisplayName="YJMPD-UWP" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YJMPD-UWP" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="location" />
</Capabilities>
</Package>
-1
View File
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
+10
View File
@@ -0,0 +1,10 @@
namespace YJMPD_UWP.ViewModels
{
public class AboutVM : TemplateVM
{
public AboutVM() : base("About")
{
}
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace YJMPD_UWP.ViewModels
{
public class AccountVM : TemplateVM
{
public AccountVM() : base("Account")
{
}
}
}
-72
View File
@@ -1,72 +0,0 @@
using YJMPD_UWP.Helpers;
namespace YJMPD_UWP.ViewModels
{
public class HelpVM : TemplateVM
{
public HelpVM() : base(Util.Loader.GetString("Help"))
{
}
protected override void UpdatePropertiesToNewLanguage()
{
NotifyPropertyChanged(nameof(HelpItem1Header));
NotifyPropertyChanged(nameof(HelpItem1Text));
NotifyPropertyChanged(nameof(HelpItem2Header));
NotifyPropertyChanged(nameof(HelpItem2Text));
NotifyPropertyChanged(nameof(HelpItem3Header));
NotifyPropertyChanged(nameof(HelpItem3Text));
}
public string HelpItem1Header
{
get
{
return Util.Loader.GetString("HelpItem1Header");
}
}
public string HelpItem1Text
{
get
{
return Util.Loader.GetString("HelpItem1Text");
}
}
public string HelpItem2Header
{
get
{
return Util.Loader.GetString("HelpItem2Header");
}
}
public string HelpItem2Text
{
get
{
return Util.Loader.GetString("HelpItem2Text");
}
}
public string HelpItem3Header
{
get
{
return Util.Loader.GetString("HelpItem3Header");
}
}
public string HelpItem3Text
{
get
{
return Util.Loader.GetString("HelpItem3Text");
}
}
}
}
+8 -147
View File
@@ -1,174 +1,35 @@
using System;
using Windows.Devices.Geolocation;
using Windows.UI.Core;
using YJMPD_UWP;
using YJMPD_UWP.Helpers;
using YJMPD_UWP.ViewModels;
namespace YJMPD_UWP.ViewModels
{
public class MainPageVM : TemplateVM
{
public MainPageVM() : base(Util.Loader.GetString("Loading"))
public MainPageVM() : base("Loading")
{
App.Geo.OnPositionUpdate += Geo_OnPositionUpdate;
App.Geo.OnStatusUpdate += Geo_OnStatusUpdate;
}
protected override void UpdatePropertiesToNewLanguage()
{
NotifyPropertyChanged(nameof(Map));
NotifyPropertyChanged(nameof(Help));
NotifyPropertyChanged(nameof(Route));
NotifyPropertyChanged(nameof(Landmarks));
NotifyPropertyChanged(nameof(Search));
NotifyPropertyChanged(nameof(Settings));
NotifyPropertyChanged(nameof(Status));
NotifyPropertyChanged(nameof(Source));
NotifyPropertyChanged(nameof(Accuracy));
NotifyPropertyChanged(nameof(GPSInfo));
NotifyPropertyChanged(nameof(BackText));
}
public string BackText
public string GameState
{
get
{
return Util.Loader.GetString("BackTwiceText");
return "N/A";
}
}
public string Map
public string People
{
get
{
return Util.Loader.GetString("Map");
return "0/0";
}
}
public string Help
public bool GameVisible
{
get
{
return Util.Loader.GetString("Help");
}
}
public string Route
{
get
{
return Util.Loader.GetString("Route");
}
}
public string Landmarks
{
get
{
return Util.Loader.GetString("Landmarks");
}
}
public string Search
{
get
{
return Util.Loader.GetString("Search");
}
}
public string Settings
{
get
{
return Util.Loader.GetString("Settings");
}
}
private void Geo_OnStatusUpdate(object sender, YJMPD_UWP.Model.StatusUpdatedEventArgs e)
{
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
NotifyPropertyChanged(nameof(Status));
});
}
private void Geo_OnPositionUpdate(object sender, YJMPD_UWP.Model.PositionUpdatedEventArgs e)
{
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
NotifyPropertyChanged(nameof(Source));
NotifyPropertyChanged(nameof(Accuracy));
});
}
public string GPSInfo
{
get
{
return Util.Loader.GetString("GPSInfo");
}
}
public string Status
{
get
{
switch (App.Geo.Status)
{
case PositionStatus.Disabled:
return Util.Loader.GetString("Disabled");
case PositionStatus.Initializing:
return Util.Loader.GetString("Initializing");
case PositionStatus.NoData:
return Util.Loader.GetString("NoData");
default:
case PositionStatus.NotAvailable:
return Util.Loader.GetString("NotAvailable");
case PositionStatus.NotInitialized:
return Util.Loader.GetString("NotInitialized");
case PositionStatus.Ready:
return Util.Loader.GetString("Ready");
}
}
}
public string Source
{
get
{
if (App.Geo.Connected == true && App.Geo.Position != null)
switch (App.Geo.Position.Coordinate.PositionSource)
{
case PositionSource.Cellular:
return Util.Loader.GetString("Cellular");
case PositionSource.IPAddress:
return Util.Loader.GetString("IPAddress");
case PositionSource.Satellite:
return Util.Loader.GetString("Satellite");
case PositionSource.WiFi:
return Util.Loader.GetString("WiFi");
default:
case PositionSource.Unknown:
return Util.Loader.GetString("Unknown");
}
else
return Util.Loader.GetString("Unknown");
}
}
public string Accuracy
{
get
{
if (App.Geo.Connected == true && App.Geo.Position != null)
return App.Geo.Position.Coordinate.Accuracy.ToString() + "m";
else
return Util.Loader.GetString("Unknown");
return true;
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace YJMPD_UWP.ViewModels
{
public class MatchVM : TemplateVM
{
public MatchVM() : base("Match")
{
}
}
}
+2 -37
View File
@@ -1,45 +1,10 @@
using YJMPD_UWP.Helpers;
namespace YJMPD_UWP.ViewModels
namespace YJMPD_UWP.ViewModels
{
public class SettingsVM : TemplateVM
{
public SettingsVM() : base(Util.Loader.GetString("Settings"))
public SettingsVM() : base("Settings")
{
}
protected override void UpdatePropertiesToNewLanguage()
{
NotifyPropertyChanged(nameof(Language));
NotifyPropertyChanged(nameof(Reset));
NotifyPropertyChanged(nameof(ResetHeader));
App.MainPage.Title = Util.Loader.GetString("Settings");
}
public string Language
{
get
{
return Util.Loader.GetString("Language");
}
}
public string ResetHeader
{
get
{
return Util.Loader.GetString("Reset");
}
}
public string Reset
{
get
{
return Util.Loader.GetString("Reset") + " " + Util.Loader.GetString("Application");
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace YJMPD_UWP.ViewModels
{
public class StatisticsVM : TemplateVM
{
public StatisticsVM() : base("Statistics")
{
}
}
}
+1 -17
View File
@@ -1,6 +1,4 @@
using YJMPD_UWP.Helpers;
using System;
using System.ComponentModel;
using System.ComponentModel;
using Windows.UI.Core;
namespace YJMPD_UWP.ViewModels
@@ -12,25 +10,11 @@ namespace YJMPD_UWP.ViewModels
public TemplateVM(string title)
{
dispatcher = App.Dispatcher;
Settings.OnLanguageUpdate += Settings_OnLanguageUpdate;
if (App.MainPage != null)
App.MainPage.Title = title;
}
private void Settings_OnLanguageUpdate(EventArgs e)
{
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
UpdatePropertiesToNewLanguage();
});
}
protected virtual void UpdatePropertiesToNewLanguage()
{
//to implement in underlying class
}
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyName)
+13
View File
@@ -0,0 +1,13 @@
<Page
x:Class="YJMPD_UWP.Views.AboutView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
</Grid>
</Page>
+17
View File
@@ -0,0 +1,17 @@
using YJMPD_UWP.ViewModels;
using Windows.UI.Xaml.Controls;
namespace YJMPD_UWP.Views
{
public sealed partial class AboutView : Page
{
AboutVM aboutvm;
public AboutView()
{
aboutvm = new AboutVM();
this.DataContext = aboutvm;
this.InitializeComponent();
}
}
}
+13
View File
@@ -0,0 +1,13 @@
<Page
x:Class="YJMPD_UWP.Views.AccountView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
</Grid>
</Page>
+17
View File
@@ -0,0 +1,17 @@
using Windows.UI.Xaml.Controls;
using YJMPD_UWP.ViewModels;
namespace YJMPD_UWP.Views
{
public sealed partial class AccountView : Page
{
AccountVM accountvm;
public AccountView()
{
accountvm = new AccountVM();
this.DataContext = accountvm;
this.InitializeComponent();
}
}
}
-112
View File
@@ -1,112 +0,0 @@
<Page
x:Class="YJMPD_UWP.Views.HelpView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style TargetType="StackPanel" x:Key="HelpPanel">
<Setter Property="Margin" Value="10,10,10,0" />
<Setter Property="Padding" Value="0,0,0,10" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" />
<Setter Property="BorderThickness" Value="0,0,0,2" />
</Style>
<Style TargetType="TextBlock" x:Key="HelpText">
<Setter Property="RelativePanel.AlignTopWithPanel" Value="True" />
<Setter Property="RelativePanel.AlignLeftWithPanel" Value="True" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="TextBlock" x:Key="HelpTextImage">
<Setter Property="RelativePanel.AlignTopWithPanel" Value="True" />
<Setter Property="RelativePanel.AlignLeftWithPanel" Value="True" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
<Setter Property="Margin" Value="0,0,60,0" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<Style TargetType="Image" x:Key="HelpImageSmall">
<Setter Property="RelativePanel.AlignRightWithPanel" Value="True" />
<Setter Property="RelativePanel.AlignVerticalCenterWithPanel" Value="True" />
<Setter Property="Width" Value="50" />
<Setter Property="Height" Value="50" />
<Setter Property="Stretch" Value="UniformToFill"/>
</Style>
<Style TargetType="SymbolIcon" x:Key="HelpSymbolSmall">
<Setter Property="RelativePanel.AlignRightWithPanel" Value="True" />
<Setter Property="RelativePanel.AlignVerticalCenterWithPanel" Value="True" />
<Setter Property="Width" Value="50" />
<Setter Property="Height" Value="50" />
</Style>
<Style TargetType="TextBlock" x:Key="HelpIconSmall">
<Setter Property="RelativePanel.AlignRightWithPanel" Value="True" />
<Setter Property="RelativePanel.AlignVerticalCenterWithPanel" Value="True" />
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
<Setter Property="FontSize" Value="40" />
</Style>
<Style TargetType="Image" x:Key="HelpImageLarge">
<Setter Property="Stretch" Value="UniformToFill"/>
<Setter Property="Margin" Value="0,5,0,0" />
</Style>
</Page.Resources>
<ScrollViewer HorizontalScrollMode="Disabled" VerticalScrollMode="Enabled" VerticalSnapPointsAlignment="Near">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Position -->
<StackPanel Grid.Row="0" Style="{StaticResource HelpPanel}">
<TextBlock Text="{Binding HelpItem1Header}" Style="{StaticResource Header}" />
<RelativePanel>
<TextBlock Text="{Binding HelpItem1Text}" Style="{StaticResource HelpTextImage}" />
<Image Source="/Assets/CurrentLocationRound.png" Style="{StaticResource HelpImageSmall}" />
</RelativePanel>
</StackPanel>
<!-- Page Navigation -->
<StackPanel Grid.Row="1" Style="{StaticResource HelpPanel}">
<TextBlock Text="{Binding HelpItem2Header}" Style="{StaticResource Header}" />
<RelativePanel>
<TextBlock Text="{Binding HelpItem2Text}" Style="{StaticResource HelpText}" />
</RelativePanel>
<Image Source="/Assets/Help/HelpItem2Image.png" Style="{StaticResource HelpImageLarge}" />
</StackPanel>
<!-- GPS Information -->
<StackPanel Grid.Row="2" Style="{StaticResource HelpPanel}">
<TextBlock Text="{Binding HelpItem3Header}" Style="{StaticResource Header}" />
<RelativePanel>
<TextBlock Text="{Binding HelpItem3Text}" Style="{StaticResource HelpText}" />
</RelativePanel>
<Image Source="/Assets/Help/HelpItem3Image.png" Style="{StaticResource HelpImageLarge}" />
</StackPanel>
<!-- Map + Controls (Tilt,zoom,pan,rotate) -->
<!-- Route -->
<!-- Help -->
<!-- Settings -->
<!-- Landmark -->
<!-- Visited / Not Visited -->
<!-- Starting a route -->
<!-- Stopping a route -->
<!-- What happens when you walk -->
<!-- Buttons and text during navigation -->
</Grid>
</ScrollViewer>
</Page>
-17
View File
@@ -1,17 +0,0 @@
using YJMPD_UWP.ViewModels;
using Windows.UI.Xaml.Controls;
namespace YJMPD_UWP.Views
{
public sealed partial class HelpView : Page
{
HelpVM helpvm;
public HelpView()
{
helpvm = new HelpVM();
this.DataContext = helpvm;
this.InitializeComponent();
}
}
}
+13
View File
@@ -0,0 +1,13 @@
<Page
x:Class="YJMPD_UWP.Views.MatchView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
</Grid>
</Page>
+17
View File
@@ -0,0 +1,17 @@
using Windows.UI.Xaml.Controls;
using YJMPD_UWP.ViewModels;
namespace YJMPD_UWP.Views
{
public sealed partial class MatchView : Page
{
MatchVM matchvm;
public MatchView()
{
matchvm = new MatchVM();
this.DataContext = matchvm;
this.InitializeComponent();
}
}
}
+3 -26
View File
@@ -7,30 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<ScrollViewer>
<StackPanel HorizontalAlignment="Stretch">
<StackPanel Margin="10">
<TextBlock Text="{Binding Language}" Style="{StaticResource Header}"/>
<ComboBox Name="Language" SelectionChanged="Language_SelectionChanged" HorizontalAlignment="Stretch">
<ComboBoxItem>English</ComboBoxItem>
<ComboBoxItem>Nederlands</ComboBoxItem>
<ComboBoxItem>Deutsch</ComboBoxItem>
<!-- <ComboBoxItem>日本語</ComboBoxItem> -->
</ComboBox>
</StackPanel>
<StackPanel Margin="10">
<TextBlock Text="{Binding ResetHeader}" Style="{StaticResource Header}"/>
<StackPanel Orientation="Horizontal">
<Button Name="ResetButton" Click="ResetButton_Click">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE895;" Margin="0,3,10,0" />
<TextBlock Text="{Binding Reset}" />
</StackPanel>
</Button>
<ProgressRing Name="ResetProgress" IsActive="False" Margin="15,0,0,0"/>
</StackPanel>
</StackPanel>
</StackPanel>
</ScrollViewer>
<Grid>
</Grid>
</Page>
+2 -67
View File
@@ -1,9 +1,5 @@
using YJMPD_UWP.Helpers;
using YJMPD_UWP.ViewModels;
using System.Diagnostics;
using Windows.UI.Xaml;
using YJMPD_UWP.ViewModels;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace YJMPD_UWP.Views
{
@@ -13,70 +9,9 @@ namespace YJMPD_UWP.Views
public SettingsView()
{
this.InitializeComponent();
settingsvm = new SettingsVM();
this.DataContext = settingsvm;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
switch (Settings.CurrentLanguage)
{
default:
Debug.WriteLine("Unsupported language: " + Settings.CurrentLanguage);
Language.SelectedIndex = 0;
break;
case "en":
Language.SelectedIndex = 0;
break;
case "nl":
Language.SelectedIndex = 1;
break;
case "de":
Language.SelectedIndex = 2;
break;
case "ja":
Language.SelectedIndex = 3;
break;
}
}
private void Language_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch (Language.SelectedIndex)
{
default:
Language.SelectedIndex = 0;
break;
case 0:
if (Settings.CurrentLanguage != "en")
Settings.ChangeLanguage("en");
break;
case 1:
if (Settings.CurrentLanguage != "nl")
Settings.ChangeLanguage("nl");
break;
case 2:
if (Settings.CurrentLanguage != "de")
Settings.ChangeLanguage("de");
break;
case 3:
if (Settings.CurrentLanguage != "ja")
Settings.ChangeLanguage("ja");
break;
}
}
private async void ResetButton_Click(object sender, RoutedEventArgs e)
{
bool confirm = await Util.ShowConfirmDialog(Util.Loader.GetString("Reset"), Util.Loader.GetString("ResetConfirmation"), Util.DialogType.YESNO);
if (confirm)
{
ResetProgress.IsActive = true;
Language.SelectedIndex = 0;
ResetProgress.IsActive = false;
}
this.InitializeComponent();
}
}
}
+13
View File
@@ -0,0 +1,13 @@
<Page
x:Class="YJMPD_UWP.Views.StatisticsView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
</Grid>
</Page>
+17
View File
@@ -0,0 +1,17 @@
using Windows.UI.Xaml.Controls;
using YJMPD_UWP.ViewModels;
namespace YJMPD_UWP.Views
{
public sealed partial class StatisticsView : Page
{
StatisticsVM statisticsvm;
public StatisticsView()
{
statisticsvm = new StatisticsVM();
this.DataContext = statisticsvm;
this.InitializeComponent();
}
}
}
+39 -8
View File
@@ -22,7 +22,7 @@
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<NoWarn>;2008;CS4014</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -95,25 +95,45 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Helpers\Converter\BoolToVisibilityConverter.cs" />
<Compile Include="Helpers\EventArgs\GameStatusUpdatedEventArgs.cs" />
<Compile Include="Helpers\EventArgs\HeadingUpdatedEventArgs.cs" />
<Compile Include="Helpers\EventArgs\NetworkStatusUpdatedEventArgs.cs" />
<Compile Include="Helpers\EventArgs\PositionStatusUpdatedEventArgs.cs" />
<Compile Include="Helpers\EventArgs\PositionUpdatedEventArgs.cs" />
<Compile Include="Helpers\Extensions.cs" />
<Compile Include="Helpers\Settings.cs" />
<Compile Include="Helpers\Util.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Model\CompassTracker.cs" />
<Compile Include="Model\GeoTracker.cs" />
<Compile Include="Model\CompassHandler.cs" />
<Compile Include="Model\GameHandler.cs" />
<Compile Include="Model\GeoHandler.cs" />
<Compile Include="Model\NetworkHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\HelpVM.cs" />
<Compile Include="ViewModels\AboutVM.cs" />
<Compile Include="ViewModels\AccountVM.cs" />
<Compile Include="ViewModels\MainPageVM.cs" />
<Compile Include="ViewModels\MatchVM.cs" />
<Compile Include="ViewModels\SettingsVM.cs" />
<Compile Include="ViewModels\StatisticsVM.cs" />
<Compile Include="ViewModels\TemplateVM.cs" />
<Compile Include="Views\HelpView.xaml.cs">
<DependentUpon>HelpView.xaml</DependentUpon>
<Compile Include="Views\AboutView.xaml.cs">
<DependentUpon>AboutView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\AccountView.xaml.cs">
<DependentUpon>AccountView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MatchView.xaml.cs">
<DependentUpon>MatchView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsView.xaml.cs">
<DependentUpon>SettingsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\StatisticsView.xaml.cs">
<DependentUpon>StatisticsView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
@@ -152,18 +172,29 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\HelpView.xaml">
<Page Include="Views\AboutView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\AccountView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MatchView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SettingsView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\StatisticsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Folder Include="Helpers\Comparer\" />
<Folder Include="Helpers\Converter\" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>