Stock Screen (Silverlight For Windows Phone) Part 4

Preparing the Stock Transaction Signal Page

Next we will add a page to show transaction signals which will be the guide whether or not we should buy a company’s stock. Transaction signal used in this application is processed using MESA Sine-wave technique.

1. Add a Windows Phone Portrait Page and name it StockAnalysisPage.xaml

tmp1C-245

2. Configure application name, page title, and page content. Use the XAML code below:

tmp1C-246_thumb[2][2]

 

tmp1C-247_thumb[2][2]


 

tmp1C-248

3. Create a class to contain company signal data we fetch so that it can be easily bound to Ul. Since the data structure stored is similar to company data in CompanyViewModel.cs class, then for this purpose let’s reuse the class. For the real deal this is of course not recommended.

4. Open StockAnalysisPage.xaml.cs and add the following code:

Declare MainViewModel to contain analysis data.

tmp1C-249_thumb[2][2] 

Fetch data using WebClient

tmp1C-250_thumb[2][2]

 

 

tmp1C-251_thumb[2][2]

Parse the fetched data so that it matches the container class’s structure. Use LINQ to XML.

tmp1C-252_thumb[2][2]

Creating Application Navigation using Application Bar

Now we have two pages and therefore it is mandatory to have a means for navigating through pages. Let’s use our knowledge on Application Bar that we have discussed in previous section. Since we want an Application Bar that is consistent in every page, we will use Global Application Bar.

1. Open App.xaml and add the code below:

tmp1C-253

2. Add an event handler in App.xaml.cs for each menu bar.

tmp1C-254

3. Open MainPage.xaml and StockAnalysisPage.xaml. Add the following code to both:

tmp1C-255

4. Press F5 for results.

tmp1C-256_thumb[2][2]

Next post:

Previous post: