Clean and added landmark list
This commit is contained in:
@@ -1,26 +1,13 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.Graphics.Display;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace NavCityBreda
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
|
||||
namespace NavCityBreda.Helpers
|
||||
{
|
||||
public class BoundingBox
|
||||
{
|
||||
public static GeoboundingBox GetBoundingBox(List<Geopoint> points)
|
||||
{
|
||||
double latitude_min = points.Select(p => p.Position.Latitude).Min();
|
||||
double latitude_max = points.Select(p => p.Position.Latitude).Max();
|
||||
double longitude_min = points.Select(p => p.Position.Longitude).Min();
|
||||
double longitude_max = points.Select(p => p.Position.Longitude).Max();
|
||||
|
||||
return new GeoboundingBox(
|
||||
new BasicGeoposition { Latitude = latitude_max, Longitude = longitude_max },
|
||||
new BasicGeoposition { Latitude = latitude_min, Longitude = longitude_min }
|
||||
);
|
||||
}
|
||||
|
||||
// Semi-axes of WGS-84 geoidal reference
|
||||
private const double WGS84_a = 6378137.0; // Major semiaxis [m]
|
||||
private const double WGS84_b = 6356752.3; // Minor semiaxis [m]
|
||||
|
||||
// 'halfSideInKm' is the half length of the bounding box you want in kilometers.
|
||||
public static GeoboundingBox GetBoundingBox(Geopoint point, double halfSideInKm)
|
||||
{
|
||||
// Bounding box surrounding the point at given coordinates,
|
||||
// assuming local approximation of Earth surface as a sphere
|
||||
// of radius given by WGS84
|
||||
var lat = Deg2rad(point.Position.Latitude);
|
||||
var lon = Deg2rad(point.Position.Longitude);
|
||||
var halfSide = 1000 * halfSideInKm;
|
||||
|
||||
// Radius of Earth at given latitude
|
||||
var radius = WGS84EarthRadius(lat);
|
||||
// Radius of the parallel at given latitude
|
||||
var pradius = radius * Math.Cos(lat);
|
||||
|
||||
var latMin = lat - halfSide / radius;
|
||||
var latMax = lat + halfSide / radius;
|
||||
var lonMin = lon - halfSide / pradius;
|
||||
var lonMax = lon + halfSide / pradius;
|
||||
|
||||
return new GeoboundingBox(
|
||||
new BasicGeoposition { Latitude = Rad2deg(latMax), Longitude = Rad2deg(lonMax) },
|
||||
new BasicGeoposition { Latitude = Rad2deg(latMin), Longitude = Rad2deg(lonMin) }
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
// degrees to radians
|
||||
private static double Deg2rad(double degrees)
|
||||
{
|
||||
return Math.PI * degrees / 180.0;
|
||||
}
|
||||
|
||||
// radians to degrees
|
||||
private static double Rad2deg(double radians)
|
||||
{
|
||||
return 180.0 * radians / Math.PI;
|
||||
}
|
||||
|
||||
// Earth radius at a given latitude, according to the WGS-84 ellipsoid [m]
|
||||
private static double WGS84EarthRadius(double lat)
|
||||
{
|
||||
var An = WGS84_a * WGS84_a * Math.Cos(lat);
|
||||
var Bn = WGS84_b * WGS84_b * Math.Sin(lat);
|
||||
var Ad = WGS84_a * Math.Cos(lat);
|
||||
var Bd = WGS84_b * Math.Sin(lat);
|
||||
return Math.Sqrt((An * An + Bn * Bn) / (Ad * Ad + Bd * Bd));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using NavCityBreda.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NavCityBreda.Helpers.Comparer
|
||||
{
|
||||
class LandmarkAlphaComparer : IComparer<Landmark>
|
||||
{
|
||||
public int Compare(Landmark x, Landmark y)
|
||||
{
|
||||
return x.Name.CompareTo(y.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using NavCityBreda.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NavCityBreda.Helpers.Comparer
|
||||
{
|
||||
class LandmarkAlphaReversedComparer : IComparer<Landmark>
|
||||
{
|
||||
public int Compare(Landmark x, Landmark y)
|
||||
{
|
||||
return y.Name.CompareTo(x.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using NavCityBreda.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NavCityBreda.Helpers.Comparer
|
||||
{
|
||||
class LandmarkNotVisitedComparer : IComparer<Landmark>
|
||||
{
|
||||
public int Compare(Landmark x, Landmark y)
|
||||
{
|
||||
if (x.Visited == y.Visited)
|
||||
{
|
||||
return x.Name.CompareTo(y.Name);
|
||||
}
|
||||
else if (x.Visited)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using NavCityBreda.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NavCityBreda.Helpers.Comparer
|
||||
{
|
||||
class LandmarkVisitedComparer : IComparer<Landmark>
|
||||
{
|
||||
public int Compare(Landmark x, Landmark y)
|
||||
{
|
||||
if (x.Visited == y.Visited)
|
||||
{
|
||||
return x.Name.CompareTo(y.Name);
|
||||
}
|
||||
else if (x.Visited)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-6
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace NavCityBreda.Helpers
|
||||
namespace NavCityBreda.Helpers.Converter
|
||||
{
|
||||
class BoolToCheckmarkConverter : IValueConverter
|
||||
class BoolToIconConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
+1
-5
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace NavCityBreda.Helpers
|
||||
namespace NavCityBreda.Helpers.Converter
|
||||
{
|
||||
class BoolToVisibilityConverter : IValueConverter
|
||||
{
|
||||
@@ -1,9 +1,5 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NavCityBreda.Helpers
|
||||
{
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using NavCityBreda.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace NavCityBreda.Helpers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Globalization;
|
||||
using Windows.Storage;
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.Data.Xml.Dom;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics.Display;
|
||||
using Windows.Services.Maps;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Notifications;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Maps;
|
||||
|
||||
namespace NavCityBreda.Helpers
|
||||
|
||||
@@ -1,22 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.Graphics.Display;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
||||
@@ -294,4 +294,16 @@
|
||||
<data name="BackTwiceText" xml:space="preserve">
|
||||
<value>Press back again to exit</value>
|
||||
</data>
|
||||
<data name="LandmarkListDescription" xml:space="preserve">
|
||||
<value>Tap on a landmark in de list below to view details. You can sort the list using the buttons.</value>
|
||||
</data>
|
||||
<data name="Ascending" xml:space="preserve">
|
||||
<value>Ascending</value>
|
||||
</data>
|
||||
<data name="Descending" xml:space="preserve">
|
||||
<value>Descending</value>
|
||||
</data>
|
||||
<data name="SortOrder" xml:space="preserve">
|
||||
<value>Sort Order</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -294,4 +294,16 @@
|
||||
<data name="BackTwiceText" xml:space="preserve">
|
||||
<value>Druk nogmaals op vorige om te sluiten</value>
|
||||
</data>
|
||||
<data name="LandmarkListDescription" xml:space="preserve">
|
||||
<value>Tik op een bezienswaardigheid uit de onderstaande lijst om de details ervan te bekijken. U kunt de lijst sorteren met de knoppen.</value>
|
||||
</data>
|
||||
<data name="Ascending" xml:space="preserve">
|
||||
<value>Oplopend</value>
|
||||
</data>
|
||||
<data name="Descending" xml:space="preserve">
|
||||
<value>Aflopend</value>
|
||||
</data>
|
||||
<data name="SortOrder" xml:space="preserve">
|
||||
<value>Sorteer volgorde</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -78,6 +78,12 @@
|
||||
<TextBlock Style="{StaticResource NavText}" Text="{Binding Route}"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Name="NavListLandmarks">
|
||||
<StackPanel Style="{StaticResource NavStackPanel}">
|
||||
<TextBlock Style="{StaticResource NavIcon}" Text=""/>
|
||||
<TextBlock Style="{StaticResource NavText}" Text="{Binding Landmarks}" />
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
<ListBoxItem Name="NavListHelp">
|
||||
<StackPanel Style="{StaticResource NavStackPanel}">
|
||||
<TextBlock Style="{StaticResource NavIcon}" Text=""/>
|
||||
@@ -87,7 +93,7 @@
|
||||
<ListBoxItem Name="NavListSettings">
|
||||
<StackPanel Style="{StaticResource NavStackPanel}">
|
||||
<TextBlock Style="{StaticResource NavIcon}" Text=""/>
|
||||
<TextBlock Style="{StaticResource NavText}" Text="{Binding Settings}"/>
|
||||
<TextBlock Style="{StaticResource NavText}" Text="{Binding Settings}"/>
|
||||
</StackPanel>
|
||||
</ListBoxItem>
|
||||
</ListBox>
|
||||
|
||||
@@ -2,21 +2,12 @@
|
||||
using NavCityBreda.ViewModels;
|
||||
using NavCityBreda.Views;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
@@ -102,21 +93,21 @@ namespace NavCityBreda
|
||||
PageTitle.Text = "Nav City Breda";
|
||||
break;
|
||||
case "helpview":
|
||||
NavList.SelectedIndex = 2;
|
||||
NavList.SelectedIndex = 3;
|
||||
break;
|
||||
case "settingsview":
|
||||
NavList.SelectedIndex = 3;
|
||||
NavList.SelectedIndex = 4;
|
||||
break;
|
||||
case "mapview":
|
||||
NavList.SelectedIndex = 0;
|
||||
break;
|
||||
case "routeview":
|
||||
case "routedetailview":
|
||||
NavList.SelectedIndex = 1;
|
||||
break;
|
||||
case "routeview":
|
||||
NavList.SelectedIndex = 1;
|
||||
break;
|
||||
case "landmarkdetailview":
|
||||
case "landmarkview":
|
||||
NavList.SelectedIndex = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -141,6 +132,8 @@ namespace NavCityBreda
|
||||
}
|
||||
else if (NavListHelp.IsSelected)
|
||||
Frame.Navigate(typeof(HelpView));
|
||||
else if (NavListLandmarks.IsSelected)
|
||||
Frame.Navigate(typeof(LandmarkView));
|
||||
else if (NavListSettings.IsSelected)
|
||||
Frame.Navigate(typeof(SettingsView));
|
||||
else if (NavListRoute.IsSelected)
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Sensors;
|
||||
|
||||
namespace NavCityBreda.Model
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Devices.Geolocation.Geofencing;
|
||||
using Windows.Foundation;
|
||||
using Windows.System;
|
||||
|
||||
namespace NavCityBreda.Model
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.ViewManagement;
|
||||
|
||||
namespace NavCityBreda.Model
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Services.Maps;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Devices.Geolocation.Geofencing;
|
||||
using Windows.Services.Maps;
|
||||
using Windows.UI.Core;
|
||||
@@ -218,6 +215,18 @@ namespace NavCityBreda.Model
|
||||
}
|
||||
}
|
||||
|
||||
public List<Landmark> GetAllLandmarks()
|
||||
{
|
||||
List<Landmark> l = new List<Landmark>();
|
||||
|
||||
foreach(Route r in _routes)
|
||||
{
|
||||
l.AddRange(r.Landmarks);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
public async Task<String> Reset()
|
||||
{
|
||||
foreach(Route r in _routes)
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.UI.Xaml.Controls.Maps;
|
||||
|
||||
|
||||
@@ -149,12 +149,15 @@
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helpers\BoolToCheckmarkConverter.cs" />
|
||||
<Compile Include="Helpers\BoudingBox.cs" />
|
||||
<Compile Include="Helpers\Comparer\LandmarkAlphaComparer.cs" />
|
||||
<Compile Include="Helpers\Comparer\LandmarkAlphaReversedComparer.cs" />
|
||||
<Compile Include="Helpers\Comparer\LandmarkNotVisitedComparer.cs" />
|
||||
<Compile Include="Helpers\Comparer\LandmarkVisitedComparer.cs" />
|
||||
<Compile Include="Helpers\Converter\BoolToIconConverter.cs" />
|
||||
<Compile Include="Helpers\Extensions.cs" />
|
||||
<Compile Include="Helpers\RouteParser.cs" />
|
||||
<Compile Include="Helpers\Settings.cs" />
|
||||
<Compile Include="Helpers\BoolToVisibilityConverter.cs" />
|
||||
<Compile Include="Helpers\Converter\BoolToVisibilityConverter.cs" />
|
||||
<Compile Include="Helpers\Util.cs" />
|
||||
<Compile Include="InitPage.xaml.cs">
|
||||
<DependentUpon>InitPage.xaml</DependentUpon>
|
||||
@@ -172,6 +175,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\HelpVM.cs" />
|
||||
<Compile Include="ViewModels\LandmarkDetailVM.cs" />
|
||||
<Compile Include="ViewModels\LandmarkVM.cs" />
|
||||
<Compile Include="ViewModels\MapVM.cs" />
|
||||
<Compile Include="ViewModels\MainPageVM.cs" />
|
||||
<Compile Include="ViewModels\RouteDetailVM.cs" />
|
||||
@@ -181,6 +185,9 @@
|
||||
<Compile Include="Views\HelpView.xaml.cs">
|
||||
<DependentUpon>HelpView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LandmarkView.xaml.cs">
|
||||
<DependentUpon>LandmarkView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\MapView.xaml.cs">
|
||||
<DependentUpon>MapView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -262,6 +269,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LandmarkView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\MapView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
{
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
{
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.Helpers.Comparer;
|
||||
using NavCityBreda.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
{
|
||||
class LandmarkVM : TemplateVM
|
||||
{
|
||||
public enum Sort { ALPHA, ALPHA_REVERSE, VISITED, NOT_VISITED }
|
||||
|
||||
private List<Landmark> _landmarks;
|
||||
|
||||
public LandmarkVM() : base(Util.Loader.GetString("Landmarks"))
|
||||
{
|
||||
_landmarks = App.RouteManager.GetAllLandmarks();
|
||||
}
|
||||
|
||||
protected override void UpdatePropertiesToNewLanguage()
|
||||
{
|
||||
NotifyPropertyChanged(nameof(Description));
|
||||
NotifyPropertyChanged(nameof(Landmarks));
|
||||
NotifyPropertyChanged(nameof(LandmarksTitle));
|
||||
|
||||
NotifyPropertyChanged(nameof(Ascending));
|
||||
NotifyPropertyChanged(nameof(Descending));
|
||||
NotifyPropertyChanged(nameof(Visited));
|
||||
NotifyPropertyChanged(nameof(NotVisited));
|
||||
}
|
||||
|
||||
public string SortOrderTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("SortOrder");
|
||||
}
|
||||
}
|
||||
|
||||
public string LandmarksTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("Landmarks");
|
||||
}
|
||||
}
|
||||
|
||||
public string Ascending
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("Ascending");
|
||||
}
|
||||
}
|
||||
|
||||
public string Descending
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("Descending");
|
||||
}
|
||||
}
|
||||
|
||||
public string Visited
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("Visited");
|
||||
}
|
||||
}
|
||||
|
||||
public string NotVisited
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("NotVisited");
|
||||
}
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("LandmarkListDescription");
|
||||
}
|
||||
}
|
||||
|
||||
public List<Landmark> Landmarks
|
||||
{
|
||||
get
|
||||
{
|
||||
return _landmarks;
|
||||
}
|
||||
}
|
||||
|
||||
public void SortList(Sort s)
|
||||
{
|
||||
IComparer<Landmark> comparer;
|
||||
|
||||
switch(s)
|
||||
{
|
||||
default:
|
||||
case Sort.ALPHA:
|
||||
comparer = new LandmarkAlphaComparer();
|
||||
break;
|
||||
case Sort.ALPHA_REVERSE:
|
||||
comparer = new LandmarkAlphaReversedComparer();
|
||||
break;
|
||||
case Sort.VISITED:
|
||||
comparer = new LandmarkVisitedComparer();
|
||||
break;
|
||||
case Sort.NOT_VISITED:
|
||||
comparer = new LandmarkNotVisitedComparer();
|
||||
break;
|
||||
}
|
||||
|
||||
_landmarks.Sort(comparer);
|
||||
_landmarks = new List<Landmark>(_landmarks);
|
||||
|
||||
NotifyPropertyChanged(nameof(Landmarks));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.UI.Core;
|
||||
|
||||
@@ -23,6 +18,7 @@ namespace NavCityBreda.ViewModels
|
||||
NotifyPropertyChanged(nameof(Map));
|
||||
NotifyPropertyChanged(nameof(Help));
|
||||
NotifyPropertyChanged(nameof(Route));
|
||||
NotifyPropertyChanged(nameof(Landmarks));
|
||||
NotifyPropertyChanged(nameof(Settings));
|
||||
NotifyPropertyChanged(nameof(Status));
|
||||
NotifyPropertyChanged(nameof(Source));
|
||||
@@ -64,6 +60,14 @@ namespace NavCityBreda.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string Landmarks
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Loader.GetString("Landmarks");
|
||||
}
|
||||
}
|
||||
|
||||
public string Settings
|
||||
{
|
||||
get
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
using NavCityBreda.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
{
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace NavCityBreda.ViewModels
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
using NavCityBreda.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:NavCityBreda.Views"
|
||||
xmlns:convert="using:NavCityBreda.Helpers"
|
||||
xmlns:convert="using:NavCityBreda.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:BoolToCheckmarkConverter x:Key="BoolConverter"/>
|
||||
<convert:BoolToIconConverter x:Key="BoolConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<ScrollViewer>
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<Page
|
||||
x:Class="NavCityBreda.Views.LandmarkView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:NavCityBreda.Views"
|
||||
xmlns:convert="using:NavCityBreda.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:BoolToIconConverter x:Key="BoolConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Margin="17,10,5,10" Text="{Binding Description}" TextWrapping="WrapWholeWords" Grid.Row="0"/>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="17,10,5,10">
|
||||
<TextBlock Text="{Binding SortOrderTitle}" Style="{StaticResource Header}"/>
|
||||
<RadioButton GroupName="SortMode" Name="AlphaSorted" Checked="Sort_Checked" IsChecked="True" Content="{Binding Ascending}" />
|
||||
<RadioButton GroupName="SortMode" Name="AlphaReverseSorted" Checked="Sort_Checked" Content="{Binding Descending}" />
|
||||
<RadioButton GroupName="SortMode" Name="VisitedSorted" Checked="Sort_Checked" Content="{Binding Visited}" />
|
||||
<RadioButton GroupName="SortMode" Name="NotVisitedSorted" Checked="Sort_Checked" Content="{Binding NotVisited}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Name="LandmarkListPanel" Margin="10">
|
||||
<TextBlock Text="{Binding LandmarksTitle}" Style="{StaticResource Header}"/>
|
||||
<ListView x:Name="LandmarkList" ItemsSource="{Binding Landmarks}" Grid.Row="2" IsItemClickEnabled="True" ItemClick="LandmarkList_ItemClick"
|
||||
ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:Name="ListViewDataTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SymbolIcon Symbol="{Binding Visited, Converter={StaticResource BoolConverter}}" Margin="0,0,10,0"/>
|
||||
<TextBlock Text="{Binding Name}" FontSize="18"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Page>
|
||||
@@ -0,0 +1,37 @@
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.ViewModels;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace NavCityBreda.Views
|
||||
{
|
||||
public sealed partial class LandmarkView : Page
|
||||
{
|
||||
LandmarkVM landmarkvm;
|
||||
|
||||
public LandmarkView()
|
||||
{
|
||||
landmarkvm = new LandmarkVM();
|
||||
this.DataContext = landmarkvm;
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
private void LandmarkList_ItemClick(object sender, ItemClickEventArgs e)
|
||||
{
|
||||
MainPage mp = App.MainPage;
|
||||
mp.Navigate(typeof(LandmarkDetailView), e.ClickedItem as Landmark);
|
||||
}
|
||||
|
||||
private void Sort_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if ((bool)AlphaSorted.IsChecked)
|
||||
landmarkvm.SortList(LandmarkVM.Sort.ALPHA);
|
||||
else if ((bool)AlphaReverseSorted.IsChecked)
|
||||
landmarkvm.SortList(LandmarkVM.Sort.ALPHA_REVERSE);
|
||||
else if ((bool)VisitedSorted.IsChecked)
|
||||
landmarkvm.SortList(LandmarkVM.Sort.VISITED);
|
||||
else if ((bool)NotVisitedSorted.IsChecked)
|
||||
landmarkvm.SortList(LandmarkVM.Sort.NOT_VISITED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:NavCityBreda.Views"
|
||||
xmlns:convert="using:NavCityBreda.Helpers"
|
||||
xmlns:convert="using:NavCityBreda.Helpers.Converter"
|
||||
xmlns:map="using:Windows.UI.Xaml.Controls.Maps"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
using NavCityBreda.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.UI.Xaml.Controls.Maps;
|
||||
using NavCityBreda.Model;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.Popups;
|
||||
using System.Diagnostics;
|
||||
using NavCityBreda.Helpers;
|
||||
using Windows.UI;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage;
|
||||
using Windows.Devices.Geolocation.Geofencing;
|
||||
using Windows.UI.Core;
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:NavCityBreda.Views"
|
||||
xmlns:model="using:NavCityBreda.Model"
|
||||
xmlns:convert="using:NavCityBreda.Helpers"
|
||||
xmlns:convert="using:NavCityBreda.Helpers.Converter"
|
||||
xmlns:map="using:Windows.UI.Xaml.Controls.Maps"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<convert:BoolToCheckmarkConverter x:Key="BoolConverter"/>
|
||||
<convert:BoolToIconConverter x:Key="BoolConverter"/>
|
||||
<convert:BoolToVisibilityConverter x:Key="VisConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
|
||||
@@ -2,23 +2,11 @@
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Maps;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer>
|
||||
<Grid Grid.Row="2" Name="RouteListPanel">
|
||||
<Grid Name="RouteListPanel">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.Model;
|
||||
using NavCityBreda.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
using NavCityBreda.Helpers;
|
||||
using NavCityBreda.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
Reference in New Issue
Block a user