2. Drag a WebView into your app’s XAML
3. Add following code into your MainPage.xaml.cs file
webView1.Navigate(new Uri(@"http://myevents.apphb.com/"));
Reference:
http://msdn.microsoft.com/en-us/library/windows/apps/hh868173.aspx
SpreadsheetsService myService = new SpreadsheetsService("test");
myService.setUserCredentials("AAA@gmail.com", "password");
SpreadsheetQuery query = new SpreadsheetQuery();
SpreadsheetFeed feed = myService.Query(query);
Console.WriteLine("Your spreadsheets:");
foreach (SpreadsheetEntry entry in feed.Entries)
{
Console.WriteLine(entry.Title.Text);
}
API download link:var population = Tuple.Create("New York", 7891957, 7781984, 7894862, 7071639, 7322564, 8008278);
Console.WriteLine("Population of {0} in 2000: {1:N0}",
population.Item1, population.Item7);
References:try
{
client.Close();
}
catch (CommunicationException e)
{
client.Abort();
}
catch (TimeoutException e)
{
client.Abort();
}
catch (Exception e)
{
client.Abort();
throw; //Make sure to keep original exception
}
public string CalculateMD5Hash(string input)
{
// step 1, calculate MD5 hash from input
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
// step 2, convert byte array to hex string
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(htmlstring);
string text = doc.DocumentNode.InnerText;
text = Regex.Replace(text, @"\s+", " ").Trim();
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace me.ExtensionMethods
{
public static class Html
{
public static MvcHtmlString AbsoluteActionLink(this HtmlHelper htmlHelper, string text, string actionName, string controllerName, object routeValues, object htmlAttributes)
{
var urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);
string baseUrl = BaseUrl(htmlHelper.ViewContext.RequestContext.HttpContext.Request, urlHelper.Content("~/"));
var rd = CastBackTo(routeValues);
string routelist = GetRouteData(rd);
var htmls = CastBackTo(htmlAttributes);
string htmlattributeslist = GetHtmlAttributes(htmls);
var htmlstring = string.Format("{4}", baseUrl, actionName, controllerName, routelist, text, htmlattributeslist);
return new MvcHtmlString(htmlstring);
}
private static string GetHtmlAttributes(RouteValueDictionary htmls)
{
string htmlattributeslist = "";
foreach (var one in htmls.Keys)
{
object value = "";
htmls.TryGetValue(one, out value);
htmlattributeslist = htmlattributeslist + string.Format("{0}='{1}'", one, value);
}
return htmlattributeslist;
}
private static string GetRouteData(RouteValueDictionary rd)
{
string routelist = "";
foreach (var one in rd.Values)
{
routelist = routelist + (routelist == "" ? "" : "/") + one;
}
return routelist;
}
public static RouteValueDictionary CastBackTo(object ob)
{
RouteValueDictionary result = new RouteValueDictionary();
foreach (PropertyInfo property in ob.GetType().GetProperties())
{
result.Add(property.Name, property.GetValue(ob, null));
}
return result;
}
public static string BaseUrl(HttpRequestBase Request, string rootpath)
{
var baseUrl = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, rootpath);
if (!baseUrl.ToLower().Contains("localhost"))
{
string result = "";
string[] baseUrlSections = baseUrl.ToLower().Split("/".ToCharArray());
foreach (var one in baseUrlSections)
{
if (one.Contains(":") && !one.Contains("http"))
{
result = result + "/" + one.Substring(0, one.IndexOf(":"));
}
else
{
result = result + (result == "" ? "" : "/") + one;
}
}
baseUrl = result;
}
return baseUrl;
}
}
}