//----------------------------------------------------------------------- // // Company copyright tag. // // stubbfel // 17.06.2013 //---------------------------------------------------------------------- namespace CampusAppWP8ScheduledTaskAgent.Model.Utility { /// /// This class is a Model for the URLParameter like GET-Parameter /// public class UrlParamModel { #region Members /// /// Variable of the key /// protected 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; } } /// /// Gets the token, which indicate that the parameterList started /// public virtual string ParamToken { get { return "?"; } } #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 } }