diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index c3eae64f..4e9814f4 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -145,6 +145,7 @@
ShowPad.xaml
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
index baeefd07..7a3c07a2 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml
@@ -51,6 +51,12 @@
+
+
+
+
+
+
@@ -58,6 +64,12 @@
+
+
+
+
+
+
@@ -83,6 +95,12 @@
+
+
+
+
+
+
@@ -90,6 +108,12 @@
+
+
+
+
+
+
@@ -107,22 +131,25 @@
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -132,9 +159,7 @@
-
-
-
+
@@ -155,6 +180,12 @@
+
+
+
+
+
+
@@ -162,6 +193,12 @@
+
+
+
+
+
+
@@ -172,6 +209,12 @@
+
+
+
+
+
+
@@ -190,6 +233,12 @@
+
+
+
+
+
+
@@ -197,12 +246,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
index 3313910f..9f58635d 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs
@@ -282,7 +282,61 @@ namespace CampusAppWP8.Pages
private void PintoStart_Click(object sender, RoutedEventArgs e)
{
- TileCreator.CreateMensaTile();
+ FrameworkElement elment = sender as FrameworkElement;
+ if (elment == null)
+ {
+ return;
+ }
+
+ string tagButtonName = elment.Tag as string;
+ if (tagButtonName == null)
+ {
+ return;
+ }
+
+ switch (tagButtonName)
+ {
+ case "MensaAppButton":
+ TileCreator.CreateMensaTile();
+ break;
+ case "MailAppButton":
+ TileCreator.CreateWebMailTile();
+ break;
+ case "NewsAppButton":
+ TileCreator.CreateNewsTile();
+ break;
+ case "LectureAppButton":
+ TileCreator.CreateLectureTile();
+ break;
+ case "EventAppButton":
+ TileCreator.CreateEventTile();
+ break;
+ case "CampusMapAppButton":
+ TileCreator.CreateCampusMapTile();
+ break;
+ case "DepartmentAppButton":
+ TileCreator.CreateDepartmentTile();
+ break;
+ case "OpenHoursAppButton":
+ TileCreator.CreateOpeningHoursTile();
+ break;
+ case "LinkAppButton":
+ TileCreator.CreateLinkTile();
+ break;
+ case "OSAAppButton":
+ TileCreator.CreateStudentCouncilTile();
+ break;
+ case "examinationAppButton":
+ TileCreator.CreateExamsTile();
+ break;
+ case "personAppButton":
+ TileCreator.CreatePersonTile();
+ break;
+ case "placeNewsAppButton":
+ TileCreator.CreatePlaceNewsTile();
+ break;
+ }
+
}
private void PintoStart_Click2(object sender, RoutedEventArgs e)
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
index 1840f04c..ddfc70cb 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs
@@ -150,6 +150,15 @@ namespace CampusAppWP8.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Auf Startseite ähnelt.
+ ///
+ public static string ContextMenu_PinToStart {
+ get {
+ return ResourceManager.GetString("ContextMenu_PinToStart", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Bachelor ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
index 3fd4d90c..44a33210 100644
--- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx
@@ -464,4 +464,7 @@
Beschreibung
+
+ Auf Startseite
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8/Utility/BackgroundTasks.cs b/CampusAppWP8/CampusAppWP8/Utility/BackgroundTasks.cs
new file mode 100644
index 00000000..561f0bb5
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/BackgroundTasks.cs
@@ -0,0 +1,78 @@
+using CampusAppWP8ScheduledTaskAgent.Resources;
+using Microsoft.Phone.Scheduler;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CampusAppWP8.Utility
+{
+ public class BackgroundTasks
+ {
+ 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);
+ }
+ catch (Exception e)
+ {
+ Logger.LogException(e);
+ }
+ }
+
+ public static void StopPerodicTask(string taskName)
+ {
+ PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask;
+ if (periodicTask != null)
+ {
+ try
+ {
+ ScheduledActionService.Remove(taskName);
+ }
+ catch (Exception e)
+ {
+ Logger.LogException(e);
+ }
+ }
+ }
+
+ public static void StartMensaTask()
+ {
+ int campusId = (int)Settings.UserProfil.DefaultCampus;
+ BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_Mensa, AppResources.BackGroundTaskDesc_Mensa + " - Feed " + campusId);
+ }
+
+ public static void StopMensaTask()
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Mensa);
+ }
+
+ public static void StartEventTask()
+ {
+ BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_Event, AppResources.BackGroundTaskDesc_Event);
+ }
+
+ public static void StopEventTask()
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Event);
+ }
+
+
+ public static void StartNewsTask()
+ {
+ BackgroundTasks.StartPerodicTask(Constants.BackgroundTask_News, AppResources.BackGroundTaskDesc_News);
+ }
+
+ public static void StopNewsTask()
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_News);
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs
index ef0f85b2..031643c4 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Tiles/TileCreator.cs
@@ -37,53 +37,70 @@ namespace CampusAppWP8.Utility.Lui.Tiles
public static void CreateMensaTile()
{
TileCreator.CreateIconicTile(AppResources.MensaApp_Title, Constants.PathMensa_MensaPage, Icons.Mensa, Icons.Mensa);
- PeriodicTask periodicTask = ScheduledActionService.Find("MensaTask") as PeriodicTask;
- if (periodicTask != null)
- {
- try
- {
- ScheduledActionService.Remove("MensaTask");
- }
- catch (Exception)
- {
- }
- }
+
// create a new task
- periodicTask = new PeriodicTask("MensaTask");
- // load description from localized strings
- periodicTask.Description = "Load MensaFeed :" + Settings.UserProfil.DefaultCampus.ToString();
-
- try
- {
- // add thas to scheduled action service
- ScheduledActionService.Add(periodicTask);
-
- ScheduledActionService.LaunchForTest("MensaTask", TimeSpan.FromSeconds(10));
- System.Diagnostics.Debug.WriteLine("Periodic task is started: " + "MensaTask");
-
-
- }
- catch (InvalidOperationException exception)
- {
- if (exception.Message.Contains("BNS Error: The action is disabled"))
- {
- // load error text from localized strings
- //MessageBox.Show("Background agents for this application have been disabled by the user.");
- }
- if (exception.Message.Contains("BNS Error: The maximum number of ScheduledActions of this type have already been added."))
- {
- // No user action required. The system prompts the user when the hard limit of periodic tasks has been reached.
- }
- }
- catch (SchedulerServiceException)
- {
- // No user action required.
- }
+ BackgroundTasks.StartMensaTask();
}
public static void CreateWebMailTile()
{
- TileCreator.CreateIconicTile(AppResources.MensaApp_Title, Constants.PathMensa_MensaPage, Icons.Mensa, Icons.Mensa);
+ TileCreator.CreateIconicTile(AppResources.MailApp_Title, Constants.PathMail_WebMailPage, Icons.WebMail, Icons.WebMail);
+ }
+
+ public static void CreateNewsTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.NewsApp_Title, Constants.PathNews_NewsIndexPage, Icons.News, Icons.News);
+ }
+
+ public static void CreateLectureTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.LectureApp_Title, Constants.PathLecture_LecturePage, Icons.Lectures, Icons.Lectures);
+ }
+
+ public static void CreateEventTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.EventApp_Title, Constants.PathEvents_EventsIndexPage, Icons.News, Icons.News);
+ BackgroundTasks.StartEventTask();
+ }
+
+ public static void CreateDepartmentTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.DepartmentApp_Title, Constants.PathDepartment_DepartmentIndexPage, Icons.Departments, Icons.Departments);
+ }
+
+ public static void CreateOpeningHoursTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.OpenHoursApp_Title, Constants.PathOpeninghours_OpeninghoursPage, Icons.Openhours, Icons.Openhours);
+ }
+
+ public static void CreateLinkTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.LinkApp_Title, Constants.PathLinks_LinkPage, Icons.Link, Icons.Link);
+ }
+
+ public static void CreateStudentCouncilTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.OSAApp_Title, Constants.PathStudentCouncil_StudentCouncilPage, Icons.StudentCouncil, Icons.StudentCouncil);
+ }
+
+ public static void CreateExamsTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.ExaminationApp_Header, Constants.PathExams_ExamsPage, Icons.Exams, Icons.Exams);
+ }
+
+ public static void CreatePersonTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.PersonApp_Title, Constants.PathPerson_Person, Icons.Person, Icons.Person);
+ }
+
+ public static void CreatePlaceNewsTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.PlaceNewsApp_Title, Constants.PathPlaceNews_PlaceNewsPage, Icons.News, Icons.News);
+ }
+
+ public static void CreateCampusMapTile()
+ {
+ TileCreator.CreateIconicTile(AppResources.CampusMapApp_Title, Constants.PathCampusmap_Campusmap, Icons.Campus, Icons.Campus);
}
}
}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj
index 8787e9fc..ac3a8489 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/CampusAppWP8ScheduledTaskAgent.csproj
@@ -87,6 +87,9 @@
+
+
+
@@ -94,13 +97,14 @@
True
True
-
- Constants.resx
+
True
True
+ Constants.resx
+
@@ -113,9 +117,9 @@
Designer
- PublicResXFileCodeGenerator
- Constants.Designer.cs
Designer
+ Constants1.Designer.cs
+ PublicResXFileCodeGenerator
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MealModel.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MealModel.cs
index 278f4568..a5f7879b 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MealModel.cs
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MealModel.cs
@@ -144,6 +144,20 @@ namespace CampusAppWP8ScheduledTaskAgent.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
+
///
/// Method create depends of the mealId the mealName
///
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MenuWeekModel.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MenuWeekModel.cs
index 7e033766..f2801c7d 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MenuWeekModel.cs
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/Mensa/MenuWeekModel.cs
@@ -62,41 +62,21 @@ namespace CampusAppWP8ScheduledTaskAgent.Model.Mensa
#region Methods
- public string MealToString(string date)
- {
- string mealString = string.Empty;
- foreach (MenuModel menu in this.Menus)
+ ///
+ /// Method calculate this day of the week, which its gets new menus
+ ///
+ /// Date of NewMenuWeekDay
+ public static DateTime CalcFirstWeekDay()
+ {
+ DateTime now = DateTime.Now;
+ while (now.DayOfWeek != DayOfWeek.Monday)
{
- if (menu.Date.Equals(date))
- {
- foreach (MealModel meal in menu.Meals)
- {
- int lenght = meal.MealDesc.Length;
- if (lenght > 30) {
- lenght = 30;
- }
- mealString += meal.MealName + ": " + meal.MealDesc.Substring(0, lenght) +"...";
- mealString = StringManager.AddNewLine(mealString);
- }
- return mealString;
- }
+ now = now.Subtract(new TimeSpan(1, 0, 0, 0));
}
- return mealString;
- }
-
- public int GetMealCount(string date)
- {
- foreach (MenuModel menu in this.Menus)
- {
- if (menu.Date.Equals(date))
- {
- return menu.Meals.Count;
- }
- }
-
- return 0;
+ DateTime monday = new DateTime(now.Year, now.Month, now.Day);
+ return monday;
}
#endregion
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSChannelModel.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSChannelModel.cs
new file mode 100644
index 00000000..36425a33
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSChannelModel.cs
@@ -0,0 +1,82 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8ScheduledTaskAgent.Model.RSS
+{
+ using System.Collections.ObjectModel;
+ using System.Collections.Specialized;
+ using System.Xml.Serialization;
+
+ ///
+ /// Channel Model, which contains the RSS feed item list.
+ ///
+ public class RSSChannelModel
+ {
+ ///
+ /// RSS feed information item list.
+ ///
+ private ObservableCollection item;
+
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public RSSChannelModel()
+ {
+ this.item = new ObservableCollection();
+ this.item.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
+ }
+
+ #endregion
+
+ #region Property
+
+ ///
+ /// Gets or sets the RSS feed item list.
+ ///
+ [XmlElement("item")]
+ public ObservableCollection Item
+ {
+ get
+ {
+ return this.item;
+ }
+
+ set
+ {
+ if (value != this.item)
+ {
+ this.item = value;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Method
+
+ ///
+ /// Is called when the item list has changed.
+ /// Here used for the add event.
+ /// Set the index of the last list element.
+ ///
+ /// item list
+ /// event args
+ private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ if (e.Action == NotifyCollectionChangedAction.Add)
+ {
+ ObservableCollection list = sender as ObservableCollection;
+
+ list[list.Count - 1].Index = list.Count - 1;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSModel.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSModel.cs
new file mode 100644
index 00000000..fa8a5a54
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSModel.cs
@@ -0,0 +1,276 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8ScheduledTaskAgent.Model.RSS
+{
+ using System;
+ using System.Text;
+ using System.Xml.Serialization;
+
+ ///
+ /// Contains the RSS feed information.
+ ///
+ public class RSSModel
+ {
+ #region Member
+
+ ///
+ /// Index of this object.
+ ///
+ private int index = -1;
+
+ ///
+ /// Title of the fees
+ ///
+ private string title;
+
+ ///
+ /// Description text of the feed.
+ ///
+ private string text;
+
+ ///
+ /// Timestamp (publication date) of the event or news.
+ ///
+ private DateTime timestamp;
+
+ ///
+ /// Url of the feed.
+ ///
+ private string link;
+
+ #endregion
+
+ #region Property
+
+ ///
+ /// Gets or sets the title of the feed.
+ ///
+ [XmlElement("title")]
+ public string Title
+ {
+ get
+ {
+ return this.title;
+ }
+
+ set
+ {
+ if (this.title != value)
+ {
+ this.title = value;
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the text of the feed.
+ ///
+ [XmlElement("description")]
+ public string Text
+ {
+ get
+ {
+ return this.text;
+ }
+
+ set
+ {
+ if (this.text != this.HTMLUnicodeToString(value))
+ {
+ this.text = this.HTMLUnicodeToString(value);
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the timestamp of the feed as string.
+ ///
+ [XmlElement("pubDate")]
+ public string Timestamp
+ {
+ get
+ {
+ return this.timestamp.ToString("R");
+ }
+
+ set
+ {
+ if (this.timestamp != DateTime.Parse(value))
+ {
+ this.timestamp = DateTime.Parse(value);
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the timestamp of the feed as DateTime object.
+ ///
+ public DateTime DTTimestamp
+ {
+ get
+ {
+ return this.timestamp;
+ }
+
+ set
+ {
+ this.timestamp = value;
+ }
+ }
+
+ ///
+ /// Gets the date of the timestamp as string.
+ /// example: Mon, 25.06.2013.
+ ///
+ public string Date
+ {
+ get
+ {
+ return string.Format("{0:ddd, dd.MM.yyyy}", this.timestamp);
+ }
+ }
+
+ ///
+ /// Gets the time of the timestamp as string.
+ /// example: 12:56.
+ ///
+ public string Time
+ {
+ get
+ {
+ return string.Format("{0:h:mm} Uhr", this.timestamp);
+ }
+ }
+
+ ///
+ /// Gets or sets the link/url of the feed.
+ ///
+ [XmlElement("link")]
+ public string Link
+ {
+ get
+ {
+ return this.link;
+ }
+
+ set
+ {
+ if (this.link != value)
+ {
+ this.link = value;
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the ListIndex.
+ ///
+ public int Index
+ {
+ get
+ {
+ return this.index;
+ }
+
+ set
+ {
+ this.index = value;
+ }
+ }
+
+ #endregion
+
+ #region Method
+
+ #region public
+
+ ///
+ /// Comparing function for DateTime timestamps.
+ /// (currently unused)
+ ///
+ /// first item
+ /// second item
+ /// -1 if item2 is older then item1, otherwise 0
+ public static int CompareTimeStamp(RSSModel item1, RSSModel item2)
+ {
+ if (item1.DTTimestamp > item2.DTTimestamp)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ #endregion
+
+ #region private
+
+ ///
+ /// Remove or transform html-unicode specific tags into ASCII.
+ ///
+ /// html string
+ /// ASCII string
+ private string HTMLUnicodeToString(string htmluni)
+ {
+ StringBuilder retValue = new StringBuilder();
+
+ for (int i = 0; i < htmluni.Length; i++)
+ {
+ switch (htmluni[i])
+ {
+ // beginning tag of the unicode
+ case '&':
+ int startOff = i + 2;
+ //// sear closing tag of the unicode
+ int endOff = htmluni.IndexOf(';', startOff);
+ //// get and parse value inbetween
+ string sub = htmluni.Substring(startOff, endOff - startOff);
+ int charVal = int.Parse(sub);
+
+ switch (charVal)
+ {
+ // if the unicode value is 128 (€)
+ case 128:
+ retValue.Append('€');
+ break;
+
+ default:
+ retValue.Append((char)charVal);
+ break;
+ }
+
+ // set the current index to the end of the unicode tag
+ i = endOff;
+ break;
+
+ case '<':
+ // ignoring <..> html tags
+ i = htmluni.IndexOf('>', i);
+ break;
+
+ case '\t':
+ // removing tabs
+ break;
+
+ default:
+ // adding other characters to the return string
+ retValue.Append(htmluni[i]);
+ break;
+ }
+ }
+
+ return retValue.ToString();
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSViewModel.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSViewModel.cs
new file mode 100644
index 00000000..d7dd0e8a
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Model/RSS/RSSViewModel.cs
@@ -0,0 +1,83 @@
+//-----------------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// fiedlchr
+// 24.06.2013
+//-----------------------------------------------------------------------------
+namespace CampusAppWP8ScheduledTaskAgent.Model.RSS
+{
+ using System;
+ using System.Collections.ObjectModel;
+ using System.Xml.Serialization;
+
+ ///
+ /// ViewModel of the RSS feed, containing the feed/channel object.
+ ///
+ [XmlRoot("root")]
+ public class RSSViewModel
+ {
+ #region Member
+
+ ///
+ /// Object to store the time when the instance was created.
+ ///
+ private DateTime createTime;
+
+ ///
+ /// Channel list for the RSS feeds.
+ ///
+ private ObservableCollection channel;
+
+ #endregion
+
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public RSSViewModel()
+ {
+ this.channel = new ObservableCollection();
+ this.createTime = DateTime.Now;
+ }
+
+ #endregion
+
+ #region Property
+
+ ///
+ /// Gets or sets the channel list.
+ ///
+ [XmlArray("rss")]
+ [XmlArrayItem("channel")]
+ public ObservableCollection Channel
+ {
+ get
+ {
+ return this.channel;
+ }
+
+ set
+ {
+ if (value != this.channel)
+ {
+ this.channel = value;
+ }
+ }
+ }
+
+ ///
+ /// Gets the creation time.
+ ///
+ public DateTime CreateTime
+ {
+ get
+ {
+ return this.createTime;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs
index c252dfd4..59879025 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.Designer.cs
@@ -60,6 +60,33 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hintergrunddienst für die BTU-Event-Feed ähnelt.
+ ///
+ public static string BackGroundTaskDesc_Event {
+ get {
+ return ResourceManager.GetString("BackGroundTaskDesc_Event", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hintergrunddienst für die BTU-Mensa ähnelt.
+ ///
+ public static string BackGroundTaskDesc_Mensa {
+ get {
+ return ResourceManager.GetString("BackGroundTaskDesc_Mensa", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Hintergrunddienst für die BTU-News-Feed ähnelt.
+ ///
+ public static string BackGroundTaskDesc_News {
+ get {
+ return ResourceManager.GetString("BackGroundTaskDesc_News", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Aktion ähnelt.
///
@@ -78,6 +105,15 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Die Mensa ist heute geschlossen ähnelt.
+ ///
+ public static string MensaApp_CloseMensa {
+ get {
+ return ResourceManager.GetString("MensaApp_CloseMensa", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die Essen 1 ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx
index a47731a4..31c1f5d6 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/AppResources.resx
@@ -150,4 +150,16 @@
Suppe
+
+ Hintergrunddienst für die BTU-Mensa
+
+
+ Die Mensa ist heute geschlossen
+
+
+ Hintergrunddienst für die BTU-Event-Feed
+
+
+ Hintergrunddienst für die BTU-News-Feed
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx
index c6c49152..2710e40d 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.resx
@@ -135,4 +135,25 @@
/Pages/Mensa/MensaPage.xaml
+
+ MensaTask
+
+
+ /Pages/Events/EventIndexPage.xaml
+
+
+ http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php
+
+
+ EventTask
+
+
+ NewsTask
+
+
+ /Pages/News/NewsIndexPage.xaml
+
+
+ http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php
+
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.Designer.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants1.Designer.cs
similarity index 69%
rename from CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.Designer.cs
rename to CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants1.Designer.cs
index 44c40bb1..ed0806ae 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants.Designer.cs
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Resources/Constants1.Designer.cs
@@ -60,6 +60,42 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die EventTask ähnelt.
+ ///
+ public static string BackgroundTask_Event {
+ get {
+ return ResourceManager.GetString("BackgroundTask_Event", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die MensaTask ähnelt.
+ ///
+ public static string BackgroundTask_Mensa {
+ get {
+ return ResourceManager.GetString("BackgroundTask_Mensa", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die NewsTask ähnelt.
+ ///
+ public static string BackgroundTask_News {
+ get {
+ return ResourceManager.GetString("BackgroundTask_News", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/Events/EventIndexPage.xaml ähnelt.
+ ///
+ public static string PathEvents_EventsIndexPage {
+ get {
+ return ResourceManager.GetString("PathEvents_EventsIndexPage", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Mensa/MensaPage.xaml ähnelt.
///
@@ -69,6 +105,24 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die /Pages/News/NewsIndexPage.xaml ähnelt.
+ ///
+ public static string PathNews_NewsIndexPage {
+ get {
+ return ResourceManager.GetString("PathNews_NewsIndexPage", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_veranstaltungen.php ähnelt.
+ ///
+ public static string UrlEvents_Addr {
+ get {
+ return ResourceManager.GetString("UrlEvents_Addr", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die http://www.studentenwerk-frankfurt.de/2011/ClassPackage/App_IKMZ_BTU/index.php?mensa=CottbusBTU&v=1 ähnelt.
///
@@ -105,6 +159,15 @@ namespace CampusAppWP8ScheduledTaskAgent.Resources {
}
}
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php ähnelt.
+ ///
+ public static string UrlNews_Addr {
+ get {
+ return ResourceManager.GetString("UrlNews_Addr", resourceCulture);
+ }
+ }
+
///
/// Sucht eine lokalisierte Zeichenfolge, die root ähnelt.
///
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs
index a847cb83..c2f57b7d 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs
@@ -1,109 +1,268 @@
-using System.Diagnostics;
-using System.Windows;
-using Microsoft.Phone.Scheduler;
-using CampusAppWP8ScheduledTaskAgent.Utility;
-using System;
+using CampusAppWP8ScheduledTaskAgent.Model.Mensa;
+using CampusAppWP8ScheduledTaskAgent.Model.RSS;
using CampusAppWP8ScheduledTaskAgent.Resources;
-using CampusAppWP8ScheduledTaskAgent.Model.Mensa;
+using CampusAppWP8ScheduledTaskAgent.Utility;
+using Microsoft.Phone.Scheduler;
using Microsoft.Phone.Shell;
-using System.Linq;
-using System.Collections.Generic;
+using System;
+using System.Diagnostics;
using System.Globalization;
+using System.Linq;
+using System.Windows;
namespace CampusAppWP8ScheduledTaskAgent
{
public class ScheduledAgent : ScheduledTaskAgent
{
- private static List MealList;
- private static string LastMensaUpdate;
+ private MenuWeekModel mensaModel;
+
+ private RSSViewModel eventModel;
+
+ private RSSViewModel newsModel;
- ///
- /// ScheduledAgent-Konstruktor, initialisiert den UnhandledException-Handler
- ///
static ScheduledAgent()
{
- // Handler für verwaltete Ausnahmen abonnieren
Deployment.Current.Dispatcher.BeginInvoke(delegate
{
Application.Current.UnhandledException += UnhandledException;
});
}
- /// Code, der bei nicht behandelten Ausnahmen ausgeführt wird
private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
- // Eine nicht behandelte Ausnahme ist aufgetreten. Unterbrechen und Debugger öffnen
Debugger.Break();
}
}
- ///
- /// Agent zum Ausführen einer geplanten Aufgabe
- ///
- ///
- /// Die aufgerufene Aufgabe
- ///
- ///
- /// Diese Methode wird aufgerufen, wenn eine regelmäßige oder ressourcenintensive Aufgabe aufgerufen wird
- ///
protected override void OnInvoke(ScheduledTask task)
{
- if (task.Name.Equals("MensaTask"))
+ switch (task.Name)
{
- //TODO: Code zum Ausführen der Aufgabe im Hintergrund hinzufügen
- if (ScheduledAgent.LastMensaUpdate == null || !ScheduledAgent.LastMensaUpdate.Equals(DateTime.Now.ToShortDateString()))
- {
- HttpRequest api = new HttpRequest();
- Uri url = new Uri(Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
- api.HttpGet(url, this.GetIsReady);
- }
- else
- {
- ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(Constants.PathMensa_MensaPage));
+ case "MensaTask":
+ this.HandleMensaTask(task);
+ break;
- if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(Constants.PathMensa_MensaPage))
- {
- IconicTileData data = new IconicTileData();
- DateTime now = DateTime.Now;
- Random random = new Random();
- int randomNumber = random.Next(0, ScheduledAgent.MealList.Count - 1);
- data.WideContent3 = ScheduledAgent.MealList[randomNumber];
- TileToFind.Update(data);
- }
- }
+ case "EventTask":
+ this.HandleEventTask(task);
+ break;
+
+ case "NewsTask":
+ this.HandleNewsTask(task);
+ break;
}
-
}
- private void GetIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
+ private void HandleEventTask(ScheduledTask task)
+ {
+ if (this.eventModel == null || !this.CheckRssIsUpToDate(this.eventModel.CreateTime))
+ {
+ HttpRequest api = new HttpRequest();
+ Uri url = new Uri(Constants.UrlEvents_Addr, UriKind.Absolute);
+ api.HttpGet(url, this.GetEventIsReady);
+ }
+ else
+ {
+ this.updateEventTile();
+ }
+ }
+
+ private void HandleNewsTask(ScheduledTask task)
+ {
+ if (this.newsModel == null || !this.CheckRssIsUpToDate(this.newsModel.CreateTime))
+ {
+ HttpRequest api = new HttpRequest();
+ Uri url = new Uri(Constants.UrlNews_Addr, UriKind.Absolute);
+ api.HttpGet(url, this.GetNewsIsReady);
+ }
+ else
+ {
+ this.updateNewsTile();
+ }
+ }
+
+ private void GetEventIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
{
if (arg2.Result != null)
{
- MenuWeekModel week = XmlManager.DeserializationToModel(arg2.Result, Constants.XMLRootElementName);
- ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(Constants.PathMensa_MensaPage));
-
- if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(Constants.PathMensa_MensaPage))
- {
- IconicTileData data = new IconicTileData();
- DateTime now = DateTime.Now;
- data.WideContent1 = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int)DateTime.Now.DayOfWeek];
- data.WideContent2 = now.Date.ToShortDateString();
- string mealString = week.MealToString(now.Date.ToShortDateString());
- ScheduledAgent.MealList = mealString.Split('\n').ToList();
- Random random = new Random();
- int randomNumber = random.Next(0, ScheduledAgent.MealList.Count - 1);
-
- data.WideContent3 = ScheduledAgent.MealList[randomNumber];
- data.Count = week.GetMealCount(now.Date.ToShortDateString());
- ScheduledAgent.LastMensaUpdate = now.Date.ToShortDateString();
- TileToFind.Update(data);
- }
+ this.eventModel = XmlManager.DeserializationToModel(arg2.Result, Constants.XMLRootElementName);
+ this.updateEventTile();
}
- NotifyComplete();
+ }
+
+ private void GetNewsIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
+ {
+ if (arg2.Result != null)
+ {
+ this.newsModel = XmlManager.DeserializationToModel(arg2.Result, Constants.XMLRootElementName);
+ this.updateNewsTile();
+ }
+ }
+
+
+ private void updateNewsTile()
+ {
+ ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(Constants.PathNews_NewsIndexPage));
+
+ if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(Constants.PathNews_NewsIndexPage))
+ {
+ IconicTileData data = new IconicTileData();
+ Random random = new Random();
+ int randomNumber = random.Next(0, this.eventModel.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.Count = this.newsModel.Channel[0].Item.Count;
+ TileToFind.Update(data);
+ }
+ else
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_News);
+ }
+ this.NotifyComplete();
+ }
+
+ private void updateEventTile()
+ {
+ ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(Constants.PathEvents_EventsIndexPage));
+
+ if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(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.Count = this.eventModel.Channel[0].Item.Count;
+ TileToFind.Update(data);
+ }
+ else
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Event);
+ }
+ this.NotifyComplete();
+ }
+
+ private Uri CalcMensaUrl(string mensaTaskDesc)
+ {
+ Uri url;
+ char feedNumber = mensaTaskDesc[mensaTaskDesc.Length - 1];
+
+ switch (feedNumber)
+ {
+ case '1':
+ url = new Uri(Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
+ break;
+ case '2':
+ url = new Uri(Constants.UrlMensa_Week_CBSouth, UriKind.Absolute);
+ break;
+ case '3':
+ url = new Uri(Constants.UrlMensa_Week_SBFMain, UriKind.Absolute);
+ break;
+ case '4':
+ url = new Uri(Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
+ break;
+ default:
+ url = new Uri(Constants.UrlMensa_Week_CBMain, UriKind.Absolute);
+ break;
+ }
+
+ return url;
+ }
+ private void HandleMensaTask(ScheduledTask task)
+ {
+ if (this.mensaModel == null || !this.CheckMensaIsUpToDate(this.mensaModel.CreateTime))
+ {
+ HttpRequest api = new HttpRequest();
+ Uri url = this.CalcMensaUrl(task.Description);
+ api.HttpGet(url, this.GetMensaIsReady);
+ }
+ else
+ {
+ this.updateMensaTile();
+ }
+ }
+
+ private void GetMensaIsReady(object arg1, System.Net.DownloadStringCompletedEventArgs arg2)
+ {
+ if (arg2.Result != null)
+ {
+ this.mensaModel = XmlManager.DeserializationToModel(arg2.Result, Constants.XMLRootElementName);
+ this.updateMensaTile();
+ }
+
+ }
+
+ private void updateMensaTile()
+ {
+ ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(Constants.PathMensa_MensaPage));
+
+ if (TileToFind != null && TileToFind.NavigationUri.ToString().Contains(Constants.PathMensa_MensaPage))
+ {
+ IconicTileData data = new IconicTileData();
+ DateTime now = DateTime.Now;
+ int dayIndex = (int)DateTime.Now.DayOfWeek;
+ data.WideContent1 = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[dayIndex];
+ data.WideContent2 = now.Date.ToShortDateString();
+ if (dayIndex == 0 || dayIndex > this.mensaModel.Menus.Count)
+ {
+ data.WideContent3 = AppResources.MensaApp_CloseMensa;
+ }
+ else
+ {
+ // correct index (week sart with monday not sunday
+ dayIndex--;
+ int mealCount = this.mensaModel.Menus[dayIndex].Meals.Count;
+ if (mealCount < 1)
+ {
+ data.WideContent3 = AppResources.MensaApp_CloseMensa;
+ }
+ else
+ {
+ Random random = new Random();
+ int randomNumber = random.Next(0, mealCount);
+ data.WideContent3 = this.mensaModel.Menus[dayIndex].Meals[randomNumber].MealToShortString();
+ data.Count = this.mensaModel.Menus[dayIndex].Meals.Count;
+ }
+ }
+ TileToFind.Update(data);
+ }
+ else
+ {
+ BackgroundTasks.StopPerodicTask(Constants.BackgroundTask_Mensa);
+ }
+ this.NotifyComplete();
+ }
+
+
+ private bool CheckMensaIsUpToDate(DateTime lastModified)
+ {
+ int diff = lastModified.CompareTo(MenuWeekModel.CalcFirstWeekDay());
+
+ if (diff < 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private bool CheckRssIsUpToDate(DateTime lastModified)
+ {
+ int diff = lastModified.CompareTo(DateTime.Now.AddDays(1));
+
+ if (diff < 0)
+ {
+ return false;
+ }
+
+ return true;
}
}
}
\ No newline at end of file
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs
new file mode 100644
index 00000000..50b9034e
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs
@@ -0,0 +1,49 @@
+using CampusAppWP8ScheduledTaskAgent.Resources;
+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 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;
+ if (periodicTask != null)
+ {
+ try
+ {
+ ScheduledActionService.Remove(taskName);
+ }
+ catch (Exception e)
+ {
+ Logger.LogException(e);
+ }
+ }
+ }
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/StringManager.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/StringManager.cs
index 199dacd2..58cbe206 100644
--- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/StringManager.cs
+++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/StringManager.cs
@@ -54,6 +54,16 @@ namespace CampusAppWP8ScheduledTaskAgent.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
}
}
diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
index 252a56ef..8d9e3e15 100644
--- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
+++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj
@@ -39,10 +39,7 @@
-
-
-