diff --git a/.gitignore b/.gitignore
index fdb60427..93784e2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -164,3 +164,31 @@ screenshots/
CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/sl3-wp/Microsoft.Phone.Controls.Toolkit.dll
CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/sl4-windowsphone71/Microsoft.Phone.Controls.Toolkit.dll
CampusAppWP8/packages/WPtoolkit.4.2012.10.30/lib/wp8/Microsoft.Phone.Controls.Toolkit.dll
+CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/BuiltToRoam.Core.Agent.1.0.1.5.nupkg
+CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/BuiltToRoam.Core.Agent.1.0.1.5.nuspec
+CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/lib/sl4-wp71/AsyncCtpLibrary_Phone.dll
+CampusAppWP8/packages/BuiltToRoam.Core.Agent.1.0.1.5/lib/sl4-wp71/BuiltToRoam.Core.Agent.dll
+CampusAppWP8/packages/BuiltToRoam.GeoWatcher.1.0.1.5/BuiltToRoam.GeoWatcher.1.0.1.5.nupkg
+CampusAppWP8/packages/BuiltToRoam.GeoWatcher.1.0.1.5/BuiltToRoam.GeoWatcher.1.0.1.5.nuspec
+CampusAppWP8/packages/BuiltToRoam.GeoWatcher.1.0.1.5/lib/sl4-wp71/BuiltToRoam.GeoWatcher.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.xml
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll
+CampusAppWP8/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.xml
+CampusAppWP8/packages/SharpZipLib-WP7.0.86.0.518/SharpZipLib-WP7.0.86.0.518.nupkg
+CampusAppWP8/packages/SharpZipLib-WP7.0.86.0.518/SharpZipLib-WP7.0.86.0.518.nuspec
+CampusAppWP8/packages/SharpZipLib-WP7.0.86.0.518/lib/sl4-windowsphone71/SharpZipLib.WindowsPhone7.dll
diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs
new file mode 100644
index 00000000..3dcff447
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs
@@ -0,0 +1,27 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 06.08.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Feed.GeoApi
+{
+ using CampusAppWP8.Model;
+ using CampusAppWP8.Model.GeoDb;
+ using CampusAppWP8.Resources;
+
+ ///
+ /// Class for SPSAPI
+ ///
+ public class SpsApi : XmlModel
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public SpsApi()
+ : base(ModelType.Feed, Constants.UrlSpsService)
+ {
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/App.xaml.cs b/CampusAppWP8/CampusAppWP8/App.xaml.cs
index 9d7a8955..46d1bfa0 100644
--- a/CampusAppWP8/CampusAppWP8/App.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/App.xaml.cs
@@ -1,15 +1,18 @@
-using System;
+using CampusAppWP8.File.Setting;
+using CampusAppWP8.Model.Setting;
+using CampusAppWP8.Resources;
+using CampusAppWP8.Utility;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+using System;
using System.Diagnostics;
-using System.Resources;
+using System.Globalization;
+using System.IO.IsolatedStorage;
+using System.Threading;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Navigation;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Shell;
-using CampusAppWP8.Resources;
-using System.IO.IsolatedStorage;
-using CampusAppWP8.File.Setting;
-using CampusAppWP8.Model.Setting;
+using Windows.Devices.Geolocation;
namespace CampusAppWP8
@@ -127,6 +130,7 @@ namespace CampusAppWP8
}
return default(T);
}
+
// Code, der beim Starten der Anwendung ausgeführt werden soll (z. B. über "Start")
// Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt
private void Application_Launching(object sender, LaunchingEventArgs e)
@@ -134,6 +138,9 @@ namespace CampusAppWP8
this.LoadSettings();
}
+ ///
+ /// Load the appsettings from the store
+ ///
private void LoadSettings()
{
UserProfilFile userFile;
@@ -147,7 +154,14 @@ namespace CampusAppWP8
{
this.UserSettingsLoaded();
}
+
+ Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
+ thread.Start();
}
+
+ ///
+ /// Load the usersettings from the store
+ ///
private void UserSettingsLoaded()
{
if (Settings.UserProfil.Model == null)
@@ -161,6 +175,7 @@ namespace CampusAppWP8
private void Application_Activated(object sender, ActivatedEventArgs e)
{
this.LoadSettings();
+
}
// Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird)
diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index cc5f5a59..bc1fd99d 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -93,16 +93,21 @@
4
+
App.xaml
+
+
+
+
@@ -420,10 +425,25 @@
+
+ ..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\AsyncCtpLibrary_Phone.dll
+
+
+ ..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\BuiltToRoam.Core.Agent.dll
+
+
+ ..\packages\BuiltToRoam.GeoWatcher.1.0.1.5\lib\sl4-wp71\BuiltToRoam.GeoWatcher.dll
+
..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll
+
+ ..\packages\Newtonsoft.Json.4.5.11\lib\sl4-windowsphone71\Newtonsoft.Json.dll
+
+
+ ..\packages\SharpZipLib-WP7.0.86.0.518\lib\sl4-windowsphone71\SharpZipLib.WindowsPhone7.dll
+
diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs
new file mode 100644
index 00000000..68acbbbe
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs
@@ -0,0 +1,36 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 08.08.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.Model.GeoDb
+{
+ using System.Xml.Serialization;
+
+ ///
+ /// Model for a place of the SPSService
+ ///
+ public class PlaceModel
+ {
+ ///
+ /// Gets or sets the placeId
+ ///
+ [XmlAttribute("id")]
+ public string PlaceId { get; set; }
+
+ ///
+ /// Gets or sets the id of the "parent" of a place
+ ///
+ [XmlAttribute("parentId")]
+ public string ParentId { get; set; }
+
+ ///
+ /// Gets or sets the ReferencePoint of a place
+ ///
+ [XmlAttribute("refpoint")]
+ public string RefPoint { get; set; }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs
new file mode 100644
index 00000000..0b4fea86
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs
@@ -0,0 +1,26 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 08.08.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.Model.GeoDb
+{
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ ///
+ /// Model for a xml-response of the SPSService
+ ///
+ [XmlRoot("root")]
+ public class SpsModel
+ {
+ ///
+ /// Gets or sets a list of places
+ ///
+ [XmlElement("place")]
+ public ObservableCollection Places { get; set; }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs
index 1451075b..11cedc69 100644
--- a/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/Mensa/MenuWeekModel.cs
@@ -24,8 +24,8 @@ namespace CampusAppWP8.Model.Mensa
private readonly DateTime createTime;
#endregion
-
- #region Constructor
+
+ #region Constructor
///
/// Initializes a new instance of the class.
@@ -49,16 +49,16 @@ namespace CampusAppWP8.Model.Mensa
///
/// Gets the creation time of the model
///
- public DateTime CreateTime
- {
- get
- {
+ public DateTime CreateTime
+ {
+ get
+ {
return this.createTime;
- }
+ }
}
#endregion
-
+
#region Methods
///
diff --git a/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs
new file mode 100644
index 00000000..aadf0ad0
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/Setting/AppSettings.cs
@@ -0,0 +1,50 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 08.08.2013
+//----------------------------------------------------------------------
+
+namespace CampusAppWP8.Model.Setting
+{
+ using CampusAppWP8.Resources;
+
+ ///
+ /// Model for settings of the app
+ ///
+ public class AppSettings
+ {
+ ///
+ /// Gets or sets a value indicating whether the GeoWatch-Flag
+ ///
+ public bool GeoWatchEnable
+ {
+ get
+ {
+ return App.LoadFromAppState(Constants.AppSetting_GeoWatchEnable);
+ }
+
+ set
+ {
+ App.SaveToAppState(Constants.AppSetting_GeoWatchEnable, value);
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the InitializationApp-Flag
+ ///
+ public bool InitApp
+ {
+ get
+ {
+ return App.LoadFromAppState(Constants.AppSetting_GeoWatchEnable);
+ }
+
+ set
+ {
+ App.SaveToAppState(Constants.AppSetting_GeoWatchEnable, value);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/CleanUrlParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/CleanUrlParamModel.cs
new file mode 100644
index 00000000..46d2211c
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Model/Utility/CleanUrlParamModel.cs
@@ -0,0 +1,67 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 06.08.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Model.Utility
+{
+ ///
+ /// This class is a Model for the URLParameter like GET-Parameter
+ ///
+ public class CleanUrlParamModel:UrlParamModel
+ {
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// the key for the parameter
+ public CleanUrlParamModel(string key) :base(key)
+ {
+
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// the key for the parameter>
+ /// value of the parameter
+ public CleanUrlParamModel(string key, string value) : base(key,value)
+ {
+ }
+ #endregion
+
+ #region Proberty
+
+ ///
+ /// Gets the token, which indicate that the parameterList started
+ ///
+ public override string ParamToken
+ {
+ get
+ {
+ return string.Empty;
+ }
+ }
+ #endregion
+
+ #region Methods
+
+ ///
+ /// Method return a formatted string like Key=Value
+ ///
+ /// return formatted string
+ public override string ToString()
+ {
+ if (!this.IsParamValid())
+ {
+ return string.Empty;
+ }
+
+ return "/" + this.key + "/" + this.Value;
+ }
+ #endregion
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs
index a439e875..8f3a6b47 100644
--- a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs
+++ b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs
@@ -17,7 +17,7 @@ namespace CampusAppWP8.Model.Utility
///
/// Variable of the key
///
- private readonly string key;
+ protected readonly string key;
#endregion
@@ -65,7 +65,7 @@ namespace CampusAppWP8.Model.Utility
///
/// Gets the token, which indicate that the parameterList started
///
- public string ParamToken
+ public virtual string ParamToken
{
get
{
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
index 46d5f76d..f415ccc9 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs
@@ -24,6 +24,8 @@ namespace CampusAppWP8.Pages.Mensa
///
private MensaFeed feed;
+ // private SpsApi spsApi;
+
///
/// Index representing the weekday of today
/// 0 - Monday(Default)
@@ -72,8 +74,32 @@ namespace CampusAppWP8.Pages.Mensa
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.LoadData();
+
+ // this.determinCurrentPosition();
}
+/* need for later feature (#147)
+ private void determinCurrentPosition()
+ {
+ Utilities.DetermineAndStoreCurrentPosition();
+ string lat = App.LoadFromAppState("CurrentPosition.Lat");
+ string log = App.LoadFromAppState("CurrentPosition.Long");
+
+ this.spsApi = new SpsApi();
+ this.spsApi.onLoaded += new SpsApi.OnLoaded(this.ApiIsReady);
+ List parameterList = new List();
+ parameterList.Add(new CleanUrlParamModel("latitude", lat));
+ parameterList.Add(new CleanUrlParamModel("longitude", log));
+ parameterList.Add(new CleanUrlParamModel("domain", "3"));
+ this.spsApi.SetUriParams(parameterList);
+ this.spsApi.LoadData();
+ }
+
+ private void ApiIsReady()
+ {
+ string i = this.spsApi.Model.Places[0].PlaceId;
+ }*/
+
///
/// Override the OnNavigatedFrom method
///
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
index c6f84e3c..9835260f 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
@@ -12,6 +12,7 @@ namespace CampusAppWP8.Pages
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Resources;
+ using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
@@ -31,6 +32,12 @@ namespace CampusAppWP8.Pages
{
menuItem1.Text = AppResources.Setting_UserProfilAppBarTitle;
}
+
+ if (Settings.AppSetting.InitApp)
+ {
+ this.ShowOptIns();
+ Settings.AppSetting.InitApp = true;
+ }
}
///
@@ -57,8 +64,8 @@ namespace CampusAppWP8.Pages
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title;
ContentPanel.RowDefinitions[3].Height = GridLength.Auto;
- ContentPanel.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star);
- }
+ ContentPanel.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star);
+ }
else
{
// If not in portrait, move buttonList content to visible row and column.
@@ -75,17 +82,27 @@ namespace CampusAppWP8.Pages
HomeworkAppButtonText.Text = AppResources.HomeworkApp_Title2;
- ContentPanel.RowDefinitions[3].Height = new GridLength(1,GridUnitType.Star);
+ ContentPanel.RowDefinitions[3].Height = new GridLength(1, GridUnitType.Star);
ContentPanel.ColumnDefinitions[3].Width = GridLength.Auto;
}
}
+ ///
+ /// Method Navigate to
+ ///
+ /// Caller of the function
+ /// some EventArgs
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
{
Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative);
NavigationService.Navigate(url);
}
+ ///
+ /// Method change the Opacity of the ApplicationBar
+ ///
+ /// Caller of the function
+ /// some EventArgs
private void ApplicationBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e)
{
if (e.IsMenuVisible)
@@ -97,5 +114,31 @@ namespace CampusAppWP8.Pages
ApplicationBar.Opacity = 0.5;
}
}
+
+ ///
+ /// Method show all OptIns
+ ///
+ private void ShowOptIns()
+ {
+ this.GeoWatchOptIN();
+ }
+
+ ///
+ /// Method show the GeoWatchOptIn in a MessageBox
+ ///
+ private void GeoWatchOptIN()
+ {
+ MessageBoxResult result = MessageBox.Show(AppResources.GeoWatch_OptInText, AppResources.GeoWatch_OptInHeader, MessageBoxButton.OKCancel);
+
+ if (result == MessageBoxResult.OK)
+ {
+ Settings.AppSetting.GeoWatchEnable = true;
+ Utilities.DetermineAndStoreCurrentPosition();
+ }
+ else
+ {
+ Settings.AppSetting.GeoWatchEnable = false;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index e9372b2d..b2d6dccd 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -204,6 +204,24 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Ortung ähnelt.
+ ///
+ public static string GeoWatch_OptInHeader {
+ get {
+ return ResourceManager.GetString("GeoWatch_OptInHeader", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Dürfen Positionsdaten enhober und verwendet werdet? ähnelt.
+ ///
+ public static string GeoWatch_OptInText {
+ get {
+ return ResourceManager.GetString("GeoWatch_OptInText", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index af5596e0..4677210c 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -359,4 +359,10 @@
Suppe
+
+ Ortung
+
+
+ Dürfen Positionsdaten enhober und verwendet werdet?
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
index 1b6ef17d..950c81cb 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.Designer.cs
@@ -60,6 +60,24 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die AppSetting.GeoWatchEnable ähnelt.
+ ///
+ public static string AppSetting_GeoWatchEnable {
+ get {
+ return ResourceManager.GetString("AppSetting_GeoWatchEnable", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die AppSetting.InitApp ähnelt.
+ ///
+ public static string AppSetting_InitApp {
+ get {
+ return ResourceManager.GetString("AppSetting_InitApp", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
///
@@ -150,6 +168,33 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Lat ähnelt.
+ ///
+ public static string GeoWatch_CurrentPosition_Lat {
+ get {
+ return ResourceManager.GetString("GeoWatch_CurrentPosition_Lat", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Long ähnelt.
+ ///
+ public static string GeoWatch_CurrentPosition_Long {
+ get {
+ return ResourceManager.GetString("GeoWatch_CurrentPosition_Long", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Time ähnelt.
+ ///
+ public static string GeoWatch_CurrentPosition_Time {
+ get {
+ return ResourceManager.GetString("GeoWatch_CurrentPosition_Time", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_DepartmentFavoriteModel ähnelt.
///
@@ -654,6 +699,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die http://141.43.76.140/service/sps ähnelt.
+ ///
+ public static string UrlSpsService {
+ get {
+ return ResourceManager.GetString("UrlSpsService", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&app=2&appversion=1 ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
index 8520e922..99e8808a 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/Constants.resx
@@ -333,4 +333,22 @@
WILD
+
+ AppSetting.GeoWatchEnable
+
+
+ AppSetting.InitApp
+
+
+ CurrentPosition.Lat
+
+
+ CurrentPosition.Long
+
+
+ CurrentPosition.Time
+
+
+ http://141.43.76.140/service/sps
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Settings.cs b/CampusAppWP8/CampusAppWP8/Settings.cs
index efb0f5b6..3e22f380 100644
--- a/CampusAppWP8/CampusAppWP8/Settings.cs
+++ b/CampusAppWP8/CampusAppWP8/Settings.cs
@@ -9,6 +9,7 @@
namespace CampusAppWP8
{
using CampusAppWP8.File.Setting;
+ using CampusAppWP8.Model.Setting;
///
/// Class handle all setting (files)
@@ -20,6 +21,11 @@ namespace CampusAppWP8
///
private static UserProfilFile userProfil = new UserProfilFile();
+ ///
+ /// reference of the appSettings
+ ///
+ private static AppSettings appSetting = new AppSettings();
+
///
/// Gets or sets the user-profile-file
///
@@ -38,5 +44,24 @@ namespace CampusAppWP8
}
}
}
+
+ ///
+ /// Gets or sets the AppSetting
+ ///
+ public static AppSettings AppSetting
+ {
+ get
+ {
+ return Settings.appSetting;
+ }
+
+ set
+ {
+ if (value != Settings.appSetting)
+ {
+ Settings.appSetting = value;
+ }
+ }
+ }
}
}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
index 243929ed..70fe8fdd 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs
@@ -9,10 +9,13 @@ namespace CampusAppWP8.Utility
{
using System;
using System.Collections.Generic;
+ using System.Device.Location;
+ using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
+ using CampusAppWP8.Resources;
///
/// Collection of utility functions.
@@ -191,5 +194,74 @@ namespace CampusAppWP8.Utility
return retValue;
}
+
+ ///
+ /// Method determine the current position of the phone
+ ///
+ /// accuracy of the position in meters
+ /// the position of the phone
+ public static GeoPosition DetermineCurrentPosition(uint accuracy = 50)
+ {
+ if (!Settings.AppSetting.GeoWatchEnable)
+ {
+ return null;
+ }
+
+ GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
+ bool success = watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
+ GeoPosition geoposition = null;
+ if (success)
+ {
+ geoposition = watcher.Position;
+ }
+
+ watcher.Stop();
+ return geoposition;
+ }
+
+ ///
+ /// Method determine and store the current position of the phone
+ ///
+ public static void DetermineAndStoreCurrentPositionForce()
+ {
+ GeoPosition geoposition = Utilities.DetermineCurrentPosition();
+ if (geoposition != null)
+ {
+ string lat = geoposition.Location.Latitude.ToString(CultureInfo.InvariantCulture);
+ string log = geoposition.Location.Longitude.ToString(CultureInfo.InvariantCulture);
+ string time = geoposition.Timestamp.Ticks.ToString();
+ App.SaveToAppState(Constants.GeoWatch_CurrentPosition_Lat, lat);
+ App.SaveToAppState(Constants.GeoWatch_CurrentPosition_Long, log);
+ App.SaveToAppState(Constants.GeoWatch_CurrentPosition_Time, time);
+ }
+ }
+
+ ///
+ /// Method determine and store the current position of the phone, in 15 min interval
+ ///
+ public static void DetermineAndStoreCurrentPosition()
+ {
+ string lat = App.LoadFromAppState(Constants.GeoWatch_CurrentPosition_Lat);
+ string log = App.LoadFromAppState(Constants.GeoWatch_CurrentPosition_Long);
+ string time = App.LoadFromAppState(Constants.GeoWatch_CurrentPosition_Time);
+ if (lat == null || log == null || time == null || lat.Equals(string.Empty) || log.Equals(string.Empty) || time.Equals(string.Empty))
+ {
+ Utilities.DetermineAndStoreCurrentPositionForce();
+ }
+ else
+ {
+ long longTime = 0;
+ if (!long.TryParse(time, out longTime))
+ {
+ return;
+ }
+
+ DateTime expired = new DateTime(longTime).AddMinutes(15);
+ if (DateTime.Now.Ticks > expired.Ticks)
+ {
+ Utilities.DetermineAndStoreCurrentPositionForce();
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/packages.config b/CampusAppWP8/CampusAppWP8/packages.config
index a6c4d07d..dbbe5283 100644
--- a/CampusAppWP8/CampusAppWP8/packages.config
+++ b/CampusAppWP8/CampusAppWP8/packages.config
@@ -1,4 +1,8 @@
+
+
+
+
\ No newline at end of file