|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RedCircle.Framework.Wap.Wurfl;
using System.Diagnostics;
namespace emx.tcp.wurfl.testharness1
{
public partial class RedCircleWebForm : System.Web.UI.Page
{
Utility.Log mo_log = Utility.Log.logItem(Utility.wurfl.Implementation.RED_CIRCLE.ToString());
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// bind capabilities to static enum
cboCapabilities.DataSource = Utility.wurfl.capabilities;
cboCapabilities.DataBind();
// set state of capabilities list
if (Request["cboCapabilities"] != null)
{
cboCapabilities.Text = Request["cboCapabilities"].ToString();
}
// bind devices to arbitary list
cboUserAgent.DataSource = Utility.wurfl.devices;
cboUserAgent.DataBind();
// set state of device list
if (Request["cboDevice"] != null)
{
cboUserAgent.Text = Request["cboDevice"].ToString();
}
}
}
protected void butGetCapability_Click(object sender, EventArgs e)
{
// start the timer
Stopwatch o_stopwatch = new Stopwatch();
o_stopwatch.Start();
// output result to label
DeviceInfo o_deviceInfo = null;
if (cboUserAgent.SelectedItem.Text == Utility.wurfl.devices[0])
{
// current device
o_deviceInfo = WurflFile.Instance.GetDeviceInfo(Request.UserAgent);
}
else
{
o_deviceInfo = WurflFile.Instance.GetDeviceInfo(cboUserAgent.Text);
}
string s_result = o_deviceInfo.GetCapability(cboCapabilities.Text);
lblResponse.Text = cboCapabilities.Text + ": " + s_result;
// stop the timer
o_stopwatch.Stop();
// show result in log
mo_log.appendLog(Utility.wurfl.formatLog(o_stopwatch.Elapsed.TotalMilliseconds, cboUserAgent.SelectedItem.Text, lblResponse.Text));
txtLog.Text = mo_log.logString;
}
protected void butClearLog_Click(object sender, EventArgs e)
{
mo_log.clearLog();
txtLog.Text = string.Empty;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Contractor in Desktop and Web applications.
Gold Coast, Queensland.