Browse Source

Routeselect aangepast

guusvdongen 10 years ago
parent
commit
1f9c1f933a

+ 8 - 0
Breda-Tour/Breda-Tour.csproj

@@ -119,6 +119,10 @@
       <DependentUpon>MainPage.xaml</DependentUpon>
       <DependentUpon>MainPage.xaml</DependentUpon>
     </Compile>
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="RouteSelectScreen\Converter.cs" />
+    <Compile Include="RouteSelectScreen\RouteExample.xaml.cs">
+      <DependentUpon>RouteExample.xaml</DependentUpon>
+    </Compile>
     <Compile Include="RouteSelectScreen\RouteSelectPage.xaml.cs">
     <Compile Include="RouteSelectScreen\RouteSelectPage.xaml.cs">
       <DependentUpon>RouteSelectPage.xaml</DependentUpon>
       <DependentUpon>RouteSelectPage.xaml</DependentUpon>
     </Compile>
     </Compile>
@@ -167,6 +171,10 @@
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
     </Page>
     </Page>
+    <Page Include="RouteSelectScreen\RouteExample.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="RouteSelectScreen\RouteSelectPage.xaml">
     <Page Include="RouteSelectScreen\RouteSelectPage.xaml">
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>

+ 8 - 9
Breda-Tour/Data/RouteDatabase.cs

@@ -9,7 +9,7 @@ namespace Breda_Tour.Data
 {
 {
     class RouteDatabase
     class RouteDatabase
     {
     {
-        private List<Route> Routes;
+        public List<Route> Routes;
         
         
         public RouteDatabase()
         public RouteDatabase()
         {
         {
@@ -19,15 +19,14 @@ namespace Breda_Tour.Data
 
 
         private void readRoutes()
         private void readRoutes()
         {
         {
-            Task.Run(() =>
+
+            string json = File.ReadAllText("Storage/Routes/routes.json");
+            JObject JsonObject = JObject.Parse(json);
+            IList<JToken> JsonList = JsonObject["Routes"].ToList();
+            foreach (JToken route in JsonList)
             {
             {
-                string json = File.ReadAllText("Storage/Routes/routes.json");
-                JObject JsonObject = JObject.Parse(json);
-                IList<JToken> JsonList = JsonObject["Routes"].ToList();
-                foreach (JToken route in JsonList){
-                   Routes.Add(JsonConvert.DeserializeObject<Route>(route.ToString()));
-                }
-        });
+                Routes.Add(JsonConvert.DeserializeObject<Route>(route.ToString()));
+            }
         }
         }
     }
     }
 }
 }

+ 2 - 2
Breda-Tour/Data/waypoint.cs

@@ -22,7 +22,7 @@ namespace Breda_Tour.Data
             this.Photos = new List<Image>();
             this.Photos = new List<Image>();
             if (pictures != null)
             if (pictures != null)
             {
             {
-                Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+                /*Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                 {
                 {
                     foreach (string source in pictures)
                     foreach (string source in pictures)
                     {
                     {
@@ -32,7 +32,7 @@ namespace Breda_Tour.Data
                             Name = source
                             Name = source
                         });
                         });
                     }
                     }
-                });
+                });*/
             }
             }
         }
         }
     }
     }

+ 3 - 3
Breda-Tour/RouteSelectScreen/RouteExample.xaml.cs

@@ -37,9 +37,9 @@ namespace Breda_Tour.RouteSelectScreen
             route = e.Parameter as Route;
             route = e.Parameter as Route;
             Waypoints = "Aantal waypoints: " + 0;
             Waypoints = "Aantal waypoints: " + 0;
             this.DataContext = route;
             this.DataContext = route;
-            //if (route.Waypoints.Count != 0){
-              //  waypoints = route.Waypoints.Count;
-            //}
+            if (route.Waypoints.Count != 0){
+                Waypoints = "Aantal waypoints: " +route.Waypoints.Count;
+            }
         }
         }
     }
     }
 }
 }

+ 24 - 1
Breda-Tour/RouteSelectScreen/RouteSelectPage.xaml

@@ -6,8 +6,11 @@
     xmlns:c="using:Breda_Tour.CustomControls"
     xmlns:c="using:Breda_Tour.CustomControls"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:data="using:Breda_Tour.Data"
+    xmlns:con="using:Breda_Tour.RouteSelectScreen"
     mc:Ignorable="d">
     mc:Ignorable="d">
 
 
+
     <Grid>
     <Grid>
         <Grid.RowDefinitions>
         <Grid.RowDefinitions>
             <RowDefinition Height="40"/>
             <RowDefinition Height="40"/>
@@ -16,6 +19,26 @@
         </Grid.RowDefinitions>
         </Grid.RowDefinitions>
         <c:DefaultTopBar Header="Route Selecteren"/>
         <c:DefaultTopBar Header="Route Selecteren"/>
         <c:DefaultPivotControl x:Name="DefaultPivot" Grid.Row="1"/>
         <c:DefaultPivotControl x:Name="DefaultPivot" Grid.Row="1"/>
-        
+        <RelativePanel Grid.Row="2" Margin="0,5">
+            <RelativePanel.Resources>
+                <con:Converter x:Key="BoolToVis"/>
+            </RelativePanel.Resources>
+            <ListView x:Name="Routes" ItemsSource="{x:Bind AllRoutes.Routes}" IsItemClickEnabled="True" ItemClick="Routes_ItemClick">
+                <ListView.ItemTemplate>
+                    <DataTemplate x:DataType="data:Route">
+                        <StackPanel>
+                            <StackPanel Orientation="Horizontal" Width="340">
+                                <TextBlock Text="{Binding Title}" FontSize="24"/>
+                                <ToggleButton x:Name="toggleButton" Content="" IsChecked="False"/>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Width="340" Visibility="{Binding Path=IsChecked, ElementName=toggleButton,Converter={StaticResource BoolToVis}}">
+                                <TextBlock Text="Breda" FontSize="16"/>      
+                            </StackPanel>
+                        </StackPanel>
+                        
+                    </DataTemplate>
+                </ListView.ItemTemplate>
+            </ListView>
+        </RelativePanel>
     </Grid>
     </Grid>
 </Page>
 </Page>

+ 11 - 1
Breda-Tour/RouteSelectScreen/RouteSelectPage.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using Breda_Tour.Data;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
@@ -22,10 +23,19 @@ namespace Breda_Tour.RouteSelectScreen
     /// </summary>
     /// </summary>
     public sealed partial class RouteSelectPage : Page
     public sealed partial class RouteSelectPage : Page
     {
     {
+        RouteDatabase AllRoutes;
         public RouteSelectPage()
         public RouteSelectPage()
         {
         {
+            AllRoutes = new RouteDatabase();
             this.InitializeComponent();
             this.InitializeComponent();
             DefaultPivot.SetCheckedButton(CustomControls.DefaultPivotControl.Tab.RouteSelected);
             DefaultPivot.SetCheckedButton(CustomControls.DefaultPivotControl.Tab.RouteSelected);
         }
         }
+
+        private void Routes_ItemClick(object sender, ItemClickEventArgs e)
+        {
+            Route route = e.ClickedItem as Route;
+            Frame frame = Window.Current.Content as Frame;
+            frame.Navigate(typeof(RouteExample), route);
+        }
     }
     }
 }
 }