The directory browsing example in the previous section illustrated how to use the DirectoryInfo and FileInfo classes to list all the directories and files, respectively. In this section, you learn how to read and write data from and to local files, as well as how to load and unload a control dynamically at runtime. For this [...]
The directory feeding warning in the preceding country illustrated how to ingest the DirectoryInfo and FileInfo classes to itemize every the directories and files, respectively. In this section, you see how to feature and indite accumulation from and to topical files, as substantially as how to alluviation and deliver a curb dynamically at runtime. For this [...]
The Stream class is the base class of System.IO objects and is the foundation of all file access I/O classes. It provides a basic data transfer capability: moving bytes from one data unit to another, independent of data storage media. It includes methods such as Read() and Write() to perform I/O synchronously, and it includes [...]
A number of classes have been defined and implemented in the System.IO namespace to interact with the filesystem. These classes enable you to manipulate files and directories, such as creating, deleting, copying, and moving files. In the .NET Compact Framework, two classes are available for accessing information pertaining to directories: Directory and DirectoryInfo. Likewise, the File [...]
The MainMenu control is also available in the .NET Compact Framework to enable you to easily create menus for your mobile applications. As you may have noticed, you can add only two menu items at the top level, which is largely due to the small display size of Smartphone devices. All other features look very [...]
Prior to Windows Mobile 5.0, Smartphone forms do not have the AutoScroll property. As a result, when the size of a form is bigger than the screen, the out-of-area controls are never displayed, regardless of how a user navigates the form. The AutoScroll property is now supported in Windows Mobile 5.0 Smartphone, albeit with a [...]
Developers have tested a number of scenarios to determine how to improve the performance of loading a form. Their findings suggest reducing the number of method calls and creating controls using the topdown technique. For example, when setting the Location and the Size of a TextBox control, you can certainly use code as follows: this.textBox1.Location = new Point(10, 20); this.textBox1.Size [...]
Sometimes it’s the small events that are the most exciting. Like the day I made three cents. Not three dollars. Not thirty dollars. Just three cents. And yet it was a very exciting event because of what those three cents represented. I made those three cents the first time someone clicked an advertisement on one of [...]
If you’re new to Google AdSense, it’s important to first realize how the program works and why it works so well. All AdSense ads are targeted to your website’s niche. For example, if a new computer site has AdSense ads on its pages, the ads will have something to do with computers and will be [...]
Besides the soft keys, two other keys are special in Smartphone devices: Home and Back. As its name implies, the Home key returns users to the Home screen from anywhere at any time. The Back key performs different functions depending on the state of the application. It is generally designed to return users to the [...]
In the file Form1.cs, the event handler is automatically generated and defined as follows: private void textBox1_GotFocus(object sender, EventArgs e) { } The parameter sender represents the source of the event, and parameter e is an instance of EventArgs, which can be used to contain event data. For the sample application, when textBox1 receives the cursor focus, you need [...]
Prior to Windows Mobile 5.0, Smartphone forms do not have the AutoScroll property. As a result, when the size of a form is bigger than the screen, the out-of-area controls are never displayed, regardless of how a user navigates the form. The AutoScroll property is now supported in Windows Mobile 5.0 Smartphone, albeit with a [...]
The Smartphone-specific features that most affect the UI design are likely the two soft keys: The toplevel menu items are invoked only by the pressing the soft keys. As a direct result, a MessageBox control for Smartphone applications supports only two buttons; there are simply no additional soft keys to respond to a third button. For instance, [...]
Two important properties, TabStop and TabIndex, are not supported prior to Windows Mobile–based Smartphone forms. That means you cannot change the tab order during design time and runtime. Technically, tab order does not exist in Smartphone applications because there is no Tab key on Smartphone devices. However, when users navigate the different controls using the [...]
Researchers have found another use for the microsoft anti spam technology that keeps inboxes junk-free: developing vaccines for HIV. With the same microsoft anti spam software techniques traditionally used to analyze databases and track spam, medical researchers can find hidden patterns in millions of HIV strains and create improved vaccine designs. The genetic patterns are necessary [...]
When a Windows Mobile–based Smartphone device application project is open in Visual Studio 2005, a simple way to see the available controls is to examine the Toolbox window in the Visual Studio IDE, as shown in image below. If for any reason the Toolbox window is not shown on the IDE, you can open it [...]
Even though Windows Mobile 5.0 controls inherit their properties, methods, and events (PME) from the .NET System.Windows.Forms.Control class, not all the PMEs defined in the base class are implemented because of the limited computing power and memory space available to the Smartphone devices. For example, the Maximum and Minimize buttons of a form are not [...]
The term forms refers to the windows of .NET-based applications. The responsibilities of forms include displaying information and receiving user input through events. To create a Smartphone form in Visual Studio 2005, choose the New Project Wizard and then choose the C# application type. The template you are going to use is Device Application. The [...]
You can deliver an application package to a user’s Smartphone device in a number of ways, including ActiveSync, a web download, an e-mail attachment, Service Indication (SI) SMS (Short Messaging Service) or Service Loading (SL) SMS, or storage cards. The SMS methods for application package delivery take advantage of commonly used text messaging services to [...]
After you have installed the certificates onto your development computer, you will be able to use them in Visual Studio 2005. It is recommended that a Smartphone application should have its assemblies (if it is a managed project), EXEs, DLLs, CABs, and MUI (Multilingual User Interface) files signed before they are delivered to the end [...]
Windows Mobile for Smartphone supports two types of security models: one-tier security and two-tier security. The one-tier model dictates that signed applications with a certificate are generally trusted, can run on the device, and have privileged access to the device (Privileged mode). For unsigned applications, the device’s security policies will be checked to determine two [...]
Any Smartphone CAB files, application executables, and libraries must be digitally signed before being deployed to a user’s device. The privileges of both signed and unsigned applications are restricted by the device’s security policy. The reason for application signing is to ensure application security. Otherwise, how can you trust an application published on the Internet? [...]
To package a Smartphone application, you must add a Smart Device CAB (cabinet) project to your Visual Studio 2005 solution. From the main menu, select File➪Add➪New Project. In the Other Project Types category, select Setup and Deployment, and then choose Smart Device CAB Project (not CAB Project) from the Visual Studio installed templates, as shown [...]
The process for testing and debugging a Smartphone application is similar to the process for a desktop .NET application. When testing with the emulator, you are free to add breakpoints to your code, step into or over the code, add watches for variables and expressions, or view call stacks and local variables when the program [...]
After debugging and testing an application on a real Smartphone device, you may deploy the application on a user’s device. There are three stages in the entire deployment procedure: Package the application using a Visual Studio 2005 Smart Device CAB project. Deliver the package to a user’s device via a web server, an ActiveSync copy, an e-mail [...]
You may wonder which files have been automatically generated by Visual Studio 2005 so far; you did not specify any filenames yet. In fact, Visual Studio 2005 has created a number of files for the FirstSmartphoneApp project. Knowing the details of these files will be crucial for further development. Admittedly, there is no big difference [...]
The next step is to add some code to the form. We want to display a message box after a user enters some information and clicks the OK button. The message box will contain text for the employee’s name, the department, and the employee’s status. Go back to the Form Designer and double-click OK at the [...]
After you install the required tools listed in my previous post, you can start programming your very first Smartphone project. To begin, launch Visual Studio 2005 from the Start menu, and then create a new Smart Device project by clicking New -> Project. You will see the project wizard. Here you can choose from four [...]
You need to have Microsoft ActiveSync to connect your Smartphone device to your Windows PC. ActiveSync acts as the gateway between your PC and your Windows Mobile device so that you can easily transfer files or synchronize application data such as e-mail, a calendar, and so on. For Smartphone development, ActiveSync is needed by Visual [...]
Visual Studio 2005 comes with a new device emulator called Microsoft Device Emulator, which is a completely rewritten version of the Smart Device software emulator. Previously, the device emulator for Pocket PC and Smartphone was a Windows CE operating system image running in a virtual x86 emulation environment. However, in the mobile and embedded world, [...]
Visual Studio 2005 (code-named Whidbey while in development) is Microsoft’s latest integrated development environment (IDE) for both desktop and device application development. The previous version of Visual Studio, Visual Studio .NET 2003, can also be used for application development targeting Windows Mobile 2003 devices. Both Visual Studio versions enable you to program, debug, test, and [...]
Once you click the Import button in the Import Photos dialog, your photos are imported into Lightroom, right? Right. But exactly where are they? They’re in two different places, and understanding the difference between these two areas is important. Step One Remember how I mentioned that your images come in as shoots? Well you can quickly find [...]
An array is a collection of elements of the same type. The System.Array class is the abstract base class for all arrays. The element type of an array can be any value type or reference type, even an array type. An array can be one-dimensional or of multiple dimensions. When creating an array, you either [...]
As an object-oriented language, C# implements a special polymorphism mechanism. You can specify a method in a base class by using the virtual keyword, making it a virtual function to be overridden in a derived class. Virtual functions or methods are not bound to an object at compilation time, as with most method calls; rather, [...]
A class can also have an access modifier, such as public and internal. The public modifier makes the class available to everyone, whereas the internal modifier makes the class available only within the underlying assembly. The default class access modifier is internal. Note that the member access modifiers are restricted by the class modifiers. For [...]
A C# class uses the following five modifiers to specify the accessibility of class fields and methods: public—public modifiers are open to everyone. protected—protected fields and methods can be accessed from within the class and any derived classes. private—private fields and methods are available only to the underlying class. By default, class members are private. internal—internal fields and methods [...]
Because C# does not allow multiple inheritance, you cannot derive your class from more than one base class. However, you can derive your class from multiple interfaces and/or a single base class. An interface is a contract between the interface designer and the developer who will write a class that implements the interface. It specifies [...]
In the C# programming paradigm, it is always necessary to be able to allow callback functions that will be called when a specific event occurs. The event can be a GUI event, a timer timeout, I/O completion, and so on. A delegate in C# is a facility to enable type-safe callback functions. You can specify [...]
Parameter passing of value types in C# is call-by-value—that is, the value of a variable the caller submits as parameter is passed to the method, in which a local copy of the parameter is created on the call stack. Thus, any change to the local copy will not influence the variable the caller uses. Parameter passing [...]
Any class, interface, event, and delegate is a reference type. Aclass type is declared using the keyword class. Aclass can contain fields, methods, properties, indexers, delegates, or other classes The following code is an example of these class members (except delegates): // Code of class fields, properties, etc. using System; namespace ClassDemo1 { struct StudentDataEntry { public uint studentID; public string studentName; public StudentDataEntry(uint id, [...]
C# has two built-in reference types: object and string. The object reference type is an alias of the System.Object type in the .NET Compact Framework, whereas string is an alias of System.String. The following code provides some examples of string variables: string productName = “Windows Mobile for Smartphone”; //Create a literal string referenced by productName string filePath [...]
Lightroom has four separate areas (Adobe calls them modules because an in-house committee decided that would be the stuffiest, most engineering-like name possible). You’re going to be moving between these four modules quite frequently so we might as well learn the best ways to get where we want to go, and know [...]
An expression is composed of variables, literals, and operators. Literals can be any string literal or a number literal. Operators in C# are similar to those in C and Java; the same associativity and precedence rules apply. For operators of the same precedence, the associativity rule dictates the following: The assignment operators are right associative—that is, [...]
A variable of a reference type contains the reference to the actual data. Reference variables are also known as objects or instances. Assignments of reference variables of the same type, such as a=b, does not copy the data object of b to a. Instead, a will reference to the data object of b. This effect [...]
A variable is of a specific data type. The data types shown in my earlier post .NET Compact Framework Type System list the data types of C#. You can initialize a value type by assigning a value of that type to the variable, as shown here: bool isVisited = true; uint studentID = 41292922; int myAge = 24; float [...]
If you have experience with C or Java, then C# should not be problematic. As an object-oriented programming language, C# uses classes to encapsulate data and operations of a specific entity. A C# program must contain at least one class, and programs that can be directly executed by the CLR must have a Main method [...]
.NET languages such as Visual C# and Visual Basic are based on the same type system as the .NET Compact Framework and use the same class library. Thus, developers familiar with one .NET language (and therefore the .NET Compact Framework type system) can easily move to another .NET language. Every class in the .NET Compact Framework, [...]
During the non-.NET years, the typical way to develop mobile applications for Microsoft Windows CE operating systems was to use eMbedded Visual Tools, including eMbedded Visual Basic and eMbedded Visual C . It is strongly suggested that developers who are familiar with eMbedded Visual Basic move to Visual Basic .NET on Visual Studio for .NET Compact [...]
Smartphone application development has been integrated with Microsoft’s unified IDE, Visual Studio .NET, in an effort to offer a universal software environment that supports both desktop and mobile .NET-based application development. It can be used to develop, debug, test, and deploy .NET Compact Framework–based Smartphone applications. In fact, the .NET Compact Framework, including the CLR [...]
If you are new to mobile software development, then you probably don’t need to know the previous versions of software development tools provided by Microsoft. Because of the latest release of Visual Studio 2005, you can simply unify your work on a single IDE tool: Visual Studio .NET with Smartphone Device Programmability (SDP), using C# [...]

Comments