Advertisement
nerru86

51Degrees .NET API get data file information

Jan 7th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.99 KB | None | 0 0
  1. /*
  2.  * Each 51Degrees device data file contains information like the
  3.  * next update date, published date and other useful information.
  4.  *
  5.  * The following snippet demonstrates how this information can be
  6.  * retrieved using a Default.aspx web page as an example.
  7.  *
  8.  * Snippet contains 2 parts: the HTML markup and the code behind.
  9.  */
  10.  
  11. /* Web Forms .NET example of retrieving 51Degrees device data file information */
  12. /* Default.aspx */
  13. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
  14.  
  15. <!DOCTYPE html>
  16.  
  17. <html xmlns="http://www.w3.org/1999/xhtml">
  18. <head runat="server">
  19.     <title></title>
  20. </head>
  21. <body>
  22.     <form id="form1" runat="server">
  23.     <div>
  24.         <div>
  25.             <asp:Label runat="server" ID="Type"></asp:Label>
  26.             <asp:Label runat="server" ID="Version"></asp:Label>
  27.             <asp:Label runat="server" ID="Published"></asp:Label>
  28.             <asp:Label runat="server" ID="NextUpdate"></asp:Label>
  29.             <asp:Label runat="server" ID="Properties"></asp:Label>
  30.             <asp:Label runat="server" ID="Combination"></asp:Label>
  31.         </div>
  32.     </div>
  33.     </form>
  34. </body>
  35. </html>
  36.  
  37. /* Default.aspx.cs */
  38. using System;
  39. using System.Collections.Generic;
  40. using System.Linq;
  41. using System.Web;
  42. using System.Web.UI;
  43. using System.Web.UI.WebControls;
  44.  
  45. using FiftyOne.Foundation.Mobile.Detection;
  46.  
  47. public partial class _Default : System.Web.UI.Page
  48. {
  49.     protected void Page_Load(object sender, EventArgs e)
  50.     {
  51.         Provider p = WebProvider.ActiveProvider;
  52.         Type.Text = "Type: " + p.DataSet.Name + "<br>";
  53.         Version.Text = "Version: " + p.DataSet.Version + "<br>";
  54.         Published.Text = "Published: " + p.DataSet.Published + "<br>";
  55.         NextUpdate.Text = "Next update: " + p.DataSet.NextUpdate + "<br>";
  56.         Properties.Text = "Properties: " + p.DataSet.Properties.Count + "<br>";
  57.         Combination.Text = "Device combinations: " + p.DataSet.DeviceCombinations + "<br>";
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement