Capture Weather Data from Internet

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Post Reply
Subho
Posts: 9
Joined: Fri Apr 05, 2019 11:56 pm

Capture Weather Data from Internet

Post by Subho »

I am newbie in IX development and my C# knowledge is very poor. It will be very helpful if any can guide me in the following topic.

I am trying to read weather data from a website which provide data in XML using following code.


namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Net;
using System.Drawing;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;


public partial class Screen11
{



void Btnecast_Click(System.Object sender, System.EventArgs e)
{
var client = new System.Net.WebClient();
using (client)
{
XmlDocument xml = new XmlDocument();
xml.LoadXml(client.DownloadString());
XmlElement elt;
elt = xml.SelectSingleNode("//temperature[@unit='metric']") as XmlElement;

}
}

}
}

I have successfully tested the following code in the IX PC version but when I am trying to implement the same code in X2 Base or X2 Pro getting following error for the above highlighted line.

cs0234 the type or namespace name "webclient" does not exist in the namespace 'system.net'

Subho
Posts: 9
Joined: Fri Apr 05, 2019 11:56 pm

Re: Capture Weather Data from Internet

Post by Subho »

Solved the Problem using HttpWebRequest

Post Reply