CHAPTER 19 (Mac os x web server) BUILDING A BETTER WINDOW WITH
CHAPTER 19 BUILDING A BETTER WINDOW WITH SYSTEM.608 STEM.WINDOWS.FORMS Figure 19-1. A simple main window la Windows Forms Granted, the Form is not altogether that interesting at this point. But simply by deriving from Form, you have a minimizable, maximizable, resizable, and closable main window (with a default system-supplied icon to boot!). Unlike other Microsoft GUI frameworks you may have used in the past (Microsoft Foundation Classes, in particular), there is no need to bolt in hundreds of lines of coding infrastructure (frames, documents, views, applications, or message maps). Unlike a C-based Win32 API Windows application, there is no need to manually implement WinProc() or WinMain() procedures. Under the .NET platform, those dirty details have been encapsulated within the Form and Application types. Honoring the Separation of Concerns Currently, the MainWindow class defines the Main() method directly within its scope. If you prefer, you may create a second static class (I named mine Program) that is responsible for the task of launching the main window, leaving the Form-derived class responsible for representing the window itself: namespace MyWindowsApp { // The main window. public class MainWindow : Form { } // The application object. public static class Program { static void Main(string[] args) { // Don’t forget to ‘use’ System.Windows.Forms! Application.Run(new MainWindow()); } } } By doing so, you are abiding by an OO principal termed the separation of concerns. Simply put, this rule of OO design states that a class should be in charge of doing the least amount of work possible. Given that you have refactored the initial class into two unique classes, you have decoupled the Form from the class that creates it. The end result is amore portable window, as it can be dropped into any project without carrying the extra baggage of a project-specific Main() method. Source Code The MyFirstWindow project can be found under the Chapter 19 subdirectory.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.