diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
index 14c3174d..2535a30b 100644
--- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
+++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj
@@ -172,6 +172,7 @@
True
Constants.resx
+
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs
index 95c960be..48b5398d 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/LecturePage.xaml.cs
@@ -167,7 +167,7 @@ namespace CampusAppWP8.Pages.Lecture
this.api.EventHandler.ApiIsReadyEvent += new ApiEventHandler.ApiReadyHandler(this.ApiIsReady);
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
List parameterList = this.CreateUrlParameter();
- this.api.XMLHttpGet(parameterList);
+ this.api.ApiGet(parameterList);
}
///
diff --git a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs
index fbb9157a..a9f96ba4 100644
--- a/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs
+++ b/CampusAppWP8/CampusAppWP8/Pages/Lecture/ResultPage.xaml.cs
@@ -133,6 +133,7 @@ namespace CampusAppWP8.Pages.Lecture
private void ShowModulWebPage(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
+ HideOptions((StackPanel)btn.Parent);
Uri url = new Uri(Constants.PathLecture_ModulWebPage + "?" + Constants.ParamModelLecture_ModulNumber + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
@@ -145,6 +146,7 @@ namespace CampusAppWP8.Pages.Lecture
private void ShowDetailPage(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
+ HideOptions((StackPanel)btn.Parent);
Uri url = new Uri(Constants.PathLecture_ResultDetailPage + "?" + Constants.ParamModelLecture_ActivityId + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/Api.cs b/CampusAppWP8/CampusAppWP8/Utility/Api.cs
new file mode 100644
index 00000000..a7ef98e5
--- /dev/null
+++ b/CampusAppWP8/CampusAppWP8/Utility/Api.cs
@@ -0,0 +1,144 @@
+//-----------------------------------------------------------------------
+//
+// Company copyright tag.
+//
+// stubbfel
+// 19.06.2013
+//----------------------------------------------------------------------
+namespace CampusAppWP8.Utility
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Net;
+ using CampusAppWP8.Model.Utility;
+
+ ///
+ /// This abstract Class is for API
+ ///
+ /// Type for model of the API
+ public abstract class Api : HttpRequest
+ {
+ #region Members
+
+ ///
+ /// EventHandler of the API
+ ///
+ private readonly ApiEventHandler eventHandler;
+
+ ///
+ /// The model of the API
+ ///
+ private T model;
+
+ #endregion
+
+ #region Constructor
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// BaseUrl of the API
+ public Api(Uri apiBaseAddress)
+ : base(apiBaseAddress)
+ {
+ this.eventHandler = new ApiEventHandler();
+ }
+
+ #endregion
+
+ #region Proberty
+
+ ///
+ /// Gets or sets for the model of the API
+ ///
+ public T Model
+ {
+ get
+ {
+ return this.model;
+ }
+
+ set
+ {
+ if ((value == null && this.model != null) || !value.Equals(this.model))
+ {
+ this.model = value;
+ }
+ }
+ }
+
+ ///
+ /// Gets for the event-handler of the API
+ ///
+ public ApiEventHandler EventHandler
+ {
+ get { return this.eventHandler; }
+ }
+ #endregion
+
+ #region Methods
+
+ #region public
+
+ ///
+ /// Method send an HTTP-Get for an API
+ ///
+ /// list of GetParameter
+ public void ApiGet(List parameters)
+ {
+ Uri getUrl = this.CreateGetUrl(parameters);
+ this.HttpGet(getUrl, this.DownloadCompleted);
+ }
+ #endregion
+
+ #region protected
+
+ ///
+ /// Method implement the deserialization a Xml-API
+ ///
+ /// content of the API
+ protected abstract void Deserialization(string xmlString);
+
+ #endregion
+
+ #region private
+
+ ///
+ /// Method create the model of the API
+ ///
+ /// content of the API
+ private void CreateModel(string resultString)
+ {
+ if (resultString == null || resultString == string.Empty)
+ {
+ return;
+ }
+
+ this.Deserialization(resultString);
+ this.EventHandler.FireApiReadyevent();
+ }
+
+ ///
+ /// Method will be execute if the download of the API is completed and create the model
+ ///
+ /// Sender of the event
+ /// Arguments of the event
+ private void DownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
+ {
+ Exception downloadError = e.Error;
+ if (downloadError != null)
+ {
+ return;
+ }
+
+ string downloadResult = e.Result;
+ if (downloadResult != null && !downloadResult.Equals(string.Empty))
+ {
+ this.CreateModel(downloadResult);
+ }
+ }
+ #endregion
+
+#endregion
+ }
+}
diff --git a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs
index 71e48753..2f1aa0e3 100644
--- a/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs
+++ b/CampusAppWP8/CampusAppWP8/Utility/XmlApi.cs
@@ -17,24 +17,14 @@ namespace CampusAppWP8.Utility
/// This abstract Class is for Xml-API
///
/// Type for model of the API
- public abstract class XmlApi : HttpRequest
+ public abstract class XmlApi : Api
{
#region Members
-
- ///
- /// EventHandler of the API
- ///
- private readonly ApiEventHandler eventHandler;
-
- ///
- /// The model of the API
- ///
- private T model;
-
+
///
/// Variable for the name of the root-tag
///
- private string validRootName = Constants.XMLRootElementName;
+ private string validRootName;
#endregion
@@ -47,40 +37,13 @@ namespace CampusAppWP8.Utility
public XmlApi(Uri apiBaseAddress)
: base(apiBaseAddress)
{
- this.eventHandler = new ApiEventHandler();
+ this.validRootName = Constants.XMLRootElementName;
}
#endregion
#region Proberty
- ///
- /// Gets or sets for the model of the API
- ///
- public T Model
- {
- get
- {
- return this.model;
- }
-
- set
- {
- if ((value == null && this.model != null) || !value.Equals(this.model))
- {
- this.model = value;
- }
- }
- }
-
- ///
- /// Gets for the event-handler of the API
- ///
- public ApiEventHandler EventHandler
- {
- get { return this.eventHandler; }
- }
-
///
/// Gets or sets the ValidRootName of the API
///
@@ -103,68 +66,19 @@ namespace CampusAppWP8.Utility
#endregion
#region Methods
- #region public
-
- ///
- /// Method send an HTTP-Get for an Xml-API
- ///
- /// list of GetParameter
- public void XMLHttpGet(List parameters)
- {
- Uri getUrl = this.CreateGetUrl(parameters);
- this.HttpGet(getUrl, this.DownloadCompleted);
- }
-
- ///
- /// Method create the model of the API
- ///
- /// content of the API
- private void CreateModel(string xmlString)
- {
- if (xmlString == null || xmlString == string.Empty)
- {
- return;
- }
-
- this.Deserialization(xmlString);
- this.EventHandler.FireApiReadyevent();
- }
- #endregion
-
- #region private
+
///
/// Method implement the deserialization a Xml-API
///
/// content of the API
- private void Deserialization(string xmlString)
+ protected override void Deserialization(string xmlString)
{
- T model = XmlManager.DeserializationToModel(xmlString, ValidRootName);
+ T model = XmlManager.DeserializationToModel(xmlString, this.ValidRootName);
if (model != null)
{
this.Model = model;
}
}
-
- ///
- /// Method will be execute if the download of the API is completed and create the model
- ///
- /// Sender of the event
- /// Arguments of the event
- private void DownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
- {
- Exception downloadError = e.Error;
- if (downloadError != null)
- {
- return;
- }
-
- string downloadResult = e.Result;
- if (downloadResult != null && !downloadResult.Equals(string.Empty))
- {
- this.CreateModel(downloadResult);
- }
- }
- #endregion
#endregion
}
}