From f8f90ab247879dfe46faabb120496e7dec2b479f Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 10:49:43 +0200 Subject: [PATCH 1/2] init #35 --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../CampusAppWP8/Model/Utility/URLParamModel.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 8a52dd95..f27a3dc3 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -111,6 +111,7 @@ + CampusMapPage.xaml diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs new file mode 100644 index 00000000..e1f4dcf1 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Model.Utility +{ + class URLParamModel + { + } +} From 1c890fd43d9f7b704b45659c7782e8511dec1c6c Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 17 Jun 2013 11:20:51 +0200 Subject: [PATCH 2/2] finish #35 --- .../Model/Utility/URLParamModel.cs | 98 +++++++++++++++++-- 1 file changed, 91 insertions(+), 7 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs index e1f4dcf1..7ea84ed4 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Utility/URLParamModel.cs @@ -1,12 +1,96 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 17.06.2013 +//---------------------------------------------------------------------- namespace CampusAppWP8.Model.Utility { - class URLParamModel + /// + /// This class is a Model for the URLParameter like GET-Parameter + /// + public class URLParamModel { + #region Members + + /// + /// Variable of the key + /// + private readonly string key; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the class. + /// + /// the key for the parameter + public URLParamModel(string key) + { + this.key = key; + } + + /// + /// Initializes a new instance of the class. + /// + /// the key for the parameter> + /// value of the parameter + public URLParamModel(string key, string value) + { + this.key = key; + this.Value = value; + } + #endregion + #region Proberty + + /// + /// Gets or sets the value of the Parameter + /// + public string Value { get; set; } + + /// + /// Gets the key of the parameter + /// + public string Key + { + get + { + return this.key; + } + } + #endregion + + #region Methods + + /// + /// Method check if the parameter is valid + /// + /// true if is it valid, otherwise false + public virtual bool IsParamValid() + { + if (this.key == null || string.Empty.Equals(this.key) || string.Empty.Equals(this.Value)) + { + return false; + } + + return true; + } + + /// + /// Method return a formatted string like Key=Value + /// + /// return formatted string + public override string ToString() + { + if (!this.IsParamValid()) + { + return string.Empty; + } + + return "&" + this.key + "=" + this.Value; + } + #endregion } }