56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
//-----------------------------------------------------------------------
|
|
// <copyright file="HttpRequest.cs" company="BTU/IIT">
|
|
// Company copyright tag.
|
|
// </copyright>
|
|
// <author>stubbfel</author>
|
|
// <sience>10.06.2013</sience>
|
|
//----------------------------------------------------------------------
|
|
namespace CampusAppWP8ScheduledTaskAgent.Utility
|
|
{
|
|
using System;
|
|
using System.Net;
|
|
using CampusAppWPortalLib8.Utility;
|
|
|
|
/// <summary>
|
|
/// Class realize the access of restful HttpRequest
|
|
/// </summary>
|
|
public class HttpRequest : AbstractHttpRequest
|
|
{
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="HttpRequest" /> class.
|
|
/// </summary>
|
|
public HttpRequest()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="HttpRequest" /> class.
|
|
/// </summary>
|
|
/// <param name="apiBaseAddress">the url of the HttpRequest base address</param>
|
|
public HttpRequest(Uri apiBaseAddress)
|
|
{
|
|
this.BaseAddress = apiBaseAddress.AbsoluteUri;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Method realize the http-get-method resource
|
|
/// </summary>
|
|
/// <param name="url">Url of the resource</param>
|
|
/// <param name="action">callback method</param>
|
|
public void HttpGet(Uri url, Action<object, DownloadStringCompletedEventArgs> action)
|
|
{
|
|
WebClient client = new WebClient();
|
|
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(action);
|
|
client.DownloadStringAsync(url);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|