add spsapi

This commit is contained in:
stubbfel
2013-08-06 16:13:29 +02:00
parent a99ff5526c
commit 363baad60c
8 changed files with 162 additions and 10 deletions

View File

@@ -0,0 +1,26 @@
//-----------------------------------------------------------------------
// <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;
/// <summary>
/// Class for sps api
/// </summary>
public class SpsApi : XmlModel<SpsModel>
{
/// <summary>
/// Initializes a new instance of the <see cref="SpsApi" /> class.
/// </summary>
public SpsApi()
: base(ModelType.Feed, "http://141.43.76.140/service/sps")
{
}
}
}

View File

@@ -93,16 +93,20 @@
<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\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" />

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.GeoDb
{
public class PlaceModel
{
[XmlAttribute("id")]
public string PlaceId { get; set; }
[XmlAttribute("parentId")]
public string ParentId { get; set; }
[XmlAttribute("refpoint")]
public string RefPoint { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace CampusAppWP8.Model.GeoDb
{
[XmlRoot("root")]
public class SpsModel
{
[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,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

@@ -11,6 +11,9 @@ namespace CampusAppWP8.Pages.Mensa
using System.Windows.Navigation;
using CampusAppWP8.Feed.Mensa;
using Microsoft.Phone.Controls;
using CampusAppWP8.Feed.GeoApi;
using System.Collections.Generic;
using CampusAppWP8.Model.Utility;
/// <summary>
/// Class for the MensaPage
@@ -24,6 +27,8 @@ namespace CampusAppWP8.Pages.Mensa
/// </summary>
private MensaFeed feed;
private SpsApi spsApi;
/// <summary>
/// Index representing the weekday of today
/// 0 - Monday(Default)
@@ -72,6 +77,18 @@ namespace CampusAppWP8.Pages.Mensa
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.feed.LoadData();
this.spsApi = new SpsApi();
this.spsApi.onLoaded += new MensaFeed.OnLoaded(this.ApiIsReady);
List<UrlParamModel> parameterList = new List<UrlParamModel>();
parameterList.Add(new CleanUrlParamModel("latitude", "14.294"));
parameterList.Add(new CleanUrlParamModel("longitude", "51.77676"));
parameterList.Add(new CleanUrlParamModel("domain", "14.294"));
this.spsApi.LoadData();
}
private void ApiIsReady()
{
string i = this.spsApi.Model.Places[0].PlaceId;
}
/// <summary>