|
// MainWindow.cs created with MonoDevelop
// User: simba at 9:18 PM 10/18/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
using System;
using Gtk;
using System.Xml;
public partial class MainWindow: Gtk.Window
{
public static String selectionType="template";
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}
protected virtual void OnButton1Clicked (object sender, System.EventArgs e)
{
String quoteSymbol="MSFT";
if(radOwnSym.Active){
if(txtOwn.Text=="")
return;
quoteSymbol=txtOwn.Text;
}
if(radPreDef.Active){
quoteSymbol=cmbTemplate.ActiveText;
}
StockQuote quote = new StockQuote();
string toParse=(quote.GetQuote(quoteSymbol));
XmlDocument doc=new XmlDocument();
doc.LoadXml(toParse);
Console.WriteLine(toParse);
lblStockSymbol.Text=doc.FirstChild.FirstChild.ChildNodes[0].InnerXml;
lblLast.Text=doc.FirstChild.FirstChild.ChildNodes[1].InnerXml;
lblDate.Text=doc.FirstChild.FirstChild.ChildNodes[2].InnerXml;
lblTime.Text=doc.FirstChild.FirstChild.ChildNodes[3].InnerXml;
lblChange.Text=doc.FirstChild.FirstChild.ChildNodes[4].InnerXml;
lblOpen.Text=doc.FirstChild.FirstChild.ChildNodes[5].InnerXml;
lblHigh.Text=doc.FirstChild.FirstChild.ChildNodes[6].InnerXml;
lblLow.Text=doc.FirstChild.FirstChild.ChildNodes[7].InnerXml;
lblVolume.Text=doc.FirstChild.FirstChild.ChildNodes[8].InnerXml;
lblMktCapt.Text=doc.FirstChild.FirstChild.ChildNodes[9].InnerXml;
lblPrevClose.Text=doc.FirstChild.FirstChild.ChildNodes[10].InnerXml;
lblPercentChange.Text=doc.FirstChild.FirstChild.ChildNodes[11].InnerXml;
lblAnnRange.Text=doc.FirstChild.FirstChild.ChildNodes[12].InnerXml;
lblEarns.Text=doc.FirstChild.FirstChild.ChildNodes[13].InnerXml;
lblPE.Text=doc.FirstChild.FirstChild.ChildNodes[14].InnerXml;
lblName.Text=doc.FirstChild.FirstChild.ChildNodes[15].InnerXml;
//Console.WriteLine("Symbol: " + symbol + "\nLast: " + last + "\nDate: " + date + "\nTime: " + time + "\nChange: " + change);
}
protected virtual void OnRadOwnSymGroupChanged (object sender, System.EventArgs e)
{
}
protected virtual void OnRadPreDefToggled (object sender, System.EventArgs e)
{
}
protected virtual void OnRadOwnSymToggled (object sender, System.EventArgs e)
{
}
}
|
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.
Shyam Bharath just finished his bachelor of technology in Computer science and Engineering from Vellore Institute of Technology. He is passionate about application development. He loves coding in C#, Python and more recently Mono.
Right now he is working in J2EE technologies in a private firm in India. In his spare time, he reads spiritual books.
Exam-O-Matic - Online exam conduction tool in ASP.NET