Merge branch 'release/r#141' into develmaster

This commit is contained in:
stubbfel
2013-08-08 13:56:34 +02:00
19 changed files with 556 additions and 21 deletions

28
.gitignore vendored
View File

@@ -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

View File

@@ -0,0 +1,27 @@
//-----------------------------------------------------------------------
// <copyright file="SpsApi.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>06.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Feed.GeoApi
{
using CampusAppWP8.Model;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
/// <summary>
/// Class for SPSAPI
/// </summary>
public class SpsApi : XmlModel<SpsModel>
{
/// <summary>
/// Initializes a new instance of the <see cref="SpsApi" /> class.
/// </summary>
public SpsApi()
: base(ModelType.Feed, Constants.UrlSpsService)
{
}
}
}

View File

@@ -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();
}
/// <summary>
/// Load the appsettings from the store
/// </summary>
private void LoadSettings()
{
UserProfilFile userFile;
@@ -147,7 +154,14 @@ namespace CampusAppWP8
{
this.UserSettingsLoaded();
}
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
thread.Start();
}
/// <summary>
/// Load the usersettings from the store
/// </summary>
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)

View File

@@ -93,16 +93,21 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Api\GeoApi\SpsApi.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Feed\Departments\DepartmentFavoriteFeed.cs" />
<Compile Include="Const.cs" />
<Compile Include="File\Setting\UserProfilFile.cs" />
<Compile Include="Model\GeoDb\PlaceModel.cs" />
<Compile Include="Model\GeoDb\SpsModel.cs" />
<Compile Include="Model\Mensa\MealModel.cs" />
<Compile Include="Model\Setting\AppSettings.cs" />
<Compile Include="Model\Setting\UserProfilModel.cs" />
<Compile Include="Model\Utility\CourseListPickerItemListModel.cs" />
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
<Compile Include="Model\Utility\RoleListPickerItemListModel.cs" />
<Compile Include="Model\Utility\SemesterListPickerItemListModel.cs" />
<Compile Include="Model\Utility\ListPickerItemListModel.cs" />
@@ -420,10 +425,25 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Reference Include="AsyncCtpLibrary_Phone">
<HintPath>..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\AsyncCtpLibrary_Phone.dll</HintPath>
</Reference>
<Reference Include="BuiltToRoam.Core.Agent">
<HintPath>..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\BuiltToRoam.Core.Agent.dll</HintPath>
</Reference>
<Reference Include="BuiltToRoam.GeoWatcher">
<HintPath>..\packages\BuiltToRoam.GeoWatcher.1.0.1.5\lib\sl4-wp71\BuiltToRoam.GeoWatcher.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Phone.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Phone.Controls.Toolkit">
<HintPath>..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\sl4-windowsphone71\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpZipLib.WindowsPhone7">
<HintPath>..\packages\SharpZipLib-WP7.0.86.0.518\lib\sl4-windowsphone71\SharpZipLib.WindowsPhone7.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />

View File

@@ -0,0 +1,36 @@
//-----------------------------------------------------------------------
// <copyright file="PlaceModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>08.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
{
using System.Xml.Serialization;
/// <summary>
/// Model for a place of the SPSService
/// </summary>
public class PlaceModel
{
/// <summary>
/// Gets or sets the placeId
/// </summary>
[XmlAttribute("id")]
public string PlaceId { get; set; }
/// <summary>
/// Gets or sets the id of the "parent" of a place
/// </summary>
[XmlAttribute("parentId")]
public string ParentId { get; set; }
/// <summary>
/// Gets or sets the ReferencePoint of a place
/// </summary>
[XmlAttribute("refpoint")]
public string RefPoint { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
//-----------------------------------------------------------------------
// <copyright file="SpsModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>08.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
{
using System.Collections.ObjectModel;
using System.Xml.Serialization;
/// <summary>
/// Model for a xml-response of the SPSService
/// </summary>
[XmlRoot("root")]
public class SpsModel
{
/// <summary>
/// Gets or sets a list of places
/// </summary>
[XmlElement("place")]
public ObservableCollection<PlaceModel> Places { get; set; }
}
}

View File

@@ -24,8 +24,8 @@ namespace CampusAppWP8.Model.Mensa
private readonly DateTime createTime;
#endregion
#region Constructor
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="MenuWeekModel" /> class.
@@ -49,16 +49,16 @@ namespace CampusAppWP8.Model.Mensa
/// <summary>
/// Gets the creation time of the model
/// </summary>
public DateTime CreateTime
{
get
{
public DateTime CreateTime
{
get
{
return this.createTime;
}
}
}
#endregion
#region Methods
/// <summary>

View File

@@ -0,0 +1,50 @@
//-----------------------------------------------------------------------
// <copyright file="AppSettings.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>08.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Setting
{
using CampusAppWP8.Resources;
/// <summary>
/// Model for settings of the app
/// </summary>
public class AppSettings
{
/// <summary>
/// Gets or sets a value indicating whether the GeoWatch-Flag
/// </summary>
public bool GeoWatchEnable
{
get
{
return App.LoadFromAppState<bool>(Constants.AppSetting_GeoWatchEnable);
}
set
{
App.SaveToAppState<bool>(Constants.AppSetting_GeoWatchEnable, value);
}
}
/// <summary>
/// Gets or sets a value indicating whether the InitializationApp-Flag
/// </summary>
public bool InitApp
{
get
{
return App.LoadFromAppState<bool>(Constants.AppSetting_GeoWatchEnable);
}
set
{
App.SaveToAppState<bool>(Constants.AppSetting_GeoWatchEnable, value);
}
}
}
}

View File

@@ -0,0 +1,67 @@
//-----------------------------------------------------------------------
// <copyright file="CleanUrlParamModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>06.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Utility
{
/// <summary>
/// This class is a Model for the URLParameter like GET-Parameter
/// </summary>
public class CleanUrlParamModel:UrlParamModel
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="UrlParamModel" /> class.
/// </summary>
/// <param name="key">the key for the parameter</param>
public CleanUrlParamModel(string key) :base(key)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UrlParamModel" /> class.
/// </summary>
/// <param name="key">the key for the parameter</param>>
/// <param name="value">value of the parameter</param>
public CleanUrlParamModel(string key, string value) : base(key,value)
{
}
#endregion
#region Proberty
/// <summary>
/// Gets the token, which indicate that the parameterList started
/// </summary>
public override string ParamToken
{
get
{
return string.Empty;
}
}
#endregion
#region Methods
/// <summary>
/// Method return a formatted string like Key=Value
/// </summary>
/// <returns> return formatted string</returns>
public override string ToString()
{
if (!this.IsParamValid())
{
return string.Empty;
}
return "/" + this.key + "/" + this.Value;
}
#endregion
}
}

View File

@@ -17,7 +17,7 @@ namespace CampusAppWP8.Model.Utility
/// <summary>
/// Variable of the key
/// </summary>
private readonly string key;
protected readonly string key;
#endregion
@@ -65,7 +65,7 @@ namespace CampusAppWP8.Model.Utility
/// <summary>
/// Gets the token, which indicate that the parameterList started
/// </summary>
public string ParamToken
public virtual string ParamToken
{
get
{

View File

@@ -24,6 +24,8 @@ namespace CampusAppWP8.Pages.Mensa
/// </summary>
private MensaFeed feed;
// private SpsApi spsApi;
/// <summary>
/// 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<string>("CurrentPosition.Lat");
string log = App.LoadFromAppState<string>("CurrentPosition.Long");
this.spsApi = new SpsApi();
this.spsApi.onLoaded += new SpsApi.OnLoaded(this.ApiIsReady);
List<UrlParamModel> parameterList = new List<UrlParamModel>();
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;
}*/
/// <summary>
/// Override the OnNavigatedFrom method
/// </summary>

View File

@@ -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;
}
}
/// <summary>
@@ -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;
}
}
/// <summary>
/// Method Navigate to <see cref="Setting/UserProfil"/>
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
{
Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative);
NavigationService.Navigate(url);
}
/// <summary>
/// Method change the Opacity of the ApplicationBar
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ApplicationBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e)
{
if (e.IsMenuVisible)
@@ -97,5 +114,31 @@ namespace CampusAppWP8.Pages
ApplicationBar.Opacity = 0.5;
}
}
/// <summary>
/// Method show all OptIns
/// </summary>
private void ShowOptIns()
{
this.GeoWatchOptIN();
}
/// <summary>
/// Method show the GeoWatchOptIn in a MessageBox
/// </summary>
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;
}
}
}
}

View File

@@ -204,6 +204,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ortung ähnelt.
/// </summary>
public static string GeoWatch_OptInHeader {
get {
return ResourceManager.GetString("GeoWatch_OptInHeader", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Dürfen Positionsdaten enhober und verwendet werdet? ähnelt.
/// </summary>
public static string GeoWatch_OptInText {
get {
return ResourceManager.GetString("GeoWatch_OptInText", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt.
/// </summary>

View File

@@ -359,4 +359,10 @@
<data name="MensaApp_Soup" xml:space="preserve">
<value>Suppe</value>
</data>
<data name="GeoWatch_OptInHeader" xml:space="preserve">
<value>Ortung</value>
</data>
<data name="GeoWatch_OptInText" xml:space="preserve">
<value>Dürfen Positionsdaten enhober und verwendet werdet?</value>
</data>
</root>

View File

@@ -60,6 +60,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die AppSetting.GeoWatchEnable ähnelt.
/// </summary>
public static string AppSetting_GeoWatchEnable {
get {
return ResourceManager.GetString("AppSetting_GeoWatchEnable", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die AppSetting.InitApp ähnelt.
/// </summary>
public static string AppSetting_InitApp {
get {
return ResourceManager.GetString("AppSetting_InitApp", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die DepartmentFavoriteFeed.xml ähnelt.
/// </summary>
@@ -150,6 +168,33 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Lat ähnelt.
/// </summary>
public static string GeoWatch_CurrentPosition_Lat {
get {
return ResourceManager.GetString("GeoWatch_CurrentPosition_Lat", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Long ähnelt.
/// </summary>
public static string GeoWatch_CurrentPosition_Long {
get {
return ResourceManager.GetString("GeoWatch_CurrentPosition_Long", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPosition.Time ähnelt.
/// </summary>
public static string GeoWatch_CurrentPosition_Time {
get {
return ResourceManager.GetString("GeoWatch_CurrentPosition_Time", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die IsolatedStorage_DepartmentFavoriteModel ähnelt.
/// </summary>
@@ -654,6 +699,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://141.43.76.140/service/sps ähnelt.
/// </summary>
public static string UrlSpsService {
get {
return ResourceManager.GetString("UrlSpsService", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/campusapp-data/getdata.php?db=studentcouncils&amp;app=2&amp;appversion=1 ähnelt.
/// </summary>

View File

@@ -333,4 +333,22 @@
<data name="MealIconName_Wild" xml:space="preserve">
<value>WILD</value>
</data>
<data name="AppSetting_GeoWatchEnable" xml:space="preserve">
<value>AppSetting.GeoWatchEnable</value>
</data>
<data name="AppSetting_InitApp" xml:space="preserve">
<value>AppSetting.InitApp</value>
</data>
<data name="GeoWatch_CurrentPosition_Lat" xml:space="preserve">
<value>CurrentPosition.Lat</value>
</data>
<data name="GeoWatch_CurrentPosition_Long" xml:space="preserve">
<value>CurrentPosition.Long</value>
</data>
<data name="GeoWatch_CurrentPosition_Time" xml:space="preserve">
<value>CurrentPosition.Time</value>
</data>
<data name="UrlSpsService" xml:space="preserve">
<value>http://141.43.76.140/service/sps</value>
</data>
</root>

View File

@@ -9,6 +9,7 @@
namespace CampusAppWP8
{
using CampusAppWP8.File.Setting;
using CampusAppWP8.Model.Setting;
/// <summary>
/// Class handle all setting (files)
@@ -20,6 +21,11 @@ namespace CampusAppWP8
/// </summary>
private static UserProfilFile userProfil = new UserProfilFile();
/// <summary>
/// reference of the appSettings
/// </summary>
private static AppSettings appSetting = new AppSettings();
/// <summary>
/// Gets or sets the user-profile-file
/// </summary>
@@ -38,5 +44,24 @@ namespace CampusAppWP8
}
}
}
/// <summary>
/// Gets or sets the AppSetting
/// </summary>
public static AppSettings AppSetting
{
get
{
return Settings.appSetting;
}
set
{
if (value != Settings.appSetting)
{
Settings.appSetting = value;
}
}
}
}
}

View File

@@ -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;
/// <summary>
/// Collection of utility functions.
@@ -191,5 +194,74 @@ namespace CampusAppWP8.Utility
return retValue;
}
/// <summary>
/// Method determine the current position of the phone
/// </summary>
/// <param name="accuracy">accuracy of the position in meters</param>
/// <returns>the position of the phone</returns>
public static GeoPosition<GeoCoordinate> 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<GeoCoordinate> geoposition = null;
if (success)
{
geoposition = watcher.Position;
}
watcher.Stop();
return geoposition;
}
/// <summary>
/// Method determine and store the current position of the phone
/// </summary>
public static void DetermineAndStoreCurrentPositionForce()
{
GeoPosition<GeoCoordinate> 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<string>(Constants.GeoWatch_CurrentPosition_Lat, lat);
App.SaveToAppState<string>(Constants.GeoWatch_CurrentPosition_Long, log);
App.SaveToAppState<string>(Constants.GeoWatch_CurrentPosition_Time, time);
}
}
/// <summary>
/// Method determine and store the current position of the phone, in 15 min interval
/// </summary>
public static void DetermineAndStoreCurrentPosition()
{
string lat = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Lat);
string log = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Long);
string time = App.LoadFromAppState<string>(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();
}
}
}
}
}

View File

@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BuiltToRoam.Core.Agent" version="1.0.1.5" targetFramework="wp80" />
<package id="BuiltToRoam.GeoWatcher" version="1.0.1.5" targetFramework="wp80" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="wp80" />
<package id="SharpZipLib-WP7" version="0.86.0.518" targetFramework="wp80" />
<package id="WPtoolkit" version="4.2012.10.30" targetFramework="wp80" />
</packages>