Code cleanup

This commit is contained in:
2015-12-26 15:22:20 +01:00
parent 65123d0ef1
commit 429f1b8df3
30 changed files with 156 additions and 203 deletions
+1 -4
View File
@@ -12,9 +12,6 @@ using Windows.UI.Xaml.Navigation;
namespace NavCityBreda
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
@@ -58,7 +55,7 @@ namespace NavCityBreda
{
get
{
return Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
return Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
}
}
@@ -10,7 +10,7 @@ namespace NavCityBreda.Helpers.Converter
{
Model.Landmark.LandmarkStatus st = (Model.Landmark.LandmarkStatus)value;
switch(st)
switch (st)
{
default:
case Model.Landmark.LandmarkStatus.NOTVISITED:
+8 -8
View File
@@ -30,10 +30,10 @@ namespace NavCityBreda.Helpers
JToken[] waypoints = o["waypoints"].ToArray();
int count = 0;
foreach(JToken t in waypoints)
foreach (JToken t in waypoints)
{
if(!ValidateWaypointObject(t, out error))
throw new FileLoadException("Invalid Waypoint (#" + (count+1) + ") information in " + datafile + ", " + error);
if (!ValidateWaypointObject(t, out error))
throw new FileLoadException("Invalid Waypoint (#" + (count + 1) + ") information in " + datafile + ", " + error);
Waypoint w;
@@ -41,18 +41,18 @@ namespace NavCityBreda.Helpers
{
List<Image> images = new List<Image>();
if(! t["image"].NullOrEmpty())
if (!t["image"].NullOrEmpty())
{
JToken img = t["image"];
if (img.Type == JTokenType.String)
{
if(ImageExists(foldername, (string)img))
if (ImageExists(foldername, (string)img))
images.Add(new Image(ImagePath(foldername, (string)img)));
}
else if(img.Type == JTokenType.Array)
else if (img.Type == JTokenType.Array)
{
foreach(string s in img.ToArray())
foreach (string s in img.ToArray())
{
if (ImageExists(foldername, s))
images.Add(new Image(ImagePath(foldername, s)));
@@ -143,7 +143,7 @@ namespace NavCityBreda.Helpers
error = "Longitude missing";
}
if( valid && (bool)o["landmark"])
if (valid && (bool)o["landmark"])
{
if (o["description"].NullOrEmpty())
{
+7 -6
View File
@@ -10,9 +10,10 @@ namespace NavCityBreda.Helpers
private static ApplicationDataContainer LOCAL_SETTINGS = ApplicationData.Current.LocalSettings;
public delegate void OnLanguageUpdateHandler(EventArgs e);
public static event OnLanguageUpdateHandler OnLanguageUpdate;
public static event OnLanguageUpdateHandler OnLanguageUpdate;
public static bool Tracking {
public static bool Tracking
{
get
{
return (bool)LOCAL_SETTINGS.Values["tracking"];
@@ -33,10 +34,10 @@ namespace NavCityBreda.Helpers
public static async void ChangeLanguage(string lang)
{
ApplicationLanguages.PrimaryLanguageOverride = lang;
await Task.Delay(TimeSpan.FromMilliseconds(100));
//App.rootFrame.Navigate(typeof(MainPage));
OnLanguageUpdate(new EventArgs());
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; } }
+6 -5
View File
@@ -17,10 +17,11 @@ namespace NavCityBreda.Helpers
{
public enum DialogType { YESNO, OKCANCEL }
public static ResourceLoader Loader
public static ResourceLoader Loader
{
get {
return new Windows.ApplicationModel.Resources.ResourceLoader();
get
{
return new Windows.ApplicationModel.Resources.ResourceLoader();
}
}
@@ -171,7 +172,7 @@ namespace NavCityBreda.Helpers
dlg.Commands.Add(new UICommand(Util.Loader.GetString("Yes")) { Id = 0 });
dlg.Commands.Add(new UICommand(Util.Loader.GetString("No")) { Id = 1 });
}
else if(type == DialogType.OKCANCEL)
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 });
@@ -257,7 +258,7 @@ namespace NavCityBreda.Helpers
if (onstreet)
response += " " + Util.Loader.GetString("RouteOn") + " " + maneuver.StreetName;
response += " " + Util.Loader.GetString("RouteOn") + " " + maneuver.StreetName;
if (meters)
response = Util.Loader.GetString("RouteIn") + " " + distance + "m" + " " + response.ToLower();
+2 -7
View File
@@ -7,13 +7,8 @@ using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class InitPage : Page
{
internal Rect splashImageRect; // Rect to store splash screen image coordinates.
@@ -81,7 +76,7 @@ namespace NavCityBreda
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
splashProgressText.Text = App.RouteManager.LoadingElement;
});
});
}
Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
@@ -92,7 +87,7 @@ namespace NavCityBreda
App.rootFrame = rootFrame;
rootFrame.Navigate(typeof(MainPage));
});
}
}
}
+4 -4
View File
@@ -55,7 +55,6 @@
<Viewbox RelativePanel.RightOf="NavButton" RelativePanel.AlignBottomWith="NavButton" StretchDirection="DownOnly" Stretch="UniformToFill" Margin="10,0,10,0">
<TextBlock FontSize="28" Name="PageTitle" Text="{Binding Map}" />
</Viewbox>
</RelativePanel>
<!-- http://stackoverflow.com/questions/32108362/uwp-swipe-to-open-splitview-pane-->
@@ -71,7 +70,7 @@
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE909;"/>
<TextBlock Style="{StaticResource NavText}" Text="{Binding Map}"/>
</StackPanel>
</ListBoxItem>
</ListBoxItem>
<ListBoxItem Name="NavListRoute">
<StackPanel Style="{StaticResource NavStackPanel}">
<TextBlock Style="{StaticResource NavIcon}" Text="&#xE7AD;"/>
@@ -102,7 +101,7 @@
<StackPanel Style="{StaticResource GPSInfoPanel}">
<TextBlock Margin="5,0,0,0" FontSize="16" FontWeight="Bold" Text="{Binding GPSInfo}"/>
</StackPanel>
<StackPanel Style="{StaticResource GPSInfoPanel}" Tapped="GPSRefresh_Tapped">
<TextBlock Style="{StaticResource GPSInfoIcon}" Text="&#xE81D;"/>
<TextBlock Style="{StaticResource GPSInfoText}" Text="{Binding Status}"/>
@@ -122,10 +121,11 @@
<TextBlock Text="Nav City Breda @"/>
<TextBlock Text="{Binding Year}" Margin="5,0,0,0" />
</StackPanel>
</StackPanel>
</RelativePanel>
</SplitView.Pane>
<SplitView.Content>
<Grid>
<Frame Name="Frame"/>
+1 -6
View File
@@ -10,13 +10,8 @@ using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace NavCityBreda
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
double bptime;
@@ -48,7 +43,7 @@ namespace NavCityBreda
lastbptime = bptime;
bptime = Util.Now;
if(bptime - lastbptime > 2000)
if (bptime - lastbptime > 2000)
{
ShowHideBackMessage();
e.Handled = true;
+3 -2
View File
@@ -71,9 +71,10 @@ namespace NavCityBreda.Model
var accessStatus = await Geolocator.RequestAccessAsync();
switch (accessStatus)
{
{
case GeolocationAccessStatus.Allowed:
geo = new Geolocator {
geo = new Geolocator
{
DesiredAccuracy = PositionAccuracy.High,
MovementThreshold = 3
//ReportInterval = 1500
+2 -2
View File
@@ -32,7 +32,7 @@ namespace NavCityBreda.Model
public MapIcon Icon { get; set; }
public Landmark(Geopoint p, string name, int num, string desc, List<Image> images) : base (p, name, num)
public Landmark(Geopoint p, string name, int num, string desc, List<Image> images) : base(p, name, num)
{
Create(name, desc, num, images);
}
@@ -62,7 +62,7 @@ namespace NavCityBreda.Model
{
Icon.Title = Name;
switch(_status)
switch (_status)
{
default:
case LandmarkStatus.NOTVISITED:
+4 -4
View File
@@ -14,13 +14,13 @@ namespace NavCityBreda.Model
public GeoboundingBox Bounds { get { return _route.BoundingBox; } }
private string _namekey;
public string Name { get { return Util.Loader.GetString( _namekey ); } }
public string Name { get { return Util.Loader.GetString(_namekey); } }
private string _desckey;
public string Description { get { return Util.Loader.GetString( _desckey ); } }
public string Description { get { return Util.Loader.GetString(_desckey); } }
private string _landdesckey;
public string LandmarksDescription { get { return Util.Loader.GetString( _landdesckey ); } }
public string LandmarksDescription { get { return Util.Loader.GetString(_landdesckey); } }
private string foldername { get; set; }
@@ -80,7 +80,7 @@ namespace NavCityBreda.Model
public async Task<String> Reset()
{
foreach(Landmark l in Landmarks)
foreach (Landmark l in Landmarks)
{
l.Status = Landmark.LandmarkStatus.NOTVISITED;
await Task.Delay(TimeSpan.FromMilliseconds(2));
+16 -17
View File
@@ -1,7 +1,6 @@
using NavCityBreda.Helpers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -20,16 +19,16 @@ namespace NavCityBreda.Model
public delegate void OnLandmarkVisitedHandler(object sender, LandmarkVisitedEventArgs e);
public event OnLandmarkVisitedHandler OnLandmarkVisited;
public delegate void OnLandmarkChangedHandler (object sender, LandmarkChangedEventArgs e);
public delegate void OnLandmarkChangedHandler(object sender, LandmarkChangedEventArgs e);
public event OnLandmarkChangedHandler OnLandmarkChanged;
public delegate void OnManeuverChangedHandler (object sender, ManeuverChangedEventArgs e);
public delegate void OnManeuverChangedHandler(object sender, ManeuverChangedEventArgs e);
public event OnManeuverChangedHandler OnManeuverChanged;
private List<Route> _routes;
public List<Route> Routes { get { return _routes; } }
public List<Route> Routes { get { return _routes; } }
private Route _currentroute;
public Route CurrentRoute { get { return _currentroute; } }
@@ -41,7 +40,7 @@ namespace NavCityBreda.Model
public MapRoute RouteToLandmark { get { return _routetolandmark; } }
private int _currentroutelegcount;
private MapRouteLeg _currentrouteleg { get { return _currentroutelegs[_currentroutelegcount]; } }
private MapRouteLeg _currentrouteleg { get { return _currentroutelegs[_currentroutelegcount]; } }
private List<MapRouteLeg> _currentroutelegs;
private int _currentmaneuvercount;
@@ -68,12 +67,12 @@ namespace NavCityBreda.Model
DistanceToManeuver = -1;
GeofenceMonitor.Current.GeofenceStateChanged += Current_GeofenceStateChanged;
App.Geo.OnPositionUpdate += Geo_OnPositionUpdate;
LoadRoutes();
LoadRoutes();
}
private void Geo_OnPositionUpdate(object sender, PositionUpdatedEventArgs e)
{
if(Status == RouteStatus.STARTED)
if (Status == RouteStatus.STARTED)
{
bool found = false;
@@ -98,11 +97,11 @@ namespace NavCityBreda.Model
}
}
if(found)
if (found)
{
if(_currentmaneuvercount >= _currentmaneuvers.Count)
if (_currentmaneuvercount >= _currentmaneuvers.Count)
{
if(_currentroutelegcount+1 < _currentroutelegs.Count)
if (_currentroutelegcount + 1 < _currentroutelegs.Count)
{
_currentroutelegcount++;
_currentmaneuvercount = 0;
@@ -145,14 +144,14 @@ namespace NavCityBreda.Model
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
i.Status = Landmark.LandmarkStatus.VISITED;
});
});
_currentlandmark = i;
LandmarkVisited(i, LandmarkVisitedEventArgs.VisitedStatus.ENTERED);
Util.ShowToastNotification(i.Name, Util.Loader.GetString("LandmarkReached"));
UpdateRoute();
}
else if(state == GeofenceState.Exited)
else if (state == GeofenceState.Exited)
{
LandmarkVisited(i, LandmarkVisitedEventArgs.VisitedStatus.EXITED);
}
@@ -165,13 +164,13 @@ namespace NavCityBreda.Model
_routes.Clear();
foreach(string folder in routefolders)
foreach (string folder in routefolders)
{
string foldername = Path.GetFileName(folder);
if (foldername != "img")
{
Route r = RouteParser.LoadRoute(foldername);
LoadingElement = Util.Loader.GetString("Loading") + " " + r.Name.ToLower() + "...";
LoadingElement = Util.Loader.GetString("Loading") + " " + r.Name.ToLower() + "...";
await r.CalculateRoute();
_routes.Add(r);
}
@@ -217,7 +216,7 @@ namespace NavCityBreda.Model
_currentroutelegcount = 0;
_currentmaneuvercount = 0;
_currentmaneuver = _currentmaneuvers[_currentmaneuvercount];
//Send out events
UpdateRoute(_routetolandmark, _currentlandmark);
@@ -265,7 +264,7 @@ namespace NavCityBreda.Model
{
List<Landmark> l = new List<Landmark>();
foreach(Route r in _routes)
foreach (Route r in _routes)
{
l.AddRange(r.Landmarks);
}
@@ -285,7 +284,7 @@ namespace NavCityBreda.Model
public async Task<String> Reset()
{
foreach(Route r in _routes)
foreach (Route r in _routes)
{
await r.Reset();
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace NavCityBreda.Model
public Geopoint Position { get; protected set; }
protected string _namekey;
public string Name { get { return Util.Loader.GetString( _namekey ); } }
public string Name { get { return Util.Loader.GetString(_namekey); } }
public int Order { get; protected set; }
+2 -2
View File
@@ -70,13 +70,13 @@ namespace NavCityBreda.ViewModels
{
return landmark.Status;
}
}
}
public string Visited
{
get
{
switch(landmark.Status)
switch (landmark.Status)
{
default:
case Landmark.LandmarkStatus.NOTVISITED:
+1 -2
View File
@@ -1,7 +1,6 @@
using NavCityBreda.Helpers;
using NavCityBreda.Helpers.Comparer;
using NavCityBreda.Model;
using System;
using System.Collections.Generic;
namespace NavCityBreda.ViewModels
@@ -97,7 +96,7 @@ namespace NavCityBreda.ViewModels
{
IComparer<Landmark> comparer;
switch(s)
switch (s)
{
default:
case Sort.ALPHA:
+3 -3
View File
@@ -105,7 +105,7 @@ namespace NavCityBreda.ViewModels
{
get
{
switch(App.Geo.Status)
switch (App.Geo.Status)
{
case PositionStatus.Disabled:
return Util.Loader.GetString("Disabled");
@@ -129,7 +129,7 @@ namespace NavCityBreda.ViewModels
get
{
if (App.Geo.Connected == true && App.Geo.Position != null)
switch(App.Geo.Position.Coordinate.PositionSource)
switch (App.Geo.Position.Coordinate.PositionSource)
{
case PositionSource.Cellular:
return Util.Loader.GetString("Cellular");
@@ -153,7 +153,7 @@ namespace NavCityBreda.ViewModels
{
get
{
if (App.Geo.Connected == true && App.Geo.Position != null)
return App.Geo.Position.Coordinate.Accuracy.ToString() + "m";
else
+5 -8
View File
@@ -5,11 +5,6 @@ namespace NavCityBreda.ViewModels
{
public class MapVM : TemplateVM
{
//In een route de MapLegs gaan bijhouden. Dan de eerste als current instellen.
//Dan kan je daarvan de informatie laten zien. Ook een event toevoegen als je dan aan het einde bent, dat weet je door lon-lon > 0.? te doen elke positie update.
//Allemaal in RouteManager afhandelen
//Nog een manier vinden om van een route afwijken op te vangen en dan opnieuw de route te berekenen.
public MapVM() : base(Util.Loader.GetString("Map"))
{
App.RouteManager.OnManeuverChanged += RouteManager_OnManeuverChanged;
@@ -24,14 +19,16 @@ namespace NavCityBreda.ViewModels
private void RouteManager_OnStatusUpdate(object sender, Model.RouteStatusChangedEventArgs e)
{
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
NotifyPropertyChanged(nameof(Instructions));
});
}
private void RouteManager_OnManeuverChanged(object sender, Model.ManeuverChangedEventArgs e)
{
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
NotifyPropertyChanged(nameof(Landmark));
NotifyPropertyChanged(nameof(Maneuver));
});
@@ -82,7 +79,7 @@ namespace NavCityBreda.ViewModels
public void UpdateMap()
{
if(App.MainPage != null)
if (App.MainPage != null)
App.MainPage.Title = Util.Loader.GetString("Map");
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace NavCityBreda.ViewModels
public SettingsVM() : base(Util.Loader.GetString("Settings"))
{
}
protected override void UpdatePropertiesToNewLanguage()
+1 -1
View File
@@ -14,7 +14,7 @@ namespace NavCityBreda.ViewModels
dispatcher = App.Dispatcher;
Settings.OnLanguageUpdate += Settings_OnLanguageUpdate;
if(App.MainPage != null)
if (App.MainPage != null)
App.MainPage.Title = title;
}
+1 -1
View File
@@ -78,7 +78,7 @@
<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}" />
-5
View File
@@ -1,13 +1,8 @@
using NavCityBreda.ViewModels;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class HelpView : Page
{
HelpVM helpvm;
+1 -1
View File
@@ -73,7 +73,7 @@
<TextBlock Text="{Binding DescriptionTitle}" Style="{StaticResource Header}"/>
<TextBlock TextWrapping="WrapWholeWords" Text="{Binding Description}"/>
</StackPanel>
</Grid>
</ScrollViewer>
</Page>
@@ -3,13 +3,8 @@ using NavCityBreda.ViewModels;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class LandmarkDetailView : Page
{
LandmarkDetailVM landmarkvm;
+1 -1
View File
@@ -11,7 +11,7 @@
<Page.Resources>
<convert:StatusToIconConverter x:Key="IconConverter" />
</Page.Resources>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
+6 -11
View File
@@ -17,13 +17,8 @@ using System.Threading.Tasks;
using Windows.Devices.Geolocation.Geofencing;
using Windows.UI.Core;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MapView : Page
{
MapIcon CurrentPosition;
@@ -75,7 +70,7 @@ namespace NavCityBreda.Views
Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
{
if (mapvm.Tracking && e.Heading.HeadingTrueNorth.HasValue)
Map.TryRotateToAsync((double)e.Heading.HeadingTrueNorth);
Map.TryRotateToAsync((double)e.Heading.HeadingTrueNorth);
});
}
@@ -85,7 +80,7 @@ namespace NavCityBreda.Views
{
if (e.Status == LandmarkVisitedEventArgs.VisitedStatus.ENTERED)
App.MainPage.Navigate(typeof(LandmarkDetailView), e.Landmark);
});
});
}
private void RouteManager_OnLandmarkChanged(object sender, LandmarkChangedEventArgs e)
@@ -127,7 +122,7 @@ namespace NavCityBreda.Views
}
else
RemoveRoute();
});
});
}
private async void DrawRoute()
@@ -146,7 +141,7 @@ namespace NavCityBreda.Views
Map.MapElements.Add(Util.GetRouteLine(App.RouteManager.CurrentRoute.RouteObject, Color.FromArgb(200, 100, 100, 255), 50, 3));
if (App.Geo.History.Count > 1)
if (App.Geo.History.Count > 1)
Map.MapElements.Add(Util.GetRouteLine(App.Geo.History.Select(p => p.Coordinate.Point.Position).ToList(), Color.FromArgb(255, 155, 155, 155), 250, 6));
foreach (Landmark l in r.Landmarks)
@@ -215,7 +210,7 @@ namespace NavCityBreda.Views
await Task.Delay(TimeSpan.FromMilliseconds(300));
await Map.TryRotateToAsync(0);
}
}
Zooming = false;
return "success";
@@ -274,7 +269,7 @@ namespace NavCityBreda.Views
{
mapvm.Tracking = tracking;
if(tracking)
if (tracking)
{
DisableControls(true);
+49 -49
View File
@@ -16,61 +16,61 @@
</Page.Resources>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding ScreenWidth}" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding ScreenWidth}" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<map:MapControl Grid.Row="0" Name="Map" ZoomInteractionMode="Disabled" RotateInteractionMode="Disabled" TiltInteractionMode="Disabled" PanInteractionMode="Disabled" MapServiceToken="74Y70e71HVjjN7lnx4Eh~3wugTlBDe2DbPGuR_AM2aA~AjMbg-pU2qn4gYf97oH0GZI1oY9Jc4vH-4WyIRyoYQM0Q71CnfbWalEN37bdSgms"/>
<StackPanel Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent">
<map:MapControl Grid.Row="0" Name="Map" ZoomInteractionMode="Disabled" RotateInteractionMode="Disabled" TiltInteractionMode="Disabled" PanInteractionMode="Disabled" MapServiceToken="74Y70e71HVjjN7lnx4Eh~3wugTlBDe2DbPGuR_AM2aA~AjMbg-pU2qn4gYf97oH0GZI1oY9Jc4vH-4WyIRyoYQM0Q71CnfbWalEN37bdSgms"/>
<StackPanel Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent">
<!-- Nothing here -->
</StackPanel>
<Grid Grid.Row="1" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<SymbolIcon Symbol="Clock" Style="{StaticResource InfoIcon}"/>
<TextBlock Text="{Binding Time}" Style="{StaticResource InfoText}"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Grid Grid.Row="1" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<SymbolIcon Symbol="Clock" Style="{StaticResource InfoIcon}"/>
<TextBlock Text="{Binding Time}" Style="{StaticResource InfoText}"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<SymbolIcon Symbol="SetTile" Style="{StaticResource InfoIcon}"/>
<TextBlock Text="{Binding Distance}" Style="{StaticResource InfoText}"/>
</StackPanel>
</Grid>
<StackPanel Grid.Row="2" Margin="10">
<Button Click="StartRouteButton_Click" Content="{Binding StartRouteText}" Background="DarkGreen" Foreground="White" HorizontalAlignment="Stretch" Visibility="{Binding StartEnabled, Converter={StaticResource VisConverter}}"/>
<Button Click="StopRouteButton_Click" Content="{Binding StopRouteText}" Background="DarkRed" Foreground="White" HorizontalAlignment="Stretch" Visibility="{Binding StopEnabled, Converter={StaticResource VisConverter}}"/>
</StackPanel>
<StackPanel Grid.Row="3" Margin="10">
<TextBlock Text="{Binding DescriptionTitle}" Style="{StaticResource Header}"/>
<TextBlock TextWrapping="WrapWholeWords" Text="{Binding Description}"/>
</StackPanel>
<StackPanel Grid.Row="4" Name="LandmarkListPanel" Margin="10">
<TextBlock Text="{Binding LandmarksTitle}" Style="{StaticResource Header}"/>
<ListView x:Name="LandmarkList" ItemsSource="{Binding Landmarks}" IsItemClickEnabled="True" ItemClick="LandmarkList_ItemClick"
ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled">
<ListView.ItemTemplate>
<DataTemplate x:Name="ListViewDataTemplate">
<StackPanel Orientation="Horizontal">
<SymbolIcon Symbol="{Binding Status, Converter={StaticResource IconConverter}}" Margin="0,0,10,0"/>
<TextBlock Text="{Binding Name}" FontSize="18"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Grid>
<StackPanel Grid.Row="2" Margin="10">
<Button Click="StartRouteButton_Click" Content="{Binding StartRouteText}" Background="DarkGreen" Foreground="White" HorizontalAlignment="Stretch" Visibility="{Binding StartEnabled, Converter={StaticResource VisConverter}}"/>
<Button Click="StopRouteButton_Click" Content="{Binding StopRouteText}" Background="DarkRed" Foreground="White" HorizontalAlignment="Stretch" Visibility="{Binding StopEnabled, Converter={StaticResource VisConverter}}"/>
</StackPanel>
<StackPanel Grid.Row="3" Margin="10">
<TextBlock Text="{Binding DescriptionTitle}" Style="{StaticResource Header}"/>
<TextBlock TextWrapping="WrapWholeWords" Text="{Binding Description}"/>
</StackPanel>
<StackPanel Grid.Row="4" Name="LandmarkListPanel" Margin="10">
<TextBlock Text="{Binding LandmarksTitle}" Style="{StaticResource Header}"/>
<ListView x:Name="LandmarkList" ItemsSource="{Binding Landmarks}" IsItemClickEnabled="True" ItemClick="LandmarkList_ItemClick"
ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled">
<ListView.ItemTemplate>
<DataTemplate x:Name="ListViewDataTemplate">
<StackPanel Orientation="Horizontal">
<SymbolIcon Symbol="{Binding Status, Converter={StaticResource IconConverter}}" Margin="0,0,10,0"/>
<TextBlock Text="{Binding Name}" FontSize="18"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Grid>
</ScrollViewer>
</Page>
+9 -13
View File
@@ -9,13 +9,8 @@ using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Maps;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class RouteDetailView : Page
{
private Route route;
@@ -36,19 +31,20 @@ namespace NavCityBreda.Views
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Route r = e.Parameter as Route;
if (r == route)
{
routedetailvm.UpdateRoute();
LandmarkList.SelectedIndex = -1;
return;
}
else
{
route = r;
routedetailvm = new RouteDetailVM(route);
this.DataContext = routedetailvm;
}
route = r;
routedetailvm = new RouteDetailVM(route);
this.DataContext = routedetailvm;
DrawRoute();
DrawRoute();
}
private async void DrawRoute()
@@ -57,7 +53,7 @@ namespace NavCityBreda.Views
Zoom();
await Task.Delay(TimeSpan.FromMilliseconds(10));
await Task.Delay(TimeSpan.FromMilliseconds(25));
MapPolyline m = Util.GetRouteLine(route.RouteObject, Color.FromArgb(255, 100, 100, 255), 25, 6);
Map.MapElements.Add(m);
+17 -17
View File
@@ -8,26 +8,26 @@
mc:Ignorable="d">
<ScrollViewer>
<Grid Name="RouteListPanel">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Name="RouteListPanel">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Margin="17,10,5,10" Text="{Binding Description}" TextWrapping="WrapWholeWords" Grid.Row="0"/>
<TextBlock Margin="17,10,5,10" Text="{Binding Description}" TextWrapping="WrapWholeWords" Grid.Row="0"/>
<ListView x:Name="RouteList" Grid.Row="1" ItemsSource="{Binding Routes}" Margin="0,10,0,0" IsItemClickEnabled="True" ItemClick="RouteList_ItemClick"
<ListView x:Name="RouteList" Grid.Row="1" ItemsSource="{Binding Routes}" Margin="0,10,0,0" IsItemClickEnabled="True" ItemClick="RouteList_ItemClick"
ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled">
<ListView.ItemTemplate>
<DataTemplate x:Name="ListViewDataTemplate">
<StackPanel Margin="5,0,0,0">
<TextBlock Text="{Binding Name}" FontSize="20" TextWrapping="NoWrap"/>
<TextBlock Text="{Binding LandmarksDescription}" FontSize="14" TextWrapping="WrapWholeWords" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemTemplate>
<DataTemplate x:Name="ListViewDataTemplate">
<StackPanel Margin="5,0,0,0">
<TextBlock Text="{Binding Name}" FontSize="20" TextWrapping="NoWrap"/>
<TextBlock Text="{Binding LandmarksDescription}" FontSize="14" TextWrapping="WrapWholeWords" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</ListView>
</Grid>
</ScrollViewer>
</Page>
-5
View File
@@ -2,13 +2,8 @@
using NavCityBreda.ViewModels;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class RouteView : Page
{
RouteVM routevm;
+3 -11
View File
@@ -1,19 +1,12 @@
using NavCityBreda.Helpers;
using NavCityBreda.ViewModels;
using System;
using System.Diagnostics;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace NavCityBreda.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SettingsView : Page
{
SettingsVM settingsvm;
@@ -23,7 +16,6 @@ namespace NavCityBreda.Views
this.InitializeComponent();
settingsvm = new SettingsVM();
this.DataContext = settingsvm;
//throw new NotImplementedException("Tracking + tilemaps");
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -51,13 +43,13 @@ namespace NavCityBreda.Views
private void Language_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch(Language.SelectedIndex)
switch (Language.SelectedIndex)
{
default:
Language.SelectedIndex = 0;
break;
case 0:
if(Settings.CurrentLanguage != "en")
if (Settings.CurrentLanguage != "en")
Settings.ChangeLanguage("en");
break;
case 1:
@@ -79,7 +71,7 @@ namespace NavCityBreda.Views
{
bool confirm = await Util.ShowConfirmDialog(Util.Loader.GetString("Reset"), Util.Loader.GetString("ResetConfirmation"), Util.DialogType.YESNO);
if(confirm)
if (confirm)
{
ResetProgress.IsActive = true;
App.RouteManager.StopRoute();