Inside the Update method, we
need to determine the active tab and execute the corresponding method:
private void Update(int selectedTabIndex)
{
switch (selectedTabIndex)
{
case 0: //Basic Quote
lblBasicQuote.Text = GetBasicQuote(txtTicker.Text.Trim());
break;
case 1: //Price History
GetPriceHistory(txtTicker.Text.Trim());
break;
case 2: //Analytics
GetAnalytics(txtTicker.Text.Trim());
break;
}
}
A simple switch statement does the job here. Based on the active tab index, the
appropriate method is called to render the tab. Three methods are called here, one for
each of three tabs that all have the same signature: one parameter that takes in the stock
ticker entered by the user in the TextBox control. The individual methods, GetBasicQuote,
GetPriceHistory, and GetAnalytics, are covered a little later in this chapter.
With that out of the way, let??™s take a closer look at how to obtain the required data
and implement the individual sections of this application.
Creating Basic Company and Quote Information
Flash-db.com provides several hosted web services free of charge.
Pages:
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325