I presented a session in Visual Studio 2012 Tech Tour in collaboration of C# Corner Mumbai User Group and Microsoft India.
My presentation topic was Agile Development using TFS 2012. Read the official recap Here
Because a synchronous method call can create a delay in program flow which turns out to be bad user experience. Hence, an asynchronous approach will be better. Asynchronous method call will return immediately so that the program can perform other operations while the called method completes its work in certain situations.
The asynchronous methods behavior is different than synchronous ones. You call them; they start executing, but return the control back to the thread which called them in no time; while they continue to execute on different thread.
In general, asynchronous programming makes sense in two cases as:•
• If you are creating a UI intensive application in which user experience is prime concern. In this case, an asynchronous call allows the user interface to remain responsive. Unlike shown in Figure 1-1.
Implementing an MDI Form
The Multiple-Document Interface (MDI) is a specification that defines a user interface for applications that enable the user to work with more than one document at the same time under one parent form (window).
Visualize the working style of an application in which you are allowed to open multiple forms in one parent container window, and all the open forms will get listed under the Windows menu. Whereas having an individual window for each instance of the same application is termed as single document interface (SDI); applications such as Notepad, Microsoft Paint, Calculator, and so on, are SDI applications. SDI applications get opened only in their own windows and can become difficult to manage, unlike when you have multiple documents or forms open inside one MDI interface.
Hence, MDI applications follow a parent form and child form relationship model. MDI applications allow you to open, organize, and work with multiple documents at the same time by opening them under the context of the MDI parent form; therefore, once opened, they can’t be dragged out of it like an individual form.
The parent (MDI) form organizes and arranges all the child forms or documents that are currently open. You might have seen such options in many Windows applications under a Windows menu, such as Cascade, Tile Vertical, and so on.
Try It: Creating an MDI Parent Form with a Menu Bar
In this exercise, you will create an MDI form in the WinApp project. You will also see how to create a menu bar for the parent form, that will allow you to navigate to all the child forms. To do so, follow these steps:
WinApp objWA = new WinApp();
UserInfo objUI = new UserInfo();
Figure 1-1. Running an MDI form application
This issue will be addressed later in this chapter.
Figure 1-2. Running an MDI form application
How It Works
Each Windows Forms form is a class and exposes a Show() function by an instance created for it. You use the following code, that is creating an object and then invoking the Show() method. This opens the other form from the MDI parent form.
This creates an instance of the WinApp form and opens it for you:
WinApp objWA = new WinApp();
The following code creates an instance of the UserInfo form and opens it for you:
UserInfo objUI = new UserInfo();
Security is an essential part of an application and it should be taken into consideration from the grass root level from an application’s design. Security is all about protecting your assets from unauthorized actions.
But Code Access Security (CAS) is a feature of .NET CLR which enables you to control the permissions which an individual .NET application have on your system during its execution. As a developer, you must understand how to create applications that work even when some permission is restricted or to restrict your application to perform certain tasks for example, a user can’t delete/create a file in C:\Windows directory Read Full Article Here
Understanding Windows Forms
Windows Forms, also known as WinForms, is one of the longest lived and oldest techniques for building Desktop applications. Windows Forms work as containers to host controls that allow you to present an application. Even though WPF has been available since 2007 and was delivered as part of .NET 3.0 and onwards, WinForms are still used heavily in Enterprise application development and remains a strong competitor for WPF. If your application doesn’t need heavy graphics, multimedia and/or a rich eye candy UI then Windows Forms is the best technology to build a Desktop client application.
User Interface Design Principles
The best mechanism for interacting with any application is often a user interface. Therefore, it becomes important to have an efficient design that is easy to use. When designing the user interface, your primary consideration should be the people who will use the application. They are your target audience, and knowing your target audience makes it easier for you to design a user interface that helps users learn and use your application. A poorly designed user interface, on the other hand, can lead to frustration and inefficiency if it causes the target audience to avoid or even discard your application.
Forms are the primary element of a Microsoft Windows application. As such, they provide the foundation for each level of user interaction. Various controls, menus, and so on, can be added to forms to supply specific functionality. In addition to being functional, your user interface should be attractive and inviting to the user.
Best Practices for User Interface Design
The user interface provides a mechanism for users to interact with your application. Therefore, an efficient design that is easy to use is of paramount importance. The following are some guidelines for designing user-friendly, elegant, and simple user interfaces.
Simplicity is an important aspect of a user interface. A visually “busy” or overly complex user interface makes it harder and more time-consuming to learn the application. A user interface should allow a user to quickly complete all interactions required by the program, but it should expose only the functionality needed at each stage of the application. When designing your user interface, you should keep program flow and execution in mind so that users of your application will find it easy to use. Controls that display related data should be grouped together on the form. ListBox, ComboBox, and CheckBox controls can be used to display data and allow users to choose from preset options.
The use of a tab order (the order by which users can cycle through controls on a form by pressing the Tab key) allows users to rapidly navigate fields.
Trying to reproduce a real-world object is a common mistake when designing user interfaces. For instance, if you want to create a form that takes the place of a paper form, it is natural to attempt to reproduce the paper form in the application. This approach might be appropriate for some applications, but for others, it might limit the application and provide no real user benefit, because reproducing a paper form can limit the functionality of your application. When designing an application, think about your unique situation and try to use the computer’s capabilities to enhance the user experience for your target audience.
Default values are another way to simplify your user interface. For example, if you expect 90 percent of the users of an application to select Washington in a State field, make Washington the default choice for that field.
Information from your target audience is paramount when designing a user interface. The best information to use when designing a user interface is input from the target audience. Tailor your interface to make frequent tasks easy to perform.
Position of Controls
The location of controls on your user interface should reflect their relative importance and frequency of use. For example, if you have a form for both the input of required information and of optional information then the controls for the required information are more important and should receive greater prominence. In Western cultures, user interfaces are typically designed to be read from left to right and from top to bottom. The most important or frequently used controls are most easily accessed at the top of a form. Controls that will be used after a user completes an action on a form, such as a Submit button, should follow the logical flow of information and be placed at the bottom of the form.
It is also necessary to consider the relatedness of information. Related information should be displayed in controls that are grouped together. For example, if you have a form that displays information about a customer, a purchase order, or an employee then you can group each set of controls on a Tab control that allows a user to easily move back and forth between displays.
Aesthetics is also an important consideration in the placement of controls. You should try to avoid forms that display more information than can be understood at a glance. Whenever possible, controls should be adequately spaced to create visual appeal and ease of accessibility.
Your user interface should exhibit a consistent design across each form in your application. An inconsistent design can make your application seem disorganized or chaotic, hindering adoption by your target audience. Don’t ask users to adapt to new visual elements as they navigate from form to form.
Make sure you are joining me today via my Webinar “C# 5.0 Async Programming” July 21st 8pm IST.
IST – 8pm, EST – 10:30am, PST – 7:30am
Follow the steps to setup to join the Webinar.
Proper design is a major factor that contributes to the scalability and performance of any application.
* Efficient Resource Management
* Considerations for Crossings the Application Boundary
* Single Large Assemblies or Multiple Smaller Assemblies
* Code Refactoring by Logical Layers
* Threads are a Resource worth Sharing
My article on C# .NET Application Design Considerations can be read here
Event Type: Webinar
Event Date/Time: July 21 Sunday 8.00 P.M – 9.30 P.M.
Registration Details Click Here
Topics to be covered.
* Evolution of C# Language
* What is Synchronous
* What is Asynchronous
* Asynchronous Patterns
* Side-by-Side Comparisons