Example C# Code
Posted: Tue May 14, 2013 11:03 am
Would someone please show me how to reference the DeviceInfo from the class used in the documentation for the Cloud API C#? I am new to C# so I need very basic help. I created a new C# .Net web application, added the scientiamobile dll as a reference and created a new class in wurflservice.cs (the code is below). How would I reference the DeviceInfo object to get the capability "resolution_width" within my default.aspx.cs page's page_load. eg. labelwidth.text = ??????? If someone would zip up a complete C# project of this simple example that returns resolution width/height to labels on a web page that would be great for users. It is more of a C# question than Wurfl Cloud API question but could someone please help?
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ScientiaMobile.WurflCloud;
using ScientiaMobile.WurflCloud.Config;
using ScientiaMobile.WurflCloud.Device;
namespace WebApplication1
{
public class wurflservice
{
public DeviceInfo GetDataByRequest(HttpContextBase context)
{
var config = new DefaultCloudClientConfig
{
ApiKey = "xxxx:xxxxxxxxxxxxxxxxxxxxxxx"
};
var manager = new CloudClientManager(config);
// Grab data
var info = manager.GetDeviceInfo(context);
return info;
}
}
}