Книга: C# 2008 Programmer

Building the User Interface

Building the User Interface

To get started, launch Visual Studio 2008 and create a new Windows Mobile 6 Standard application using .NET CF 3.5. Name the application RSSReader.

Don't forget to download the free Windows Mobile 6 Standard SDK (http://microsoft.com/downloads). You need it to create the application detailed in this chapter.

The default Form1 uses the standard form factor of 176?180 pixels. As this application is targeted at users with wide-screen devices, change the FormFactor property of Form1 to Windows Mobile 6 Landscape QVGA.

Populate the default Form1 with the following controls (see also Figure 18-8):

? One TreeView control

? Four MenuItem controls


Figure 18-8

Add an ImageList control to Form1 and add three images to its Images property (see Figure 18-9).


Figure 18-9

You can download the images from this book's source code at its Wrox web site.

These images will be used by the TreeView control to display its content when the tree is expanded or closed. Hence, associate the ImageList control to the TreeView control by setting the ImageList property of the TreeView control to ImageList1.

Add a new Windows Form to the project, and populate it with a WebBrowser and MenuItem control (see Figure 18-10). The WebBrowser control will be used to view the content of a posting.


Figure 18-10

Set the Modifiers property of the WebBrowser control to Internal so that the control is accessible from other forms. Specifically, you want to set the content of the control from within Form1.

Switch to the code behind of Form1, and import the following namespaces:

using System.IO;
using System.Net;
using System.Xml;
using System.Text.RegularExpressions;

Declare the following constants and variable:

namespace RSSReader {
 public partial class Form1 : Form {
  //---constants for icons---
  const int ICO_OPEN = 0;
  const int ICO_CLOSE = 1;
  const int ICO_POST = 2;
  //---file containing the list of subscribed feeds---
  string feedsList = @"Feeds.txt";
  //---app's current path---
  string appPath = string.Empty;
  //---the last URL entered (subscribe)---
  string lastURLEntered = string.Empty;
  //---used for displaying a wait message panel---
  Panel displayPanel;
  //---for displaying individual post---
  Form2 frm2 = new Form2();

Оглавление книги


Генерация: 1.044. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз