add docs
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -25,6 +25,7 @@
|
||||
*.csproj -text merge=union
|
||||
*.sln -text merge=union
|
||||
*.resx -text merge=union
|
||||
*.StyleCop -text merge=union
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
|
||||
@@ -269,7 +269,6 @@
|
||||
</Compile>
|
||||
<Compile Include="ThemelizedIcons.cs" />
|
||||
<Compile Include="Utility\File.cs" />
|
||||
<Compile Include="Utility\Logger.cs" />
|
||||
<Compile Include="Utility\HttpRequest.cs" />
|
||||
<Compile Include="Utility\Lui\Button\GoToMapButton.cs" />
|
||||
<Compile Include="Utility\Lui\Button\UpdateButtonAppBar.cs" />
|
||||
@@ -281,11 +280,10 @@
|
||||
<Compile Include="Pages\Dev\QRScanner.xaml.cs">
|
||||
<DependentUpon>QRScanner.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\StringManager.cs" />
|
||||
<Compile Include="Utility\Wp8StringManager.cs" />
|
||||
<Compile Include="Utility\Utilities.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Utility\XmlManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace CampusAppWP8.File.Places
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.GeoDb;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
|
||||
/// <summary>Places file.</summary>
|
||||
/// <remarks>Stubbfel, 09.09.2013.</remarks>
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace CampusAppWP8.Model.Exams
|
||||
{
|
||||
get
|
||||
{
|
||||
return StringManager.StripHTML(this.CourseText + " (" + this.Type + "/" + this.Version + ")");
|
||||
return Wp8StringManager.StripAndDecodeHTML(this.CourseText + " (" + this.Type + "/" + this.Version + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace CampusAppWP8.Model.GeoDb
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a place of the SPSService
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace CampusAppWP8.Model.Lecture
|
||||
{
|
||||
if (value != this.topic)
|
||||
{
|
||||
this.topic = StringManager.StripHTML(value);
|
||||
this.topic = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,10 +228,10 @@ namespace CampusAppWP8.Model.Lecture
|
||||
string result = string.Empty;
|
||||
foreach (LectureLecturer tmpLecturer in this.Lecturer)
|
||||
{
|
||||
result += StringManager.AddNewLine(tmpLecturer.ToString());
|
||||
result += Wp8StringManager.AddNewLine(tmpLecturer.ToString());
|
||||
}
|
||||
|
||||
this.LecturerString = StringManager.RemoveNewLine(result);
|
||||
this.LecturerString = Wp8StringManager.RemoveNewLine(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,10 +242,10 @@ namespace CampusAppWP8.Model.Lecture
|
||||
string result = string.Empty;
|
||||
foreach (LectureCourse course in this.Course)
|
||||
{
|
||||
result += StringManager.AddNewLine(course.Title);
|
||||
result += Wp8StringManager.AddNewLine(course.Title);
|
||||
}
|
||||
|
||||
this.CourseString = StringManager.RemoveNewLine(result);
|
||||
this.CourseString = Wp8StringManager.RemoveNewLine(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != null && value != string.Empty && value != this.tel1)
|
||||
{
|
||||
this.tel1 = StringManager.CreateUniTelefonNumber(value);
|
||||
this.tel1 = Wp8StringManager.CreateUniTelefonNumber(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != null && value != string.Empty && value != this.tel2)
|
||||
{
|
||||
this.tel2 = StringManager.CreateUniTelefonNumber(value);
|
||||
this.tel2 = Wp8StringManager.CreateUniTelefonNumber(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != null && value != string.Empty && value != this.fax)
|
||||
{
|
||||
this.fax = StringManager.CreateUniTelefonNumber(value);
|
||||
this.fax = Wp8StringManager.CreateUniTelefonNumber(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != this.function)
|
||||
{
|
||||
this.function = StringManager.StripHTML(value);
|
||||
this.function = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != this.appointment)
|
||||
{
|
||||
this.appointment = StringManager.StripHTML(value);
|
||||
this.appointment = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != this.building)
|
||||
{
|
||||
this.building = StringManager.StripHTML(value);
|
||||
this.building = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ namespace CampusAppWP8.Model.Person
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null && value != this.mail && StringManager.IsValidEmail(value))
|
||||
if (value != null && value != this.mail && Wp8StringManager.IsValidEmail(value))
|
||||
{
|
||||
this.mail = value;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != this.akadgrad)
|
||||
{
|
||||
this.akadgrad = StringManager.StripHTML(value);
|
||||
this.akadgrad = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != this.surName)
|
||||
{
|
||||
this.surName = StringManager.StripHTML(value);
|
||||
this.surName = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ namespace CampusAppWP8.Model.Person
|
||||
{
|
||||
if (value != this.firstName)
|
||||
{
|
||||
this.firstName = StringManager.StripHTML(value);
|
||||
this.firstName = Wp8StringManager.StripAndDecodeHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CampusAppWP8.Feed.Exams;
|
||||
using CampusAppWP8.Feed.Utility;
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
@@ -147,7 +146,7 @@ namespace CampusAppWP8.Model.Utility
|
||||
{
|
||||
foreach (CourseModel course in courseList)
|
||||
{
|
||||
this.AddItem(new ListPickerItemModel(course.CourseNumber, StringManager.StripHTML(course.CourseText)));
|
||||
this.AddItem(new ListPickerItemModel(course.CourseNumber, Wp8StringManager.StripAndDecodeHTML(course.CourseText)));
|
||||
}
|
||||
|
||||
this.List = this.List.OrderBy(o => o.Text).ToList();
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
// <sience>05.07.2013</sience>
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model
|
||||
{
|
||||
{
|
||||
using System.Text;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Xml model io handler class.
|
||||
|
||||
@@ -273,10 +273,10 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
{
|
||||
msgText += AppResources.PlaceLabel_Name + ": ";
|
||||
msgText += place.GetInformationsValue(Constants.PisInformationName_Name);
|
||||
msgText = StringManager.AddNewLine(msgText);
|
||||
msgText = Wp8StringManager.AddNewLine(msgText);
|
||||
msgText += AppResources.PlaceLabel_ShortDesc + ": ";
|
||||
msgText += place.GetInformationsValue(Constants.PisInformationName_ShortDesc);
|
||||
msgText = StringManager.AddNewLine(msgText);
|
||||
msgText = Wp8StringManager.AddNewLine(msgText);
|
||||
}
|
||||
|
||||
MessageBoxes.ShowMainModelInfoMessageBox(msgText);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CampusAppWP8.Pages.Setting
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Setting;
|
||||
using CampusAppWP8.Model.Utility;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
<StyleCopSettings Version="105">
|
||||
<GlobalSettings>
|
||||
<CollectionProperty Name="RecognizedWords">
|
||||
<Value>akadgrad</Value>
|
||||
<Value>api</Value>
|
||||
<Value>apis</Value>
|
||||
<Value>enum</Value>
|
||||
<Value>initialise</Value>
|
||||
<Value>initialises</Value>
|
||||
<Value>ndef</Value>
|
||||
<Value>ndefs</Value>
|
||||
<Value>nfc</Value>
|
||||
<Value>param</Value>
|
||||
<Value>pid</Value>
|
||||
<Value>pids</Value>
|
||||
<Value>pis</Value>
|
||||
<Value>prev</Value>
|
||||
<Value>pss</Value>
|
||||
<Value>Senftenberg</Value>
|
||||
<Value>sps</Value>
|
||||
<Value>Stubbfel</Value>
|
||||
<Value>uni</Value>
|
||||
<Value>wifi</Value>
|
||||
</CollectionProperty>
|
||||
</GlobalSettings>
|
||||
<StyleCopSettings Version="105">
|
||||
<GlobalSettings>
|
||||
<CollectionProperty Name="RecognizedWords">
|
||||
<Value>akadgrad</Value>
|
||||
<Value>api</Value>
|
||||
<Value>apis</Value>
|
||||
<Value>enum</Value>
|
||||
<Value>initialise</Value>
|
||||
<Value>initialises</Value>
|
||||
<Value>ndef</Value>
|
||||
<Value>ndefs</Value>
|
||||
<Value>nfc</Value>
|
||||
<Value>param</Value>
|
||||
<Value>perodic</Value>
|
||||
<Value>pid</Value>
|
||||
<Value>pids</Value>
|
||||
<Value>pis</Value>
|
||||
<Value>prev</Value>
|
||||
<Value>pss</Value>
|
||||
<Value>Senftenberg</Value>
|
||||
<Value>sps</Value>
|
||||
<Value>Stubbfel</Value>
|
||||
<Value>uni</Value>
|
||||
<Value>wifi</Value>
|
||||
</CollectionProperty>
|
||||
</GlobalSettings>
|
||||
</StyleCopSettings>
|
||||
@@ -1,28 +1,43 @@
|
||||
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;
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="BackgroundTasks.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>18.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using CampusAppWP8ScheduledTaskAgent.Resources;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using Microsoft.Phone.Scheduler;
|
||||
|
||||
/// <summary>
|
||||
/// Class provide some static methods for background tasks
|
||||
/// </summary>
|
||||
public class BackgroundTasks : AbstractBackgroundTasks
|
||||
{
|
||||
public static void StartPerodicTask(string taskName, string taskDesc) {
|
||||
/// <summary>
|
||||
/// Method start a certain PerodicTask
|
||||
/// </summary>
|
||||
/// <param name="taskName">name of the task</param>
|
||||
/// <param name="taskDesc">description of the task</param>
|
||||
public static void StartPerodicTask(string taskName, string taskDesc)
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(BackgroundTasks.LastAddedTaskName);
|
||||
BackgroundTasks.StopPerodicTask(taskName);
|
||||
|
||||
PeriodicTask periodicTask = new PeriodicTask(taskName);
|
||||
|
||||
// load description from localized strings
|
||||
periodicTask.Description = taskDesc;
|
||||
|
||||
try
|
||||
{
|
||||
ScheduledActionService.Add(periodicTask);
|
||||
ScheduledActionService.LaunchForTest(taskName, new TimeSpan(10));
|
||||
|
||||
// ScheduledActionService.LaunchForTest(taskName, new TimeSpan(10));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -33,6 +48,10 @@ namespace CampusAppWP8.Utility
|
||||
BackgroundTasks.LastAddedTaskName = taskName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method stop a certain PerodicTask
|
||||
/// </summary>
|
||||
/// <param name="taskName">name of the task</param>
|
||||
public static void StopPerodicTask(string taskName)
|
||||
{
|
||||
if (taskName == null)
|
||||
@@ -54,33 +73,50 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method start MensaBackgroundTask
|
||||
/// </summary>
|
||||
public static void StartMensaTask()
|
||||
{
|
||||
int campusId = (int)Settings.UserProfil.DefaultCampus;
|
||||
BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_Mensa, AppResources.BackGroundTaskDesc_Mensa + " - Feed " + campusId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method stop MensaBackgroundTask
|
||||
/// </summary>
|
||||
public static void StopMensaTask()
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Mensa);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method start EventBackgroundTask
|
||||
/// </summary>
|
||||
public static void StartEventTask()
|
||||
{
|
||||
BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_Event, AppResources.BackGroundTaskDesc_Event);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method stop EventBackgroundTask
|
||||
/// </summary>
|
||||
public static void StopEventTask()
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Event);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Method start NewsBackgroundTask
|
||||
/// </summary>
|
||||
public static void StartNewsTask()
|
||||
{
|
||||
BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_News, AppResources.BackGroundTaskDesc_News);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method stop NewsBackgroundTask
|
||||
/// </summary>
|
||||
public static void StopNewsTask()
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_News);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace CampusAppWP8.Utility
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using Windows.Storage;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// <copyright file="Logger.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.05.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// This Class creates logs for the app
|
||||
/// </summary>
|
||||
public class Logger
|
||||
{
|
||||
#region Method
|
||||
|
||||
/// <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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,104 +1,163 @@
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Scheduler;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="TileCreator.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>18.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Utility.Lui.Tiles
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Class creates different live tiles
|
||||
/// </summary>
|
||||
public class TileCreator
|
||||
{
|
||||
public static void CreateIconicTile(string title, string path, string iconUrl, string smallIcon, string wContent1 = null, string wContent2 = null, string wContent3 = null)
|
||||
/// <summary>
|
||||
/// Method creates an IconicTile
|
||||
/// </summary>
|
||||
/// <param name="title">title of the tile</param>
|
||||
/// <param name="path">path the the page</param>
|
||||
/// <param name="iconUrl">icon url of the main icon</param>
|
||||
/// <param name="smallIcon">icon url of the small icon</param>
|
||||
/// <param name="wideContent1">string for the wide content 1</param>
|
||||
/// <param name="wideContent2">string for the wide content 2</param>
|
||||
/// <param name="wideContent3">string for the wide content 3</param>
|
||||
public static void CreateIconicTile(string title, string path, string iconUrl, string smallIcon, string wideContent1 = null, string wideContent2 = null, string wideContent3 = null)
|
||||
{
|
||||
IconicTileData iconTile = new IconicTileData();
|
||||
iconTile.Title = title;
|
||||
iconTile.WideContent1 = wideContent1;
|
||||
iconTile.WideContent2 = wideContent2;
|
||||
iconTile.WideContent3 = wideContent3;
|
||||
|
||||
IconicTileData oIcontile = new IconicTileData();
|
||||
oIcontile.Title = title;
|
||||
oIcontile.WideContent1 = wContent1;
|
||||
oIcontile.WideContent2 = wContent2;
|
||||
oIcontile.WideContent3 = wContent3;
|
||||
|
||||
oIcontile.IconImage = new Uri(iconUrl, UriKind.Relative);
|
||||
oIcontile.SmallIconImage = new Uri(smallIcon, UriKind.Relative);
|
||||
iconTile.IconImage = new Uri(iconUrl, UriKind.Relative);
|
||||
iconTile.SmallIconImage = new Uri(smallIcon, UriKind.Relative);
|
||||
|
||||
// find the tile object for the application tile that using "Iconic" contains string in it.
|
||||
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(path));
|
||||
ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(path));
|
||||
|
||||
if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(path))
|
||||
if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(path))
|
||||
{
|
||||
TileToFind.Delete();
|
||||
tileToFind.Delete();
|
||||
}
|
||||
|
||||
ShellTile.Create(new Uri(path, UriKind.Relative), oIcontile, true);
|
||||
ShellTile.Create(new Uri(path, UriKind.Relative), iconTile, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the MensaTile
|
||||
/// </summary>
|
||||
public static void CreateMensaTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.MensaApp_Title, Constants.PathMensa_MensaPage, Icons.Mensa, Icons.Mensa);
|
||||
|
||||
|
||||
// create a new task
|
||||
BackgroundTasks.StartMensaTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the MailTile
|
||||
/// </summary>
|
||||
public static void CreateWebMailTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.MailApp_Title, Constants.PathMail_WebMailPage, Icons.WebMail, Icons.WebMail);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the NewsTile
|
||||
/// </summary>
|
||||
public static void CreateNewsTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.NewsApp_Title, Constants.PathNews_NewsIndexPage, Icons.News, Icons.News);
|
||||
|
||||
// create a new Task
|
||||
BackgroundTasks.StartNewsTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the LectureTile
|
||||
/// </summary>
|
||||
public static void CreateLectureTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.LectureApp_Title, Constants.PathLecture_LecturePage, Icons.Lectures, Icons.Lectures);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the EventTile
|
||||
/// </summary>
|
||||
public static void CreateEventTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.EventApp_Title, Constants.PathEvents_EventsIndexPage, Icons.News, Icons.News);
|
||||
|
||||
// create a new taskk
|
||||
BackgroundTasks.StartEventTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the DepartmentTile
|
||||
/// </summary>
|
||||
public static void CreateDepartmentTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.DepartmentApp_Title, Constants.PathDepartment_DepartmentIndexPage, Icons.Departments, Icons.Departments);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the OpeningHoursTile
|
||||
/// </summary>
|
||||
public static void CreateOpeningHoursTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.OpenHoursApp_Title, Constants.PathOpeninghours_OpeninghoursPage, Icons.Openhours, Icons.Openhours);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the linkTile
|
||||
/// </summary>
|
||||
public static void CreateLinkTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.LinkApp_Title, Constants.PathLinks_LinkPage, Icons.Link, Icons.Link);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the StudentCouncilTile
|
||||
/// </summary>
|
||||
public static void CreateStudentCouncilTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.OSAApp_Title, Constants.PathStudentCouncil_StudentCouncilPage, Icons.StudentCouncil, Icons.StudentCouncil);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the ExamsTile
|
||||
/// </summary>
|
||||
public static void CreateExamsTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.ExaminationApp_Header, Constants.PathExams_ExamsPage, Icons.Exams, Icons.Exams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the PersonTile
|
||||
/// </summary>
|
||||
public static void CreatePersonTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.PersonApp_Title, Constants.PathPerson_Person, Icons.Person, Icons.Person);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the PlaceNewsTile
|
||||
/// </summary>
|
||||
public static void CreatePlaceNewsTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.PlaceNewsApp_Title, Constants.PathPlaceNews_PlaceNewsPage, Icons.News, Icons.News);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method creates the CampusMapTile
|
||||
/// </summary>
|
||||
public static void CreateCampusMapTile()
|
||||
{
|
||||
TileCreator.CreateIconicTile(AppResources.CampusMapApp_Title, Constants.PathCampusmap_Campusmap, Icons.Campus, Icons.Campus);
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace CampusAppWP8.Utility
|
||||
using System.Windows.Media;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Net.NetworkInformation;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of utility functions.
|
||||
|
||||
29
CampusAppWP8/CampusAppWP8/Utility/Wp8StringManager.cs
Normal file
29
CampusAppWP8/CampusAppWP8/Utility/Wp8StringManager.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="Wp8StringManager.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>06.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class provides some special StringMethods
|
||||
/// </summary>
|
||||
public class Wp8StringManager : CampusAppWPortalLib8.Utility.DefaultStringManager
|
||||
{
|
||||
/// <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 StripAndDecodeHTML(string inputString)
|
||||
{
|
||||
return System.Net.HttpUtility.HtmlDecode(Wp8StringManager.StripHTML(inputString));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="XmlManager.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>18.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Class provides some Xml-methods
|
||||
/// </summary>
|
||||
public class XmlManager
|
||||
{
|
||||
#region Method
|
||||
|
||||
/// <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>
|
||||
/// <remarks>Stubbfel, 12.09.2013.</remarks>
|
||||
/// <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;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,55 @@
|
||||
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;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="ScheduledAgent.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>18.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8ScheduledTaskAgent
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Class for agent of the BackgroundTask
|
||||
/// </summary>
|
||||
public class ScheduledAgent : ScheduledTaskAgent
|
||||
{
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// Model for the mensa feed
|
||||
/// </summary>
|
||||
private MenuWeekModel mensaModel;
|
||||
|
||||
/// <summary>
|
||||
/// Model for the event feed
|
||||
/// </summary>
|
||||
private RSSViewModel eventModel;
|
||||
|
||||
/// <summary>
|
||||
/// Model for the news feed
|
||||
/// </summary>
|
||||
private RSSViewModel newsModel;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes static members of the <see cref="ScheduledAgent" /> class.
|
||||
/// </summary>
|
||||
static ScheduledAgent()
|
||||
{
|
||||
Deployment.Current.Dispatcher.BeginInvoke(delegate
|
||||
@@ -30,14 +58,16 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
});
|
||||
}
|
||||
|
||||
private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
|
||||
/// <summary>
|
||||
/// override OnInvoke
|
||||
/// </summary>
|
||||
/// <param name="task">the background Task</param>
|
||||
protected override void OnInvoke(ScheduledTask task)
|
||||
{
|
||||
switch (task.Name)
|
||||
@@ -53,10 +83,30 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
case "NewsTask":
|
||||
this.HandleNewsTask(task);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
/// Method handle UnhandledException
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of Exception</param>
|
||||
/// <param name="e">Exception Args</param>
|
||||
private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method handle the EventBackgroundTask
|
||||
/// </summary>
|
||||
/// <param name="task">the eventTask</param>
|
||||
private void HandleEventTask(ScheduledTask task)
|
||||
{
|
||||
if (this.eventModel == null || !this.CheckRssIsUpToDate(this.eventModel.CreateTime))
|
||||
@@ -67,10 +117,14 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateEventTile();
|
||||
this.UpdateEventTile();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method handle the NewsBackgroundTask
|
||||
/// </summary>
|
||||
/// <param name="task">the newsTask</param>
|
||||
private void HandleNewsTask(ScheduledTask task)
|
||||
{
|
||||
if (this.newsModel == null || !this.CheckRssIsUpToDate(this.newsModel.CreateTime))
|
||||
@@ -81,75 +135,97 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateNewsTile();
|
||||
this.UpdateNewsTile();
|
||||
}
|
||||
}
|
||||
|
||||
private void GetEventIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
|
||||
/// <summary>
|
||||
/// ResponseHandler for the EventFeed
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the Event</param>
|
||||
/// <param name="arg">Event Args</param>
|
||||
private void GetEventIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg)
|
||||
{
|
||||
if (arg2.Result != null)
|
||||
if (arg.Result != null)
|
||||
{
|
||||
this.eventModel = XmlManager.DeserializationToModel<RSSViewModel>(arg2.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
|
||||
this.updateEventTile();
|
||||
this.eventModel = XmlManager.DeserializationToModel<RSSViewModel>(arg.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
|
||||
this.UpdateEventTile();
|
||||
}
|
||||
}
|
||||
|
||||
private void GetNewsIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
|
||||
/// <summary>
|
||||
/// ResponseHandler for the NewsFeed
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the Event</param>
|
||||
/// <param name="arg">Event Args</param>
|
||||
private void GetNewsIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg)
|
||||
{
|
||||
if (arg2.Result != null)
|
||||
if (arg.Result != null)
|
||||
{
|
||||
this.newsModel = XmlManager.DeserializationToModel<RSSViewModel>(arg2.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
|
||||
this.updateNewsTile();
|
||||
this.newsModel = XmlManager.DeserializationToModel<RSSViewModel>(arg.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
|
||||
this.UpdateNewsTile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateNewsTile()
|
||||
/// <summary>
|
||||
/// Method update the NewsTile
|
||||
/// </summary>
|
||||
private void UpdateNewsTile()
|
||||
{
|
||||
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage));
|
||||
ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage));
|
||||
|
||||
if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage))
|
||||
if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage))
|
||||
{
|
||||
IconicTileData data = new IconicTileData();
|
||||
Random random = new Random();
|
||||
int randomNumber = random.Next(0, this.newsModel.Channel[0].Item.Count);
|
||||
RSSModel item = this.newsModel.Channel[0].Item[randomNumber];
|
||||
data.WideContent1 = item.Date;
|
||||
data.WideContent2 = StringManager.ToShortString(item.Title, 30) + "...";
|
||||
data.WideContent3 = StringManager.ToShortString(item.Text, 30) + "...";
|
||||
data.WideContent2 = DefaultStringManager.ToShortString(item.Title, 40, "...");
|
||||
data.WideContent3 = DefaultStringManager.ToShortString(item.Text, 40, "...");
|
||||
data.Count = this.newsModel.Channel[0].Item.Count;
|
||||
TileToFind.Update(data);
|
||||
tileToFind.Update(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_News);
|
||||
}
|
||||
|
||||
this.NotifyComplete();
|
||||
}
|
||||
|
||||
private void updateEventTile()
|
||||
/// <summary>
|
||||
/// Method update the EventTile
|
||||
/// </summary>
|
||||
private void UpdateEventTile()
|
||||
{
|
||||
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage));
|
||||
ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage));
|
||||
|
||||
if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage))
|
||||
if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage))
|
||||
{
|
||||
IconicTileData data = new IconicTileData();
|
||||
Random random = new Random();
|
||||
int randomNumber = random.Next(0, this.eventModel.Channel[0].Item.Count);
|
||||
RSSModel item = this.eventModel.Channel[0].Item[randomNumber];
|
||||
data.WideContent1 = item.Date;
|
||||
data.WideContent2 = StringManager.ToShortString(item.Title, 30) + "...";
|
||||
data.WideContent3 = StringManager.ToShortString(item.Text, 30) + "...";
|
||||
data.WideContent2 = DefaultStringManager.ToShortString(item.Title, 40, "...");
|
||||
data.WideContent3 = DefaultStringManager.ToShortString(item.Text, 40, "...");
|
||||
data.Count = this.eventModel.Channel[0].Item.Count;
|
||||
TileToFind.Update(data);
|
||||
tileToFind.Update(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Event);
|
||||
}
|
||||
|
||||
this.NotifyComplete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the correct MensaFeed/Url
|
||||
/// </summary>
|
||||
/// <param name="mensaTaskDesc">the Description of the MensaTask</param>
|
||||
/// <returns>Url of a mensa, which is set is in the UserProfile</returns>
|
||||
private Uri CalcMensaUrl(string mensaTaskDesc)
|
||||
{
|
||||
Uri url;
|
||||
@@ -176,6 +252,11 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method handle the MensaBackgroundTask
|
||||
/// </summary>
|
||||
/// <param name="task">the newsTask</param>
|
||||
private void HandleMensaTask(ScheduledTask task)
|
||||
{
|
||||
if (this.mensaModel == null || !this.CheckMensaIsUpToDate(this.mensaModel.CreateTime))
|
||||
@@ -186,25 +267,32 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateMensaTile();
|
||||
this.UpdateMensaTile();
|
||||
}
|
||||
}
|
||||
|
||||
private void GetMensaIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
|
||||
/// <summary>
|
||||
/// ResponseHandler for the MensaFeed
|
||||
/// </summary>
|
||||
/// <param name="sender">sender of the Event</param>
|
||||
/// <param name="arg">Event Args</param>
|
||||
private void GetMensaIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg)
|
||||
{
|
||||
if (arg2.Result != null)
|
||||
if (arg.Result != null)
|
||||
{
|
||||
this.mensaModel = XmlManager.DeserializationToModel<MenuWeekModel>(arg2.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
|
||||
this.updateMensaTile();
|
||||
this.mensaModel = XmlManager.DeserializationToModel<MenuWeekModel>(arg.Result, CampusAppWPortalLib8.Resources.Constants.XMLRootElementName);
|
||||
this.UpdateMensaTile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateMensaTile()
|
||||
/// <summary>
|
||||
/// Method update the NewsTile
|
||||
/// </summary>
|
||||
private void UpdateMensaTile()
|
||||
{
|
||||
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage));
|
||||
ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage));
|
||||
|
||||
if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage))
|
||||
if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage))
|
||||
{
|
||||
IconicTileData data = new IconicTileData();
|
||||
DateTime now = DateTime.Now;
|
||||
@@ -228,20 +316,27 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
{
|
||||
Random random = new Random();
|
||||
int randomNumber = random.Next(0, mealCount);
|
||||
data.WideContent3 = this.mensaModel.Menus[dayIndex].Meals[randomNumber].MealToShortString();
|
||||
MealModel meal = this.mensaModel.Menus[dayIndex].Meals[randomNumber];
|
||||
data.WideContent3 = meal.MealName + ": " + DefaultStringManager.ToShortString(meal.MealDesc, 30, "...");
|
||||
data.Count = this.mensaModel.Menus[dayIndex].Meals.Count;
|
||||
}
|
||||
}
|
||||
TileToFind.Update(data);
|
||||
|
||||
tileToFind.Update(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Mensa);
|
||||
}
|
||||
|
||||
this.NotifyComplete();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model of the mensa is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="lastModified"> Date of the last modification</param>
|
||||
/// <returns>true, if it is up-to-date, otherwise false</returns>
|
||||
private bool CheckMensaIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
int diff = lastModified.CompareTo(MenuWeekModel.CalcFirstWeekDay());
|
||||
@@ -254,6 +349,11 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model of the RSS feed is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="lastModified"> Date of the last modification</param>
|
||||
/// <returns>true, if it is up-to-date, otherwise false</returns>
|
||||
private bool CheckRssIsUpToDate(DateTime lastModified)
|
||||
{
|
||||
int diff = lastModified.CompareTo(DateTime.Now.AddDays(1));
|
||||
@@ -265,5 +365,9 @@ namespace CampusAppWP8ScheduledTaskAgent
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,26 @@
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using Microsoft.Phone.Scheduler;
|
||||
using System;
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="BackgroundTasks.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>18.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8ScheduledTaskAgent.Utility
|
||||
{
|
||||
using System;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using Microsoft.Phone.Scheduler;
|
||||
|
||||
/// <summary>
|
||||
/// Class provide some static methods for background tasks
|
||||
/// </summary>
|
||||
public class BackgroundTasks : AbstractBackgroundTasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Method stop a certain PerodicTask
|
||||
/// </summary>
|
||||
/// <param name="taskName">name of the task</param>
|
||||
public static void StopPerodicTask(string taskName)
|
||||
{
|
||||
PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>10.06.2013</sience>
|
||||
//----------------------------------------------------------------------using System;
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8ScheduledTaskAgent.Utility
|
||||
{
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
{
|
||||
using System;
|
||||
using System.Net;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Class realize the access of restful HttpRequest
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<Compile Include="Utility\AbstractHttpRequest.cs" />
|
||||
<Compile Include="Utility\AbstractBackgroundTasks.cs" />
|
||||
<Compile Include="Utility\Logger.cs" />
|
||||
<Compile Include="Utility\StringManager.cs" />
|
||||
<Compile Include="Utility\DefaultStringManager.cs" />
|
||||
<Compile Include="Utility\XmlManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
namespace CampusAppWPortalLib8.Model.Mensa
|
||||
{
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using CampusAppWPortalLib8.Resources;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Model for a meal
|
||||
@@ -135,7 +135,7 @@ namespace CampusAppWPortalLib8.Model.Mensa
|
||||
{
|
||||
if (value != this.mealDesc)
|
||||
{
|
||||
this.mealDesc = StringManager.StripHTML(value);
|
||||
this.mealDesc = DefaultStringManager.StripHTML(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,20 +144,6 @@ namespace CampusAppWPortalLib8.Model.Mensa
|
||||
|
||||
#region Methods
|
||||
|
||||
#region public
|
||||
|
||||
public string MealToShortString()
|
||||
{
|
||||
string shortDesc = this.mealDesc;
|
||||
if (shortDesc.Length > 30)
|
||||
{
|
||||
shortDesc = shortDesc.Substring(0, 30) + "...";
|
||||
|
||||
}
|
||||
return this.MealName + ": " + shortDesc;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Method create depends of the mealId the mealName
|
||||
/// </summary>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWPortalLib8.Model.Mensa
|
||||
{
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="DeTelPrefix" xml:space="preserve">
|
||||
<value>+49</value>
|
||||
</data>
|
||||
<data name="PathEvents_EventsIndexPage" xml:space="preserve">
|
||||
<value>/Pages/Events/EventIndexPage.xaml</value>
|
||||
</data>
|
||||
@@ -126,6 +129,9 @@
|
||||
<data name="PathNews_NewsIndexPage" xml:space="preserve">
|
||||
<value>/Pages/News/NewsIndexPage.xaml</value>
|
||||
</data>
|
||||
<data name="UniCBTelPrefix" xml:space="preserve">
|
||||
<value>035569</value>
|
||||
</data>
|
||||
<data name="UrlEvents_Addr" xml:space="preserve">
|
||||
<value>http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php</value>
|
||||
</data>
|
||||
|
||||
@@ -61,6 +61,15 @@ namespace CampusAppWPortalLib8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die +49 ähnelt.
|
||||
/// </summary>
|
||||
public static string DeTelPrefix {
|
||||
get {
|
||||
return ResourceManager.GetString("DeTelPrefix", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Events/EventIndexPage.xaml ähnelt.
|
||||
/// </summary>
|
||||
@@ -88,6 +97,15 @@ namespace CampusAppWPortalLib8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die 035569 ähnelt.
|
||||
/// </summary>
|
||||
public static string UniCBTelPrefix {
|
||||
get {
|
||||
return ResourceManager.GetString("UniCBTelPrefix", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
namespace CampusAppWPortalLib8.Utility
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="AbstractBackgroundTasks.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>18.09.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWPortalLib8.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// abstract class for BackGroundTask
|
||||
/// </summary>
|
||||
public abstract class AbstractBackgroundTasks
|
||||
{
|
||||
protected static string LastAddedTaskName {get; set;}
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the last running task
|
||||
/// </summary>
|
||||
protected static string LastAddedTaskName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="HttpRequest.cs" company="BTU/IIT">
|
||||
// <copyright file="AbstractHttpRequest.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
@@ -13,7 +13,7 @@ namespace CampusAppWPortalLib8.Utility
|
||||
using CampusAppWPortalLib8.Model.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Class realize the access of restful HttpRequest
|
||||
/// abstract Class provides some methods and member for HttpRequest
|
||||
/// </summary>
|
||||
public abstract class AbstractHttpRequest
|
||||
{
|
||||
@@ -28,6 +28,9 @@ namespace CampusAppWPortalLib8.Utility
|
||||
|
||||
#region property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets BaseAddress of the webClient
|
||||
/// </summary>
|
||||
protected string BaseAddress
|
||||
{
|
||||
get
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="StringManager.cs" company="BTU/IIT">
|
||||
// <copyright file="DefaultStringManager.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>06.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
namespace CampusAppWPortalLib8.Utility
|
||||
{
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWPortalLib8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class provides some special StringMethods
|
||||
/// </summary>
|
||||
public static class StringManager
|
||||
public class DefaultStringManager
|
||||
{
|
||||
#region Members
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace CampusAppWP8.Utility
|
||||
/// <returns>String without Html-Tags</returns>
|
||||
public static string StripHTML(string inputString)
|
||||
{
|
||||
string result = Regex.Replace(inputString, HtmlTagPattern, string.Empty);
|
||||
return System.Net.HttpUtility.HtmlDecode(result);
|
||||
return Regex.Replace(inputString, DefaultStringManager.HtmlTagPattern, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,7 +70,7 @@ namespace CampusAppWP8.Utility
|
||||
{
|
||||
return Regex.IsMatch(
|
||||
strIn,
|
||||
StringManager.EMailValidRegex,
|
||||
DefaultStringManager.EMailValidRegex,
|
||||
RegexOptions.IgnoreCase);
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -101,6 +100,24 @@ namespace CampusAppWP8.Utility
|
||||
result = Constants.DeTelPrefix + result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method create from a long string a short string
|
||||
/// </summary>
|
||||
/// <param name="longStr">the long input String</param>
|
||||
/// <param name="maxLenght">max length of the short string</param>
|
||||
/// <param name="suffix">(optional) suffix which added to the short string, when long string has to be cut</param>
|
||||
/// <returns>the shorted string</returns>
|
||||
public static string ToShortString(string longStr, int maxLenght, string suffix = "")
|
||||
{
|
||||
string shortStr = longStr;
|
||||
if (shortStr.Length > maxLenght)
|
||||
{
|
||||
shortStr = shortStr.Substring(0, maxLenght) + suffix;
|
||||
}
|
||||
|
||||
return shortStr;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace CampusAppWPortalLib8.Utility
|
||||
/// <param name="exception">exception which has to log</param>
|
||||
public static void LogException(Exception exception)
|
||||
{
|
||||
// Console.WriteLine(exception);
|
||||
// Console.WriteLine(exception);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -29,7 +29,7 @@ namespace CampusAppWPortalLib8.Utility
|
||||
/// <param name="msg">to be logged message</param>
|
||||
public static void LogMsg(string msg)
|
||||
{
|
||||
// Console.WriteLine(msg);
|
||||
// Console.WriteLine(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="StringManager.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>06.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWPortalLib8.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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user