diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs index 813f7899..eb22f70b 100644 --- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs +++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/ScheduledAgent.cs @@ -1,11 +1,11 @@ //----------------------------------------------------------------------- // -// Company copyright tag. +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // -// stubbfel -// 18.09.2013 -//---------------------------------------------------------------------- - +// Stubbfel +// 15.10.2013 +// Implements the scheduled agent class +//----------------------------------------------------------------------- namespace CampusAppWP8ScheduledTaskAgent { using System; @@ -21,40 +21,31 @@ namespace CampusAppWP8ScheduledTaskAgent using Microsoft.Phone.Scheduler; using Microsoft.Phone.Shell; - /// - /// Class for agent of the BackgroundTask - /// + /// Class for agent of the BackgroundTask. + /// Stubbfel, 15.10.2013. + /// public class ScheduledAgent : ScheduledTaskAgent { #region Member - /// - /// Model for the mensa feed - /// + /// Model for the mensa feed. private MenuWeekModel mensaModel; - /// - /// Model for the event feed - /// + /// Model for the event feed. private RSSViewModel eventModel; - /// - /// Model for the news feed - /// + /// Model for the news feed. private RSSViewModel newsModel; - /// - /// Variable for the runnig feeds - /// + /// Variable for the running feeds. private int runningFeeds; #endregion #region Constructor - /// - /// Initializes static members of the class. - /// + /// Initializes static members of the class. + /// Stubbfel, 15.10.2013. static ScheduledAgent() { Deployment.Current.Dispatcher.BeginInvoke(delegate @@ -69,10 +60,9 @@ namespace CampusAppWP8ScheduledTaskAgent #region protected - /// - /// override OnInvoke - /// - /// the background Task + /// override OnInvoke. + /// Stubbfel, 15.10.2013. + /// protected override void OnInvoke(ScheduledTask task) { int notRunningFeeds = 0; @@ -120,11 +110,10 @@ namespace CampusAppWP8ScheduledTaskAgent #region private - /// - /// Method handle UnhandledException - /// - /// sender of Exception - /// Exception Args + /// Method handle UnhandledException. + /// Stubbfel, 15.10.2013. + /// sender of Exception. + /// Exception Args. private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) @@ -133,10 +122,9 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Method handle the EventBackgroundTask - /// - /// the eventTask + /// Method handle the EventBackgroundTask. + /// Stubbfel, 15.10.2013. + /// the eventTask. private void HandleEventTask(ScheduledTask task) { if (this.eventModel == null || !this.CheckRssIsUpToDate(this.eventModel.CreateTime)) @@ -155,10 +143,9 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Method handle the NewsBackgroundTask - /// - /// the newsTask + /// Method handle the NewsBackgroundTask. + /// Stubbfel, 15.10.2013. + /// the newsTask. private void HandleNewsTask(ScheduledTask task) { if (this.newsModel == null || !this.CheckRssIsUpToDate(this.newsModel.CreateTime)) @@ -177,11 +164,10 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// ResponseHandler for the EventFeed - /// - /// sender of the Event - /// Event Args + /// ResponseHandler for the EventFeed. + /// Stubbfel, 15.10.2013. + /// sender of the Event. + /// Event Args. private void GetEventIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg) { if (arg.Result != null) @@ -200,11 +186,10 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// ResponseHandler for the NewsFeed - /// - /// sender of the Event - /// Event Args + /// ResponseHandler for the NewsFeed. + /// Stubbfel, 15.10.2013. + /// sender of the Event. + /// Event Args. private void GetNewsIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg) { if (arg.Result != null) @@ -223,9 +208,8 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Method update the NewsTile - /// + /// Method update the NewsTile. + /// Stubbfel, 15.10.2013. private void UpdateNewsTile() { ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathNews_NewsIndexPage)); @@ -243,6 +227,7 @@ namespace CampusAppWP8ScheduledTaskAgent tileToFind.Update(data); } + this.runningFeeds--; } @@ -256,9 +241,8 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Method update the EventTile - /// + /// Method update the EventTile. + /// Stubbfel, 15.10.2013. private void UpdateEventTile() { ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathEvents_EventsIndexPage)); @@ -277,6 +261,7 @@ namespace CampusAppWP8ScheduledTaskAgent tileToFind.Update(data); } + this.runningFeeds--; } @@ -286,11 +271,10 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Determine the correct MensaFeed/Url - /// - /// the Description of the MensaTask - /// Url of a mensa, which is set is in the UserProfile + /// Determine the correct MensaFeed/Url. + /// Stubbfel, 15.10.2013. + /// the Description of the MensaTask. + /// Url of a mensa, which is set is in the UserProfile. private Uri CalcMensaUrl(string mensaTaskDesc) { Uri url; @@ -318,10 +302,9 @@ namespace CampusAppWP8ScheduledTaskAgent return url; } - /// - /// Method handle the MensaBackgroundTask - /// - /// the newsTask + /// Method handle the MensaBackgroundTask. + /// Stubbfel, 15.10.2013. + /// the newsTask. private void HandleMensaTask(ScheduledTask task) { if (this.mensaModel == null || !this.CheckMensaIsUpToDate(this.mensaModel.CreateTime)) @@ -336,11 +319,10 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// ResponseHandler for the MensaFeed - /// - /// sender of the Event - /// Event Args + /// ResponseHandler for the MensaFeed. + /// Stubbfel, 15.10.2013. + /// sender of the Event. + /// Event Args. private void GetMensaIsReady(object sender, System.Net.DownloadStringCompletedEventArgs arg) { if (arg.Result != null) @@ -358,9 +340,8 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Method update the NewsTile - /// + /// Method update the NewsTile. + /// Stubbfel, 15.10.2013. private void UpdateMensaTile() { ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(CampusAppWPortalLib8.Resources.Constants.PathMensa_MensaPage)); @@ -391,6 +372,7 @@ namespace CampusAppWP8ScheduledTaskAgent int randomNumber = random.Next(0, mealCount); 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; } } @@ -405,11 +387,10 @@ namespace CampusAppWP8ScheduledTaskAgent } } - /// - /// Check if the model of the mensa is up-to-date - /// - /// Date of the last modification - /// true, if it is up-to-date, otherwise false + /// Check if the model of the mensa is up-to-date. + /// Stubbfel, 15.10.2013. + /// Date of the last modification. + /// true, if it is up-to-date, otherwise false. private bool CheckMensaIsUpToDate(DateTime lastModified) { int diff = lastModified.CompareTo(MenuWeekModel.CalcFirstWeekDay()); @@ -422,11 +403,10 @@ namespace CampusAppWP8ScheduledTaskAgent return true; } - /// - /// Check if the model of the RSS feed is up-to-date - /// - /// Date of the last modification - /// true, if it is up-to-date, otherwise false + /// Check if the model of the RSS feed is up-to-date. + /// Stubbfel, 15.10.2013. + /// Date of the last modification. + /// true, if it is up-to-date, otherwise false. private bool CheckRssIsUpToDate(DateTime lastModified) { int diff = lastModified.CompareTo(DateTime.Now.AddDays(1)); diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop index b0c0a6a8..97da1791 100644 --- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop +++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Settings.StyleCop @@ -2,13 +2,14 @@ perodic + stubbfel BTU/IIT - BTU/IIT + The MIT License (MIT). Copyright (c) 2013 BTU/IIT. diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs index 26963480..7913e2e8 100644 --- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs +++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/BackgroundTasks.cs @@ -1,26 +1,25 @@ //----------------------------------------------------------------------- // -// Company copyright tag. +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // -// stubbfel -// 18.09.2013 -//---------------------------------------------------------------------- - +// Stubbfel +// 15.10.2013 +// Implements the background tasks class +//----------------------------------------------------------------------- namespace CampusAppWP8ScheduledTaskAgent.Utility { using System; using CampusAppWPortalLib8.Utility; using Microsoft.Phone.Scheduler; - /// - /// Class provide some static methods for background tasks - /// + /// Class provide some static methods for background tasks. + /// Stubbfel, 15.10.2013. + /// public class BackgroundTasks : AbstractBackgroundTasks { - /// - /// Method stop a certain PerodicTask - /// - /// name of the task + /// Method stop a certain PerodicTask. + /// Stubbfel, 15.10.2013. + /// name of the task. public static void StopPerodicTask(string taskName) { PeriodicTask periodicTask = ScheduledActionService.Find(taskName) as PeriodicTask; diff --git a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs index 2c558936..53632420 100644 --- a/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs +++ b/CampusAppWP8/CampusAppWP8ScheduledTaskAgent/Utility/HttpRequest.cs @@ -1,34 +1,33 @@ //----------------------------------------------------------------------- // -// Company copyright tag. +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // -// stubbfel -// 10.06.2013 -//---------------------------------------------------------------------- +// Stubbfel +// 15.10.2013 +// Implements the HTTP request class +//----------------------------------------------------------------------- namespace CampusAppWP8ScheduledTaskAgent.Utility { using System; using System.Net; using CampusAppWPortalLib8.Utility; - /// - /// Class realize the access of restful HttpRequest - /// + /// Class realize the access of restful HttpRequest. + /// Stubbfel, 15.10.2013. + /// public class HttpRequest : AbstractHttpRequest { #region Constructor - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. + /// Stubbfel, 15.10.2013. public HttpRequest() { } - /// - /// Initializes a new instance of the class. - /// - /// the url of the HttpRequest base address + /// Initializes a new instance of the class. + /// Stubbfel, 15.10.2013. + /// the url of the HttpRequest base address. public HttpRequest(Uri apiBaseAddress) { this.BaseAddress = apiBaseAddress.AbsoluteUri; @@ -38,11 +37,10 @@ namespace CampusAppWP8ScheduledTaskAgent.Utility #region Methods - /// - /// Method realize the http-get-method resource - /// - /// Url of the resource - /// callback method + /// Method realize the http-get-method resource. + /// Stubbfel, 15.10.2013. + /// Url of the resource. + /// callback method. public void HttpGet(Uri url, Action action) { WebClient client = new WebClient();