Pārlūkot izejas kodu

Added data classes for help items

jancoow 10 gadi atpakaļ
vecāks
revīzija
a377c8e24f

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

@@ -97,11 +97,17 @@
     <Content Include="Storage\Routes\routes.json">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
+    <Content Include="Storage\helpitems\helpitems.json">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="App.xaml.cs">
       <DependentUpon>App.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Data\HelpItem.cs" />
+    <Compile Include="Data\HelpItemStep.cs" />
+    <Compile Include="Data\HelpPageDatabase.cs" />
     <Compile Include="Data\Route.cs" />
     <Compile Include="Data\RouteDatabase.cs" />
     <Compile Include="Data\Waypoint.cs" />

+ 22 - 0
Breda-Tour/Data/HelpItem.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Breda_Tour.Data
+{
+    class HelpItem
+    {
+        public string Title { get; private set; }
+        public string Language { get; private set; }
+        public List<HelpItemStep> HelpItemSteps { get; private set; }
+
+        public HelpItem(string Language, string Title, List<HelpItemStep> Steps)
+        {
+            this.Language = Language;
+            this.Title = Title;
+            this.HelpItemSteps = Steps;
+        }
+    }
+}

+ 23 - 0
Breda-Tour/Data/HelpItemStep.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Breda_Tour.Data
+{
+    class HelpItemStep
+    {
+        public string Title { get; private set; }
+        public string Description { get; private set; }
+        public string ImageSource { get; private set; }
+
+        public HelpItemStep(string Title, string Description, string Imagesource)
+        {
+            this.Title = Title;
+            this.Description = Description;
+            this.ImageSource = ImageSource;
+        }
+
+    }
+}

+ 38 - 0
Breda-Tour/Data/HelpPageDatabase.cs

@@ -0,0 +1,38 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Breda_Tour.Data
+{ 
+
+    class HelpPageDatabase
+    {
+        private List<HelpItem> HelpItems;
+        public HelpPageDatabase()
+        {
+            HelpItems = new List<HelpItem>();
+            readHelpItems();
+
+        }
+        private void readHelpItems()
+        {
+            Task.Run(() =>
+            {
+                string json = File.ReadAllText("Storage/helpitems/helpitems.json");
+                JObject JsonObject = JObject.Parse(json);
+                IList<JToken> JsonList = JsonObject["HelpItems"].ToList();
+                foreach (JToken helpitem in JsonList)
+                {
+                    HelpItems.Add(JsonConvert.DeserializeObject<HelpItem>(helpitem.ToString()));
+                }
+                System.Diagnostics.Debug.WriteLine(HelpItems[0].HelpItemSteps[0].Title);
+
+            });
+        }
+    }
+}

+ 21 - 0
Breda-Tour/Storage/helpitems/helpitems.json

@@ -0,0 +1,21 @@
+{
+  "HelpItems": [
+        {
+            "Language" : "NL_nl",
+            "Title" : "Taal selecteren",
+            "Steps" : 
+            [
+                {
+                    "Title":"Druk op settings",
+                    "Description":"Jemoeder",
+                    "ImageSource" :"1.jpg"
+                },
+                {
+                    "Title":"Druk op settings",
+                    "Description":"Jemoeder",
+                    "ImageSource" :"1.jpg"
+                }
+            ] 
+        },
+    ]
+}