
C# ПІДРУЧНИКИ / c# / Premier Press - C# Professional Projects
.pdf


790 Project 6 CREATING A MOBILE APPLICATION
In the frmSelectOption form, if the user selects the View Pending Calls option, the frmPending form is displayed as shown in Figure 33-16.
FIGURE 33-16 The frmPending form in an emulator
However, if the user selects the Show Unattended Calls option in the frmSelectOption form, the frmUnattended form is displayed. Figure 33-17 shows the frmUnattended form in an emulator.

IMPLEMENTING THE BUSINESS LOGIC |
Chapter 33 |
791 |
|
|
|
|
|
FIGURE 33-17 The frmUnattended form in an emulator
Summary
In this chapter, you created the MobileCallStatus application. While creating the application, you looked at the default code created by Visual Studio .NET for a mobile Web application. Finally, you learned to write the code for the MobileCallStatus application.
This page intentionally left blank

PARTIXBeyond
the Labs
This page intentionally left blank


796 |
Part IX |
BEYOND THE LABS |
|
|
|
In this chapter, you will learn about COM+, System.Messaging namespace, and asynchronous message queuing.
COM+
Before I introduce you to COM+, you need to understand the concepts of COM, MTS, and Windows DNA.
What Is COM?
As you might be aware, COM stands for component object model, and it is a model for construction of binary-compatible software components introduced by Microsoft. In simple terms, COM is a specification and implementation framework that allows you to create modular, object-oriented, customizable, and upgradeable distributed applications using a number of programming languages. COM enables you to develop components that can communicate with other components irrespective of the programming language or tool you choose to develop it.Therefore, COM allows you to concentrate on developing your application and not bother about the internals of the components.
COM allows clients to invoke services provided by COM-compliant components (COM objects). Services implemented by COM objects are exposed through a set of interfaces that represent the point of contact between clients and the object.
Why COM?
In order to understand the features provided by COM, you first need to understand the rationale for its existence. Binary code has been in use for a long time now. Libraries have been used in C and C++ from the very beginning. Windows programmers have been reusing DLLs (dynamically linked libraries). But there were other issues.
Libraries created using C/C++ compilers were often incompatible with executables created using a different C/C++ compiler. Secondly, DLLs were language

ADVANCED C# CONCEPTS |
Chapter 34 |
797 |
|
|
|
|
|
dependent. Moreover, updating DLLs posed greater problems. Compatibility between versions was not achieved because of memory allocation reasons. Changed DLLs often broke executables designed for an earlier version.
Benefits of COM
COM was an alternative developed by Microsoft to overcome these problems. The major benefits of COM are:
COM components can provide functionality in a standard way.
COM provides for component interoperability.
COM provides a good versioning mechanism that allows one system component to be updated without requiring updates to other components in the system.
COM components can be implemented in a number of programming languages.
Before we proceed further, I will take you through some commonly used terms in COM.
Interfaces
An interface is a specification that defines the type of behavior a class must implement. An interface provides a group of related methods that are pure virtual functions. These methods are not implemented in the interface but are implemented in the class that implements the interface.The class that implements the interface methods is referred to as coclass. When the coclass is instantiated,the instance that is created is referred to as component object.
A class that inherits an interface must implement every member of the interface. An interface enables other programs to access the functionality provided by your component.
Consider the following example, where a COM object behaves like a clock. The clock object supports two interfaces, IClock and IAlarm. The IClock interface provides the methods to set and read current time. The IAlarm interface provides the alarm and methods.