add rss and mensa model to plc

This commit is contained in:
stubbfel
2013-09-17 15:32:42 +02:00
parent 98d8a43961
commit ad9bbb2342
46 changed files with 644 additions and 1697 deletions

View File

@@ -12,7 +12,8 @@ namespace CampusAppWP8.Api.GeoApi
using CampusAppWP8.Model;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>Pis api.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>

View File

@@ -13,6 +13,7 @@ namespace CampusAppWP8.Api.GeoApi
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>Pss api.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>

View File

@@ -12,7 +12,8 @@ namespace CampusAppWP8.Api.GeoApi
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>
/// Class for SPSAPI

View File

@@ -131,7 +131,6 @@
<Compile Include="Model\Utility\CourseListPickerItemListModel.cs" />
<Compile Include="Model\Utility\CourseModel.cs" />
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
<Compile Include="Model\Utility\CampusListPickerItemListModel.cs" />
<Compile Include="Pages\Exams\Exams.xaml.cs">
<DependentUpon>Exams.xaml</DependentUpon>
@@ -198,7 +197,6 @@
<Compile Include="Model\Openinghours\OpeninghoursModel.cs" />
<Compile Include="Model\StudentCouncil\StudentCouncilListModel.cs" />
<Compile Include="Model\StudentCouncil\StudentCouncilModel.cs" />
<Compile Include="Model\Utility\UrlParamModel.cs" />
<Compile Include="Model\XmlModel.cs" />
<Compile Include="Pages\Campusmap\CampusMapPage.xaml.cs">
<DependentUpon>CampusMapPage.xaml</DependentUpon>
@@ -554,6 +552,10 @@
<Project>{2A51FA6C-791B-4935-B869-FDBA9ED774D7}</Project>
<Name>CampusAppWP8ScheduledTaskAgent</Name>
</ProjectReference>
<ProjectReference Include="..\CampusAppWPortalLib8\CampusAppWPortalLib8.csproj">
<Project>{67D80BE2-0FB7-44C8-A495-7D44FC2AC262}</Project>
<Name>CampusAppWPortalLib8</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />

View File

@@ -7,12 +7,12 @@
//-----------------------------------------------------------------------------
namespace CampusAppWP8
{
using CampusAppWP8.Utility;
using CampusAppWPortalLib8.Model.Utility;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using CampusAppWP8.Model.Utility;
using CampusAppWP8.Utility;
/// <summary>
/// Base model io handling class.

View File

@@ -17,6 +17,7 @@ namespace CampusAppWP8.Pages.Lecture
using CampusAppWP8.Resources;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>
/// Class for the LecturePage

View File

@@ -18,6 +18,7 @@ namespace CampusAppWP8.Pages.Person
using CampusAppWP8.Utility.Lui.MessageBoxes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>Person page.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>

View File

@@ -1,4 +1,5 @@
using CampusAppWP8ScheduledTaskAgent.Resources;
using CampusAppWPortalLib8.Utility;
using Microsoft.Phone.Scheduler;
using System;
using System.Collections.Generic;
@@ -8,9 +9,10 @@ using System.Threading.Tasks;
namespace CampusAppWP8.Utility
{
public class BackgroundTasks
public class BackgroundTasks : AbstractBackgroundTasks
{
public static void StartPerodicTask(string taskName, string taskDesc) {
BackgroundTasks.StopPerodicTask(BackgroundTasks.LastAddedTaskName);
BackgroundTasks.StopPerodicTask(taskName);
PeriodicTask periodicTask = new PeriodicTask(taskName);
@@ -24,11 +26,19 @@ namespace CampusAppWP8.Utility
catch (Exception e)
{
Logger.LogException(e);
return;
}
BackgroundTasks.LastAddedTaskName = taskName;
}
public static void StopPerodicTask(string taskName)
{
if (taskName == null)
{
return;
}
PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;
if (periodicTask != null)
{

View File

@@ -11,6 +11,7 @@ namespace CampusAppWP8.Utility
using System.Collections.Generic;
using System.Net;
using CampusAppWP8.Model.Utility;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>
/// Class realize the access of restful HttpRequest

View File

@@ -50,6 +50,7 @@ namespace CampusAppWP8.Utility.Lui.Tiles
public static void CreateNewsTile()
{
TileCreator.CreateIconicTile(AppResources.NewsApp_Title, Constants.PathNews_NewsIndexPage, Icons.News, Icons.News);
BackgroundTasks.StartNewsTask();
}
public static void CreateLectureTile()

View File

@@ -84,14 +84,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Model\Mensa\MealModel.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Model\RSS\RSSChannelModel.cs" />
<Compile Include="Model\RSS\RSSModel.cs" />
<Compile Include="Model\RSS\RSSViewModel.cs" />
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
<Compile Include="Model\Utility\URLParamModel.cs" />
<Compile Include="Resources\AppResources.Designer.cs">
<DependentUpon>AppResources.resx</DependentUpon>
<AutoGen>True</AutoGen>
@@ -106,9 +98,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utility\BackgroundTasks.cs" />
<Compile Include="Utility\HttpRequest.cs" />
<Compile Include="Utility\Logger.cs" />
<Compile Include="Utility\StringManager.cs" />
<Compile Include="Utility\XmlManager.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\AppResources.resx">
@@ -125,6 +114,12 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CampusAppWPortalLib8\CampusAppWPortalLib8.csproj">
<Project>{67D80BE2-0FB7-44C8-A495-7D44FC2AC262}</Project>
<Name>CampusAppWPortalLib8</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<ProjectExtensions />

View File

@@ -1,66 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="CleanUrlParamModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>06.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.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 CleanUrlParamModel class.</summary>
/// <remarks>Stubbfel, 12.09.2013.</remarks>
/// <param name="key">the key for the parameter.</param>
public CleanUrlParamModel(string key)
: base(key)
{
}
/// <summary>Initializes a new instance of the CleanUrlParamModel class.</summary>
/// <remarks>Stubbfel, 12.09.2013.</remarks>
/// <param name="key"> the key for the parameter.</param>
/// <param name="value">The value.</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

@@ -1,108 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="URLParamModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>17.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.Utility
{
/// <summary>
/// This class is a Model for the URLParameter like GET-Parameter
/// </summary>
public class UrlParamModel
{
#region Members
/// <summary>
/// Variable of the key
/// </summary>
protected readonly string key;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="UrlParamModel" /> class.
/// </summary>
/// <param name="key">the key for the parameter</param>
public UrlParamModel(string key)
{
this.key = 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 UrlParamModel(string key, string value)
{
this.key = key;
this.Value = value;
}
#endregion
#region Proberty
/// <summary>
/// Gets or sets the value of the Parameter
/// </summary>
public string Value { get; set; }
/// <summary>
/// Gets the key of the parameter
/// </summary>
public string Key
{
get
{
return this.key;
}
}
/// <summary>
/// Gets the token, which indicate that the parameterList started
/// </summary>
public virtual string ParamToken
{
get
{
return "?";
}
}
#endregion
#region Methods
/// <summary>
/// Method check if the parameter is valid
/// </summary>
/// <returns>true if is it valid, otherwise false</returns>
public virtual bool IsParamValid()
{
if (this.key == null || string.Empty.Equals(this.key) || string.Empty.Equals(this.Value))
{
return false;
}
return true;
}
/// <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

@@ -87,24 +87,6 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Aktion ähnelt.
/// </summary>
public static string MensaApp_Action {
get {
return ResourceManager.GetString("MensaApp_Action", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Bio ähnelt.
/// </summary>
public static string MensaApp_Bio {
get {
return ResourceManager.GetString("MensaApp_Bio", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Die Mensa ist heute geschlossen ähnelt.
/// </summary>
@@ -113,86 +95,5 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
return ResourceManager.GetString("MensaApp_CloseMensa", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 1 ähnelt.
/// </summary>
public static string MensaApp_Dinner1 {
get {
return ResourceManager.GetString("MensaApp_Dinner1", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 2 ähnelt.
/// </summary>
public static string MensaApp_Dinner2 {
get {
return ResourceManager.GetString("MensaApp_Dinner2", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 3 ähnelt.
/// </summary>
public static string MensaApp_Dinner3 {
get {
return ResourceManager.GetString("MensaApp_Dinner3", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 4 ähnelt.
/// </summary>
public static string MensaApp_Dinner4 {
get {
return ResourceManager.GetString("MensaApp_Dinner4", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 5 ähnelt.
/// </summary>
public static string MensaApp_Dinner5 {
get {
return ResourceManager.GetString("MensaApp_Dinner5", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 84 ähnelt.
/// </summary>
public static string MensaApp_DinnerLabelW {
get {
return ResourceManager.GetString("MensaApp_DinnerLabelW", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Heute nicht im Angbot ähnelt.
/// </summary>
public static string MensaApp_NotToday {
get {
return ResourceManager.GetString("MensaApp_NotToday", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Suppe ähnelt.
/// </summary>
public static string MensaApp_Soup {
get {
return ResourceManager.GetString("MensaApp_Soup", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Mensaplan ähnelt.
/// </summary>
public static string MensaApp_Title {
get {
return ResourceManager.GetString("MensaApp_Title", resourceCulture);
}
}
}
}

View File

@@ -117,49 +117,16 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MensaApp_Title" xml:space="preserve">
<value>Mensaplan</value>
</data>
<data name="MensaApp_Action" xml:space="preserve">
<value>Aktion</value>
</data>
<data name="MensaApp_Bio" xml:space="preserve">
<value>Bio</value>
</data>
<data name="MensaApp_Dinner1" xml:space="preserve">
<value>Essen 1</value>
</data>
<data name="MensaApp_Dinner2" xml:space="preserve">
<value>Essen 2</value>
</data>
<data name="MensaApp_Dinner3" xml:space="preserve">
<value>Essen 3</value>
</data>
<data name="MensaApp_Dinner4" xml:space="preserve">
<value>Essen 4</value>
</data>
<data name="MensaApp_NotToday" xml:space="preserve">
<value>Heute nicht im Angbot</value>
</data>
<data name="MensaApp_DinnerLabelW" xml:space="preserve">
<value>84</value>
</data>
<data name="MensaApp_Dinner5" xml:space="preserve">
<value>Essen 5</value>
</data>
<data name="MensaApp_Soup" xml:space="preserve">
<value>Suppe</value>
</data>
<data name="BackGroundTaskDesc_Mensa" xml:space="preserve">
<value>Hintergrunddienst für die BTU-Mensa</value>
</data>
<data name="MensaApp_CloseMensa" xml:space="preserve">
<value>Die Mensa ist heute geschlossen</value>
</data>
<data name="BackGroundTaskDesc_Event" xml:space="preserve">
<value>Hintergrunddienst für die BTU-Event-Feed</value>
</data>
<data name="BackGroundTaskDesc_News" xml:space="preserve">
<value>Hintergrunddienst für die BTU-News-Feed</value>
</data>
<data name="MensaApp_CloseMensa" xml:space="preserve">
<value>Die Mensa ist heute geschlossen</value>
</data>
</root>

View File

@@ -1,7 +1,8 @@
using CampusAppWP8ScheduledTaskAgent.Model.Mensa;
using CampusAppWP8ScheduledTaskAgent.Model.RSS;
using CampusAppWP8ScheduledTaskAgent.Resources;
using CampusAppWP8ScheduledTaskAgent.Resources;
using CampusAppWP8ScheduledTaskAgent.Utility;
using CampusAppWPortalLib8.Model.Mensa;
using CampusAppWPortalLib8.Model.RSS;
using CampusAppWPortalLib8.Utility;
using Microsoft.Phone.Scheduler;
using Microsoft.Phone.Shell;
using System;

View File

@@ -1,35 +1,11 @@
using CampusAppWP8ScheduledTaskAgent.Resources;
using CampusAppWPortalLib8.Utility;
using Microsoft.Phone.Scheduler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8ScheduledTaskAgent.Utility
{
public class BackgroundTasks
public class BackgroundTasks : AbstractBackgroundTasks
{
public static void StartPerodicTask(string taskName, string taskDesc) {
BackgroundTasks.StopPerodicTask(taskName);
PeriodicTask periodicTask = new PeriodicTask(taskName);
// load description from localized strings
periodicTask.Description = taskDesc;
try
{
ScheduledActionService.Add(periodicTask);
//ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(10));
}
catch (Exception e)
{
Logger.LogException(e);
}
}
public static void StopPerodicTask(string taskName)
{
PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;

View File

@@ -7,24 +7,15 @@
//----------------------------------------------------------------------using System;
namespace CampusAppWP8ScheduledTaskAgent.Utility
{
using CampusAppWPortalLib8.Utility;
using System;
using System.Collections.Generic;
using System.Net;
using CampusAppWP8ScheduledTaskAgent.Model.Utility;
/// <summary>
/// Class realize the access of restful HttpRequest
/// </summary>
public class HttpRequest
public class HttpRequest : AbstractHttpRequest
{
#region Member
/// <summary>
/// BaseAddress of the webClient
/// </summary>
private string baseAddress;
#endregion
#region Constructor
/// <summary>
@@ -40,13 +31,12 @@ namespace CampusAppWP8ScheduledTaskAgent.Utility
/// <param name="apiBaseAddress">the url of the HttpRequest base address</param>
public HttpRequest(Uri apiBaseAddress)
{
this.baseAddress = apiBaseAddress.AbsoluteUri;
this.BaseAddress = apiBaseAddress.AbsoluteUri;
}
#endregion
#region Methods
#region public
/// <summary>
/// Method realize the http-get-method resource
@@ -58,158 +48,7 @@ namespace CampusAppWP8ScheduledTaskAgent.Utility
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(action);
client.DownloadStringAsync(url);
}
/// <summary>Method realize the http-get-method resource.</summary>
/// <remarks>Stubbfel, 03.09.2013.</remarks>
/// <param name="url"> Url of the resource.</param>
/// <param name="action">The action.</param>
public void HttpGet(Uri url, Action<object, OpenReadCompletedEventArgs> action)
{
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(action);
client.OpenReadAsync(url);
}
/// <summary>
/// Method create the Url for the http-get-method
/// </summary>
/// <param name="parameters"> list of parameters</param>
/// <returns>absolute API-Url include GetParameter</returns>
public Uri CreateGetUrl(List<UrlParamModel> parameters)
{
string paramterStr = string.Empty;
string seperator = string.Empty;
foreach (UrlParamModel parameter in parameters)
{
if (string.Empty.Equals(seperator))
{
seperator = parameter.ParamToken;
}
paramterStr += parameter.ToString();
}
string getUrlStr = this.baseAddress + seperator + paramterStr;
return new Uri(getUrlStr, UriKind.Absolute);
}
/// <summary>
/// Method realize the http-delete-method
/// </summary>
/// <remarks>
/// is not supported by WebClient
/// </remarks>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
public void HttpDelete(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
{
throw new NotSupportedException();
}
/// <summary>
/// Method realize the http-head-method
/// </summary>
/// <remarks>
/// is not supported by WebClient
/// </remarks>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
public void HttpHead(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
{
throw new NotSupportedException();
}
/// <summary>
/// Method realize the http-options-method
/// </summary>
/// <remarks>
/// is not supported by WebClient
/// </remarks>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
public void HttpOptions(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
{
throw new NotSupportedException();
}
/// <summary>
/// Method realize the http-connect-method
/// </summary>
/// <remarks>
/// is not supported by WebClient
/// </remarks>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
public void HttpConnect(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
{
throw new NotSupportedException();
}
/// <summary>
/// Method realize the http-trace-method
/// </summary>
/// <remarks>
/// is not supported by WebClient
/// </remarks>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
public void HttpTrace(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
{
throw new NotSupportedException();
}
/// <summary>
/// Method realize the http-post-method
/// </summary>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
/// <param name="postData">Data which are sending via post to the HttpRequest</param>
public void HttpPost(Uri url, Action<object, UploadStringCompletedEventArgs> action, string postData)
{
this.UploadData(url, action, "POST", postData);
}
/// <summary>
/// Method realize the http-put-method
/// </summary>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
/// <param name="putData">Data which are sending via put to the HttpRequest</param>
public void HttpPut(Uri url, Action<object, UploadStringCompletedEventArgs> action, string putData)
{
this.UploadData(url, action, "PUT", putData);
}
/// <summary>
/// Method realize the http-patch-method
/// </summary>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
/// <param name="patchData">Data which are sending via patch to the HttpRequest</param>
public void HttpPatch(Uri url, Action<object, UploadStringCompletedEventArgs> action, string patchData)
{
this.UploadData(url, action, "PATCH", patchData);
}
#endregion
#region private
/// <summary>
/// Method uploaded Data to the HttpRequest
/// </summary>
/// <param name="url">Url of the resource</param>
/// <param name="action">callback method</param>
/// <param name="method">name of APIMethod, how the data will be uploaded</param>
/// <param name="data">Data which are sending to the HttpRequest</param>
private void UploadData(Uri url, Action<object, UploadStringCompletedEventArgs> action, string method, string data)
{
WebClient client = new WebClient();
client.UploadStringCompleted += new UploadStringCompletedEventHandler(action);
client.UploadStringAsync(url, method, data);
}
#endregion
}
#endregion
}

View File

@@ -1,35 +0,0 @@
//--------------------------------------------------------------------
// <copyright file="Logger.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>03.05.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Utility
{
using System;
/// <summary>
/// This Class creates logs for the app
/// </summary>
public class Logger
{
/// <summary>
/// Method log a Exception
/// </summary>
/// <param name="exception">exception which has to log</param>
public static void LogException(Exception exception)
{
// Console.WriteLine(exception);
}
/// <summary>
/// Log a message.
/// </summary>
/// <param name="msg">to be logged message</param>
public static void LogMsg(string msg)
{
// Console.WriteLine(msg);
}
}
}

View File

@@ -1,69 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="StringManager.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>06.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Utility
{
using System.Text.RegularExpressions;
/// <summary>
/// Class provides some special StringMethods
/// </summary>
public static class StringManager
{
#region Members
/// <summary>
/// Patter for Html-Tags
/// </summary>
private static readonly string HtmlTagPattern = "<.*?>";
#endregion
#region Methods
/// <summary>
/// Method removes Html-Tag of a String
/// </summary>
/// <param name="inputString">String with Html-Tags</param>
/// <returns>String without Html-Tags</returns>
public static string StripHTML(string inputString)
{
return Regex.Replace(inputString, HtmlTagPattern, string.Empty);
}
/// <summary>
/// Method add an Newline to a string
/// </summary>
/// <param name="str">input string</param>
/// <returns>input string + newline</returns>
public static string AddNewLine(string str)
{
return str.ToString() + "\n";
}
/// <summary>
/// Method remove(TrimEND!) an Newline to a string
/// </summary>
/// <param name="str">input string</param>
/// <returns>input string - newline</returns
public static string RemoveNewLine(string str)
{
return str.TrimEnd('\n');
}
public static string ToShortString(string longStr, int maxLenght)
{
string shortStr = longStr;
if (shortStr.Length > maxLenght)
{
shortStr = shortStr.Substring(0, maxLenght);
}
return shortStr;
}
#endregion
}
}

View File

@@ -1,88 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="XmlManager.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>18.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Utility
{
using System.IO;
using System.Xml.Linq;
using System.Xml.Serialization;
/// <summary>
/// Class provides some Xml-methods
/// </summary>
public class XmlManager
{
/// <summary>
/// Method deserialization a string to a Model
/// </summary>
/// <typeparam name="T">the model</typeparam>
/// <param name="xmlString">the XmlString</param>
/// <param name="validRootName">name of the RootTag</param>
/// <returns>return the deserialization of the model</returns>
public static T DeserializationToModel<T>(string xmlString, string validRootName)
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
XDocument document = XDocument.Parse(xmlString);
if (!document.Root.Name.ToString().Equals(validRootName))
{
XElement content = document.Root;
document = new XDocument();
document.Add(new XElement(validRootName, content));
}
T model = (T)serializer.Deserialize(document.CreateReader());
return model;
}
/// <summary>Deserialization a xml file to a model.</summary>
/// <remarks>Stubbfel, 20.08.2013.</remarks>
/// <typeparam name="T">Generic type parameter.</typeparam>
/// <param name="xmlFilePath">Path to the a XmlFile.</param>
/// <returns>model of the XmlFile.</returns>
public static T DeserializationFileToModel<T>(string xmlFilePath)
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
XDocument document = XDocument.Load(xmlFilePath);
T model = (T)serializer.Deserialize(document.CreateReader());
return model;
}
/// <summary>
/// Method serializes a model to a string.
/// </summary>
/// <typeparam name="T">type of the model</typeparam>
/// <param name="model">model object</param>
/// <returns>serialized string</returns>
public static string SerializationToString<T>(T model)
{
string retValue = string.Empty;
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add(string.Empty, string.Empty);
XmlSerializer serializer = new XmlSerializer(typeof(T));
TextWriter writer = new StringWriter();
serializer.Serialize(writer, model, ns);
retValue = writer.ToString();
if (retValue.StartsWith("<?xml") == true)
{
int endTag = retValue.IndexOf("?>");
retValue = retValue.Substring(endTag + 2);
if (retValue.StartsWith("\r\n") == true)
{
retValue = retValue.Substring(2);
}
}
return retValue;
}
}
}

View File

@@ -33,23 +33,46 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Model\Campusmap\CBMainMapModel.cs" />
<Compile Include="Model\Campusmap\MapModel.cs" />
<Compile Include="Model\GeoDb\PlaceInformation.cs" />
<Compile Include="Model\GeoDb\PlaceModel.cs" />
<Compile Include="Model\GeoDb\PlaceService.cs" />
<Compile Include="Model\GeoDb\SpsModel.cs" />
<Compile Include="Model\Mensa\MealModel.cs" />
<Compile Include="Model\Mensa\MenuModel.cs" />
<Compile Include="Model\Mensa\MenuWeekModel.cs" />
<Compile Include="Model\RSS\RSSChannelModel.cs" />
<Compile Include="Model\RSS\RSSModel.cs" />
<Compile Include="Model\RSS\RSSViewModel.cs" />
<Compile Include="Model\Utility\CleanUrlParamModel.cs" />
<Compile Include="Model\Utility\URLParamModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\AppResources.Designer.cs">
<DependentUpon>AppResources.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Constants1.Designer.cs">
<DependentUpon>Constants.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Utility\AbstractHttpRequest.cs" />
<Compile Include="Utility\AbstractBackgroundTasks.cs" />
<Compile Include="Utility\Logger.cs" />
<Compile Include="Utility\NDEF\NDEFMessage.cs" />
<Compile Include="Utility\NDEF\NDEFRecord.cs" />
<Compile Include="Utility\NDEF\NDEFShortRecord.cs" />
<Compile Include="Utility\StringManager.cs" />
<Compile Include="Utility\XmlManager.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\AppResources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>AppResources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Constants.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Constants1.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -1,45 +0,0 @@
//-----------------------------------------------------------------------------
// <copyright file="CBMainMapModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>13.08.2013</sience>
//-----------------------------------------------------------------------------
using CampusAppWPortalLib8.Model.GeoDb;
using CampusAppWPortalLib8.Utility;
namespace CampusAppWPortalLib8.Model.Campusmap
{
/// <summary>
/// Class for the MapModel of the mainCampus of cottbus
/// </summary>
public class CBMainMapModel : MapModel
{
/// <summary>Variable for the identify of the campus.</summary>
private static readonly string Campus = "1";
/// <summary>
/// Initializes a new instance of the <see cref="CBMainMapModel" /> class.
/// </summary>
public CBMainMapModel(string xmlFilePath) : base(xmlFilePath)
{
}
/// <summary>Loads the spatial./.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
protected override void LoadSpatials(string xmlFilePath)
{
SpsModel model = XmlManager.DeserializationFileToModel<SpsModel>(xmlFilePath);
this.Spatial = new SpsModel();
foreach (PlaceModel place in model.Places)
{
if (Campus.Equals(place.ParentId) || Campus.Equals(place.PlaceId))
{
this.Spatial.Places.Add(place);
}
}
}
}
}

View File

@@ -1,48 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="MapModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>24.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Campusmap
{
using CampusAppWPortalLib8.Model.GeoDb;
using System;
/// <summary>
/// This Class manage the properties of a Map
/// </summary>
public class MapModel
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="MapModel" /> class.
/// </summary>
public MapModel(string xmlFilePath)
{
this.LoadSpatials(xmlFilePath);
}
#endregion
#region Property
/// <summary>Gets or sets the spatial of the map.</summary>
/// <value>The spatial.</value>
public SpsModel Spatial { get; set; }
#endregion
#region Methods
/// <summary>Loads the spatial./</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
protected virtual void LoadSpatials(string xmlFilePath)
{
}
#endregion
}
}

View File

@@ -1,41 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="PlaceInformation.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>19.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System;
using System.Xml.Serialization;
/// <summary>Information about the place.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
public class PlaceInformation : IEquatable<PlaceInformation>
{
/// <summary>Gets or sets the name of the information.</summary>
/// <value>The name of the information.</value>
[XmlAttribute("placeInformationName")]
public string InformationName { get; set; }
/// <summary>Gets or sets the information value.</summary>
/// <value>The information value.</value>
[XmlText]
public string InformationValue { get; set; }
/// <summary>Tests if this PlaceInformation is considered equal to another.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="other">The place information to compare to this object.</param>
/// <returns>true if the objects are considered equal, false if they are not.</returns>
public bool Equals(PlaceInformation other)
{
if (other.InformationName.Equals(this.InformationName))
{
return true;
}
return false;
}
}
}

View File

@@ -1,167 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="PlaceModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>08.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
/// <summary>
/// Model for a place of the SPSService
/// </summary>
public class PlaceModel : IEquatable<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; }
/// <summary>Gets or sets the information.</summary>
/// <value>The information.</value>
[XmlElement("placeInformation")]
public ObservableCollection<PlaceInformation> Informations { get; set; }
/// <summary>Gets or sets the services.</summary>
/// <value>The services.</value>
[XmlElement("placeService")]
public ObservableCollection<PlaceService> Services { get; set; }
/// <summary>Converts this object to a nfc string.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <returns>This object as a string.</returns>
public string ToNfcString()
{
string nfcStr = "{\"pid\":\"" + this.PlaceId + "\",\"parent\":\"" + this.ParentId + "\"}";
return nfcStr;
}
/// <summary>Tests if this PlaceModel is considered equal to another.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="other">The place model to compare to this object.</param>
/// <returns>true if the objects are considered equal, false if they are not.</returns>
public bool Equals(PlaceModel other)
{
if (other.PlaceId.Equals(this.PlaceId))
{
return true;
}
return false;
}
/// <summary>Adds a place informations.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="placeInformations">The place informations.</param>
public void AddPlaceInformations(List<PlaceInformation> placeInformations)
{
foreach (PlaceInformation info in placeInformations)
{
if (this.Informations.Contains(info))
{
int index = this.Informations.IndexOf(info);
this.Informations[index].InformationValue = info.InformationValue;
}
else
{
this.Informations.Add(info);
}
}
}
/// <summary>Adds a place services.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="placeServices">The place services.</param>
public void AddPlaceServices(List<PlaceService> placeServices)
{
foreach (PlaceService service in placeServices)
{
if (this.Services.Contains(service))
{
int index = this.Services.IndexOf(service);
this.Services[index].Request = service.Request;
this.Services[index].SAP = service.SAP;
}
else
{
this.Services.Add(service);
}
}
}
/// <summary>Query if 'names' contains information names.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="names">The names.</param>
/// <returns>true if it succeeds, false if it fails.</returns>
public bool ContainsInformationNames(List<string> names)
{
foreach (string name in names)
{
bool tmpResult = false;
foreach (PlaceInformation info in this.Informations)
{
if (name.Equals(info.InformationName))
{
tmpResult = true;
break;
}
}
if (!tmpResult)
{
return tmpResult;
}
}
return true;
}
/// <summary>Query if 'services' contains service names.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="services">The services.</param>
/// <returns>true if it succeeds, false if it fails.</returns>
public bool ContainsServiceNames(List<string> services)
{
foreach (string name in services)
{
bool tmpResult = false;
foreach (PlaceService service in this.Services)
{
if (name.Equals(service.ServiceName))
{
tmpResult = true;
break;
}
}
if (!tmpResult)
{
return tmpResult;
}
}
return true;
}
}
}

View File

@@ -1,57 +0,0 @@
//-----------------------------------------------------------------------------
// <copyright file="PlaceService.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>19.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System;
using System.Xml.Serialization;
/// <summary>Place service.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
public class PlaceService : IEquatable<PlaceService>
{
/// <summary>Gets or sets the name of the service.</summary>
/// <value>The name of the service.</value>
[XmlAttribute("placeServiceName")]
public string ServiceName { get; set; }
/// <summary>Gets or sets the SAP of an service.</summary>
/// <value>The sap.</value>
[XmlElement("sap")]
public string SAP { get; set; }
/// <summary>Gets or sets the request for a place.</summary>
/// <value>The request.</value>
[XmlElement("request")]
public string Request { get; set; }
/// <summary>Gets the URL string.</summary>
/// <value>The URL string.</value>
public string URLString
{
get
{
return this.SAP + this.Request;
}
}
/// <summary>Tests if this PlaceService is considered equal to another.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="other">The place service to compare to this object.</param>
/// <returns>true if the objects are considered equal, false if they are not.</returns>
public bool Equals(PlaceService other)
{
if (other.ServiceName.Equals(this.ServiceName))
{
return true;
}
return false;
}
}
}

View File

@@ -1,200 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="SpsModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>08.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Xml.Serialization;
/// <summary>
/// Model for a xml-response of the SPSService
/// </summary>
[XmlRoot("root")]
public class SpsModel
{
/// <summary>Initializes a new instance of the SpsModel class.</summary>
/// <remarks>Stubbfel, 20.08.2013.</remarks>
public SpsModel()
{
this.HasChanged = false;
this.Places = new ObservableCollection<PlaceModel>();
}
/// <summary>
/// Gets or sets a list of places
/// </summary>
[XmlElement("place")]
public ObservableCollection<PlaceModel> Places { get; set; }
/// <summary>Gets a value indicating whether this object has changed.</summary>
/// <value>true if this object has changed, false if not.</value>
public bool HasChanged { get; set; }
/// <summary>Gets places by information.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="query"> The query.</param>
/// <param name="ignoreCases"> (Optional) the ignore cases.</param>
/// <param name="informationName">(Optional) name of the information.</param>
/// <returns>The places by information.</returns>
public List<PlaceModel> GetPlacesByInformation(string query, bool ignoreCases = true, string informationName = null)
{
string querryLow = string.Empty;
IEnumerable<PlaceModel> resultplaces = null;
// select correct statement
if (ignoreCases && informationName == null)
{
querryLow = query.ToLower();
resultplaces = from place in this.Places
from info in place.Informations
where info.InformationValue.ToLower().Contains(querryLow)
select place;
}
else if (ignoreCases && informationName != null)
{
querryLow = query.ToLower();
resultplaces = from place in this.Places
from info in place.Informations
where info.InformationValue.ToLower().Contains(querryLow) && info.InformationName.Equals(informationName)
select place;
}
else if (!ignoreCases && informationName == null)
{
resultplaces = from place in this.Places
from info in place.Informations
where info.InformationValue.Contains(querryLow)
select place;
}
else if (!ignoreCases && informationName != null)
{
resultplaces = from place in this.Places
from info in place.Informations
where info.InformationValue.Contains(querryLow) && info.InformationName.Equals(informationName)
select place;
}
// null assert
if (resultplaces == null)
{
return null;
}
return resultplaces.ToList<PlaceModel>();
}
/// <summary>Adds the places.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="places">A list of places.</param>
public void AddPlaces(List<PlaceModel> places)
{
foreach (PlaceModel place in places)
{
if (this.Places.Contains(place))
{
int index = this.Places.IndexOf(place);
this.Places[index].AddPlaceInformations(place.Informations.ToList());
this.Places[index].AddPlaceServices(place.Services.ToList());
}
else
{
this.Places.Add(place);
}
}
this.HasChanged = true;
}
/// <summary>Creates PID list.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <returns>The new PID list.</returns>
public List<string> CreatePidList()
{
List<string> pidList = new List<string>();
foreach (PlaceModel place in this.Places)
{
pidList.Add(place.PlaceId);
}
return pidList;
}
/// <summary>Gets place by identifier.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="id">The identifier.</param>
/// <returns>The place by identifier.</returns>
public PlaceModel GetPlaceById(string id)
{
foreach (PlaceModel place in this.Places)
{
if (place.PlaceId.Equals(id))
{
return place;
}
}
return null;
}
/// <summary>Query if 'pidList' contains information names.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="pidList">List of pids.</param>
/// <param name="names"> The names.</param>
/// <returns>true if it succeeds, false if it fails.</returns>
public bool ContainsInformationNames(List<string> pidList, List<string> names)
{
foreach (string pid in pidList)
{
PlaceModel place = this.GetPlaceById(pid);
if (!place.ContainsInformationNames(names))
{
return false;
}
}
return true;
}
/// <summary>Query if 'pidList' contains service names.</summary>
/// <remarks>Stubbfel, 09.09.2013.</remarks>
/// <param name="pidList">List of pids.</param>
/// <param name="names"> The names.</param>
/// <returns>true if it succeeds, false if it fails.</returns>
public bool ContainsServiceNames(List<string> pidList, List<string> names)
{
foreach (string pid in pidList)
{
PlaceModel place = this.GetPlaceById(pid);
if (!place.ContainsServiceNames(names))
{
return false;
}
}
return true;
}
/// <summary>Filter by PID.</summary>
/// <remarks>Stubbfel, 11.09.2013.</remarks>
/// <param name="pidList">List of pids.</param>
/// <returns>flitered list of places</returns>
public List<PlaceModel> FilterByPid(List<string> pidList)
{
List<PlaceModel> fitlerList = new List<PlaceModel>();
foreach (PlaceModel place in this.Places)
{
if (pidList.Contains(place.PlaceId))
{
fitlerList.Add(place);
}
}
return fitlerList;
}
}
}

View File

@@ -5,11 +5,11 @@
// <author>stubbfel</author>
// <sience>06.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.Mensa
namespace CampusAppWPortalLib8.Model.Mensa
{
using System.Xml.Serialization;
using CampusAppWP8ScheduledTaskAgent.Resources;
using CampusAppWP8ScheduledTaskAgent.Utility;
using CampusAppWPortalLib8.Utility;
using CampusAppWPortalLib8.Resources;
/// <summary>
/// Model for a meal

View File

@@ -5,7 +5,7 @@
// <author>stubbfel</author>
// <sience>04.05.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.Mensa
namespace CampusAppWPortalLib8.Model.Mensa
{
using System;
using System.Collections.ObjectModel;

View File

@@ -5,9 +5,9 @@
// <author>stubbfel</author>
// <sience>03.05.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.Mensa
namespace CampusAppWPortalLib8.Model.Mensa
{
using CampusAppWP8ScheduledTaskAgent.Utility;
using CampusAppWPortalLib8.Utility;
using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
@@ -62,7 +62,6 @@ namespace CampusAppWP8ScheduledTaskAgent.Model.Mensa
#region Methods
/// <summary>
/// Method calculate this day of the week, which its gets new menus
/// </summary>

View File

@@ -5,7 +5,7 @@
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.RSS
namespace CampusAppWPortalLib8.Model.RSS
{
using System.Collections.ObjectModel;
using System.Collections.Specialized;

View File

@@ -5,7 +5,7 @@
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.RSS
namespace CampusAppWPortalLib8.Model.RSS
{
using System;
using System.Text;

View File

@@ -5,7 +5,7 @@
// <author>fiedlchr</author>
// <sience>24.06.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8ScheduledTaskAgent.Model.RSS
namespace CampusAppWPortalLib8.Model.RSS
{
using System;
using System.Collections.ObjectModel;

View File

@@ -5,7 +5,7 @@
// <author>stubbfel</author>
// <sience>06.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Utility
namespace CampusAppWPortalLib8.Model.Utility
{
/// <summary>
/// This class is a Model for the URLParameter like GET-Parameter

View File

@@ -5,7 +5,7 @@
// <author>stubbfel</author>
// <sience>17.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Utility
namespace CampusAppWPortalLib8.Model.Utility
{
/// <summary>
/// This class is a Model for the URLParameter like GET-Parameter

View File

@@ -0,0 +1,136 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18051
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CampusAppWPortalLib8.Resources {
using System;
using System.Reflection;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class AppResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal AppResources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWPortalLib8.Resources.AppResources", typeof(AppResources).GetTypeInfo().Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Aktion ähnelt.
/// </summary>
public static string MensaApp_Action {
get {
return ResourceManager.GetString("MensaApp_Action", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Bio ähnelt.
/// </summary>
public static string MensaApp_Bio {
get {
return ResourceManager.GetString("MensaApp_Bio", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 1 ähnelt.
/// </summary>
public static string MensaApp_Dinner1 {
get {
return ResourceManager.GetString("MensaApp_Dinner1", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 2 ähnelt.
/// </summary>
public static string MensaApp_Dinner2 {
get {
return ResourceManager.GetString("MensaApp_Dinner2", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 3 ähnelt.
/// </summary>
public static string MensaApp_Dinner3 {
get {
return ResourceManager.GetString("MensaApp_Dinner3", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 4 ähnelt.
/// </summary>
public static string MensaApp_Dinner4 {
get {
return ResourceManager.GetString("MensaApp_Dinner4", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Essen 5 ähnelt.
/// </summary>
public static string MensaApp_Dinner5 {
get {
return ResourceManager.GetString("MensaApp_Dinner5", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Suppe ähnelt.
/// </summary>
public static string MensaApp_Soup {
get {
return ResourceManager.GetString("MensaApp_Soup", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MensaApp_Action" xml:space="preserve">
<value>Aktion</value>
</data>
<data name="MensaApp_Bio" xml:space="preserve">
<value>Bio</value>
</data>
<data name="MensaApp_Dinner1" xml:space="preserve">
<value>Essen 1</value>
</data>
<data name="MensaApp_Dinner2" xml:space="preserve">
<value>Essen 2</value>
</data>
<data name="MensaApp_Dinner3" xml:space="preserve">
<value>Essen 3</value>
</data>
<data name="MensaApp_Dinner4" xml:space="preserve">
<value>Essen 4</value>
</data>
<data name="MensaApp_Dinner5" xml:space="preserve">
<value>Essen 5</value>
</data>
<data name="MensaApp_Soup" xml:space="preserve">
<value>Suppe</value>
</data>
</root>

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,64 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.18051
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CampusAppWPortalLib8.Resources {
using System;
using System.Reflection;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Constants {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Constants() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CampusAppWPortalLib8.Resources.Constants", typeof(Constants).GetTypeInfo().Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace CampusAppWPortalLib8.Utility
{
public abstract class AbstractBackgroundTasks
{
protected static string LastAddedTaskName {get; set;}
}
}

View File

@@ -0,0 +1,75 @@
//-----------------------------------------------------------------------
// <copyright file="HttpRequest.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>10.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Utility
{
using System;
using System.Collections.Generic;
using System.Net;
using CampusAppWPortalLib8.Model.Utility;
/// <summary>
/// Class realize the access of restful HttpRequest
/// </summary>
public abstract class AbstractHttpRequest
{
#region Member
/// <summary>
/// BaseAddress of the webClient
/// </summary>
private string baseAddress;
#endregion
#region property
protected string BaseAddress
{
get
{
return this.baseAddress;
}
set
{
if (value != this.baseAddress)
{
this.baseAddress = value;
}
}
}
#endregion
#region Methods
/// <summary>
/// Method create the Url for the http-get-method
/// </summary>
/// <param name="parameters"> list of parameters</param>
/// <returns>absolute API-Url include GetParameter</returns>
public Uri CreateGetUrl(List<UrlParamModel> parameters)
{
string paramterStr = string.Empty;
string seperator = string.Empty;
foreach (UrlParamModel parameter in parameters)
{
if (string.Empty.Equals(seperator))
{
seperator = parameter.ParamToken;
}
paramterStr += parameter.ToString();
}
string getUrlStr = this.baseAddress + seperator + paramterStr;
return new Uri(getUrlStr, UriKind.Absolute);
}
#endregion
}
}

View File

@@ -1,154 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="NDEFMessage.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>21.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Utility.NDEF
{
using System.Collections.Generic;
using System.IO;
/// <summary>Ndef message.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public class NDEFMessage
{
#region Members
/// <summary>The records.</summary>
private List<NDEFRecord> records;
#endregion
#region constructors
/// <summary>Initializes a new instance of the NDEFMessage class.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <param name="content">The content.</param>
/// <param name="type"> The type.</param>
/// <param name="tnf"> (Optional) the tnf.</param>
public NDEFMessage(string content, TYPEVAL type, NDEFRecord.TNFVAL tnf = NDEFRecord.TNFVAL.WKT)
{
this.records = new List<NDEFRecord>();
float recordsCount = (float)content.Length / NDEFRecord.MaxRecordPayLoad;
NDEFRecord tmpRecord = null;
string praefix = NDEFMessage.GetPraefix(type);
for (int i = 0; recordsCount > 0; i++)
{
tmpRecord = new NDEFShortRecord();
tmpRecord.Type = type;
tmpRecord.TNF = tnf;
tmpRecord.PayloadPraefix = praefix;
int recordsize = 255;
if (content.Length < (i + 1) * recordsize)
{
recordsize = content.Length - (i * recordsize);
}
tmpRecord.Payload = content.Substring(i * 255, recordsize);
if (i == 0)
{
tmpRecord.MB = NDEFRecord.NDEFFlags.MBSET;
}
this.records.Add(tmpRecord);
recordsCount--;
}
this.records[this.records.IndexOf(tmpRecord)].ME = NDEFRecord.NDEFFlags.MESET;
}
/// <summary>Initializes a new instance of the NDEFMessage class.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <param name="array">The array.</param>
public NDEFMessage(byte[] array)
{
this.records = new List<NDEFRecord>();
NDEFRecord tmpRecord = null;
for (int i = 0; i < array.Length; i += tmpRecord.RecordSize)
{
tmpRecord = new NDEFShortRecord(array, i);
this.records.Add(tmpRecord);
}
}
#endregion
#region enum
/// <summary>Values that represent TYPEVAL.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public enum TYPEVAL
{
/// <summary>An enum constant representing the empty option.</summary>
EMPTY = 0x00,
/// <summary>An enum constant representing the URL option.</summary>
URL = 0x55,
/// <summary>An enum constant representing the text option.</summary>
TEXT = 0x54,
}
#endregion
#region Methods
/// <summary>Gets a praefix.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <param name="type">The type.</param>
/// <returns>The praefix.</returns>
public static string GetPraefix(TYPEVAL type)
{
string praefix = string.Empty;
switch (type)
{
case TYPEVAL.TEXT:
praefix = "\x02" + "de";
break;
case TYPEVAL.URL:
praefix = "\x01";
break;
default:
break;
}
return praefix;
}
/// <summary>Gets the content.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <returns>The content.</returns>
public string GetContent()
{
string result = string.Empty;
foreach (NDEFRecord record in this.records)
{
result += record.Payload;
}
return result;
}
/// <summary>Converts this object to a byte array.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <returns>This object as a byte[].</returns>
public byte[] ToByteArray()
{
MemoryStream ms = new MemoryStream();
foreach (NDEFRecord record in this.records)
{
ms.Write(record.ToByteArray(), 0, record.RecordSize);
}
return ms.ToArray();
}
#endregion
}
}

View File

@@ -1,188 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="NDEFRecord.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>21.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Utility.NDEF
{
using System.IO;
using System.Text;
/// <summary>Ndef record of a NDEFMessage.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public abstract class NDEFRecord
{
#region Members
/// <summary>The maximum record pay load.</summary>
public const int MaxRecordPayLoad = 255;
/// <summary>Size of the type.</summary>
protected const byte TypeSize = 0x01;
#endregion
#region Constructors
/// <summary>Initializes a new instance of the NDEFRecord class.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public NDEFRecord()
{
}
/// <summary>Initializes a new instance of the NDEFRecord class.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <param name="array">The array.</param>
/// <param name="index">(Optional) zero-based index of the.</param>
public NDEFRecord(byte[] array, int index = 0)
{
this.FormatFlags = array[index];
}
#endregion
#region enum
/// <summary>Values that represent NDEFFlags.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public enum NDEFFlags
{
/// <summary>An Enum constant representing the UNSET option.</summary>
UNSET = 0x00,
/// <summary>An Enum constant representing the Message begin option.</summary>
MBSET = 0x80,
/// <summary>An Enum constant representing the Message end option.</summary>
MESET = 0x40,
/// <summary>An Enum constant representing the CHUNK FLAG option.</summary>
CFSET = 0x20,
/// <summary>An Enum constant representing the Short Record set option.</summary>
SRSET = 0x10,
/// <summary>An Enum constant representing the ID length option.</summary>
ILSET = 0x08,
/// <summary>An enum constant representing the tnfset option.</summary>
TNFSET = 0x03
}
/// <summary>Values that represent TNFVAL.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public enum TNFVAL
{
/// <summary>An enum constant representing the empty option.</summary>
EMPTY = 0x00,
/// <summary>An enum constant representing the Well-Know-Type option.</summary>
WKT = 0x01,
/// <summary>An enum constant representing the MediaType option.</summary>
MEDIATYPE = 0x02,
/// <summary>An enum constant representing the URI option.</summary>
URI = 0x03,
/// <summary>An enum constant representing the NFCE option.</summary>
NFCE = 0x04,
/// <summary>An enum constant representing the unknow option.</summary>
unknow = 0x05,
/// <summary>An enum constant representing the unchanged option.</summary>
UNCHANGED = 0x06,
/// <summary>An enum constant representing the reserved option.</summary>
RESERVED = 0x07
}
#endregion
#region Properties
/// <summary>Gets or sets the MBFlag.</summary>
/// <value>The MBFlag.</value>
public NDEFFlags MB { get; set; }
/// <summary>Gets or sets MEFlag.</summary>
/// <value>The MEFlag .</value>
public NDEFFlags ME { get; set; }
/// <summary>Gets or sets the CFFlag.</summary>
/// <value>The CFFlag.</value>
public NDEFFlags CF { get; set; }
/// <summary>Gets or sets the SRFlag.</summary>
/// <value>The SRFlag.</value>
public NDEFFlags SR { get; set; }
/// <summary>Gets or sets the ILFlag.</summary>
/// <value>The ILFlag.</value>
public NDEFFlags IL { get; set; }
/// <summary>Gets or sets the TNFField.</summary>
/// <value>The TNFField.</value>
public TNFVAL TNF { get; set; }
/// <summary>Gets or sets the type.</summary>
/// <value>The type.</value>
public NDEFMessage.TYPEVAL Type { get; set; }
/// <summary>Gets or sets the format flags.</summary>
/// <value>The format flags.</value>
public byte FormatFlags
{
get
{
return (byte)((byte)this.TNF | ((byte)this.MB) | ((byte)this.ME) | ((byte)this.CF) | ((byte)this.SR) | ((byte)this.IL));
}
protected set
{
this.TNF = (TNFVAL)(value & (byte)NDEFFlags.TNFSET);
this.MB = (NDEFFlags)(value & (byte)NDEFFlags.MBSET);
this.ME = (NDEFFlags)(value & (byte)NDEFFlags.MESET);
this.CF = (NDEFFlags)(value & (byte)NDEFFlags.CFSET);
this.SR = (NDEFFlags)(value & (byte)NDEFFlags.SRSET);
this.IL = (NDEFFlags)(value & (byte)NDEFFlags.ILSET);
}
}
/// <summary>Gets or sets the payload.</summary>
/// <value>The payload.</value>
public string Payload { get; set; }
/// <summary>Gets the size of the record.</summary>
/// <value>The size of the record.</value>
public int RecordSize
{
get
{
return this.HeaderSize + this.Payload.Length + this.PayloadPraefix.Length;
}
}
/// <summary>Gets or sets the payload praefix.</summary>
/// <value>The payload praefix.</value>
public string PayloadPraefix { get; set; }
/// <summary>Gets or sets the size of the header.</summary>
/// <value>The size of the header.</value>
protected int HeaderSize { get; set; }
#endregion
#region Methods
/// <summary>Converts the record to a byte array.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <returns>This object as a byte[].</returns>
public abstract byte[] ToByteArray();
#endregion
}
}
// End of Utility\NDEF\NDEFRecord.cs

View File

@@ -1,63 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="NDEFShortRecord.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>21.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Utility.NDEF
{
using System.Text;
/// <summary>Ndef short record.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public class NDEFShortRecord : NDEFRecord
{
/// <summary>Initializes a new instance of the NDEFShortRecord class.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
public NDEFShortRecord()
{
this.HeaderSize = 4;
this.SR = NDEFFlags.SRSET;
this.IL = NDEFFlags.UNSET;
this.CF = NDEFFlags.UNSET;
}
/// <summary>Initializes a new instance of the NDEFShortRecord class.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <param name="array">The array.</param>
/// <param name="index">(Optional) zero-based index of the.</param>
public NDEFShortRecord(byte[] array, int index = 0)
: base(array)
{
this.HeaderSize = 4;
this.Type = (NDEFMessage.TYPEVAL)array[index + 3];
this.PayloadPraefix = NDEFMessage.GetPraefix(this.Type);
int payLoadSize = array[index + 2] - this.PayloadPraefix.Length;
this.Payload = Encoding.UTF8.GetString(array, index + this.HeaderSize + this.PayloadPraefix.Length, payLoadSize);
}
/// <summary>Converts this NDEFShortRecord to a byte array.</summary>
/// <remarks>Stubbfel, 21.08.2013.</remarks>
/// <returns>This object as a byte[].</returns>
public override byte[] ToByteArray()
{
byte[] payloadAr = Encoding.UTF8.GetBytes(this.PayloadPraefix + this.Payload);
byte[] array = new byte[payloadAr.Length + this.HeaderSize];
array[0] = this.FormatFlags;
array[1] = NDEFRecord.TypeSize;
array[2] = (byte)(Payload.Length + this.PayloadPraefix.Length);
array[3] = (byte)this.Type;
int i = this.HeaderSize;
foreach (byte b in payloadAr)
{
array[i] = b;
i++;
}
return array;
}
}
}

View File

@@ -54,6 +54,16 @@ namespace CampusAppWPortalLib8.Utility
{
return str.TrimEnd('\n');
}
public static string ToShortString(string longStr, int maxLenght)
{
string shortStr = longStr;
if (shortStr.Length > maxLenght)
{
shortStr = shortStr.Substring(0, maxLenght);
}
return shortStr;
}
#endregion
}
}