Archive for C#

FREE Online Course for .NET 3.0

Collection 5134 : Developing Rich Experiences with Microsoft® .NET Framework 3.0 and Visual Studio® 2005

This collection of 3 2-hour premium clinics teaches about the new capabilities provided by the .NET Framework 3.0. These clinics are for experienced Developers and Software Architects who are looking to adopt Microsoft’s next generation technology within their solutions.

Topics covered within the collection include:

* Windows Presentation Foundation
* Windows Workflow Foundation
* Windows Communication Foundation

Requirements:

* Experience (2 years) as a full time developer using Visual Studio 2005 / Visual Studo 2003
* Experience developing one or more of the following:
o Web Applications
o Windows Forms Applications
o Server Components
o XML Web Services

This offer includes the following:
Clinic 5135 : Introduction to Developing with Windows® Presentation Foundation and Visual Studio® 2005
Clinic 5136 : Introduction to Developing with Windows® Workflow Foundation and Visual Studio® 2005
Clinic 5137 : Introduction to Developing with Windows® Communication Foundation and Visual Studio® 2005

Open Source Web Server

Today, One of my freind told me that she wants to read through some coding for WebServer. So, Im just sharing some links that I have in my fav-link of my browser.

C#: ASP.NET Cassini Sample Web Server
http://asp.net/Projects/Cassini/Download/

Introducing Cassini : By Scott Mitchell
http://aspnet.4guysfromrolla.com/articles/082702-1.aspx

C#: Multithreaded Webserver with GUI : By Abdullah A. AlBar.
http://www.codeproject.com/Purgatory/webservergui.asp

C#: XSP
http://www.mono-project.com/ASP.NET

Note: XSP is A part of Mono Project which is very popular Open-Source .NET IDE for ALL PLATFORMS.

C++: Apache - HTTP Server Project ****
http://httpd.apache.org/

Creating your own web server using C# : By Imtiaz Alam
http://www.codeguru.com/Csharp/.NET/net_general/article.php/c4603

MFC/C++: ASP Web Server By Pablo van der Meer.
http://www.codeproject.com/internet/aspwebserver1.asp

Framework 3.0

The Microsoft .NET Framework 3.0 (formerly known as WinFX), is the new managed code programming model for Windows. It combines the power of the .NET Framework 2.0 with new technologies for building applications that have visually compelling user experiences, seamless communication across technology boundaries, and the ability to support a wide range of business processes. These new technologies are Windows Presentation Foundation, Windows Communication Foundation, Windows Workflow Foundation, and Windows CardSpace (formerly code named “Infocard”).

Windows CardSpace
Windows CardSpace (formerly “InfoCard”) is a Microsoft NET Framework 3.0 (formerly WinFX) component that provides the consistent user experience required by the identity metasystem. It is specifically hardened against tampering and spoofing to protect the end user’s digital identities and maintain end-user control.

http://msdn.microsoft.com/winfx/reference/infocard/default.aspx

Windows Communication Foundation
Windows Communication Foundation (formerly code-named “Indigo”) is a set of .NET technologies for building and running connected systems. It is a new breed of communications infrastructure built around the Web services architecture. Advanced Web services support in Windows Communication Foundation provides secure, reliable, and transacted messaging along with interoperability. The service-oriented programming model of Windows Communication Foundation is built on the Microsoft .NET Framework and simplifies development of connected systems. Windows Communication Foundation unifies a broad array of distributed systems capabilities in a composable and extensible architecture, spanning transports, security systems, messaging patterns, encodings, network topologies, and hosting models. Windows Communication Foundation will be available for Windows Vista™ as well as for Windows XP and Windows Server 2003.

http://msdn.microsoft.com/winfx/technologies/communication/

Windows Presentation Foundation
The Microsoft Windows Presentation Foundation (formerly code named “Avalon”) provides the foundation for building applications and high fidelity experiences in Longhorn, blending together application UI, documents, and media content, while exploiting the full power of your computer.

http://msdn.microsoft.com/winfx/reference/presentation/default.aspx

Windows Workflow Foundation
Windows Workflow Foundation is the programming model, engine and tools for quickly building workflow enabled applications on Windows. It consists of a Microsoft .NET Framework version 3.0 (formerly WinFX) namespace, an in-process workflow engine, and designers for Visual Studio 2005.
http://msdn.microsoft.com/winfx/reference/workflow/default.aspx

.NET Framework Home 2.0
http://msdn.microsoft.com/netframework/

Adding and Removing Events.

Yeah. Small thing.. but I didn’t notice about that.. I think I might never notice about that if my friend “Lu taw lay” didn’t tell me…

Actually, when I was working on automation team, we needed to write the automation script for ComponentOne Control to ensure whether each property/ method and event of a particular control are working fine or not. When we were writing the scripts, we needed to add/remove the event at runtime. In case of removing a event from the control, we wrote like this.button1.Click -= null wrongly in our script. and we didn’t notice about that til the time my friend tell me.

VB
If CheckBox1.Checked Then
AddHandler Button1.Click, AddressOf button1_Click
Else
RemoveHandler Button1.Click, AddressOf button1_Click
End If

C#
if(this.checkBox1.Checked)
this.button1.Click += new System.EventHandler(this.button1_Click);
else
this.button1.Click -= new System.EventHandler(this.button1_Click);

References..
Handling Events in .NET

Getting the properties, attrs and evts of the control.


Imports System.ComponentModel Console.WriteLine("===============================");

///Getting the properties of a particular control.
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(checkBox1);

foreach(PropertyDescriptor p in properties){
Console.WriteLine(p.DisplayName +
" || " + p.Description);
}
Console.WriteLine("===============================");

///Getting the Attributes of a particular control.
AttributeCollection attributes =
TypeDescriptor.GetAttributes(checkBox1);

foreach (Attribute a in attributes) {
Console.WriteLine(a.TypeId);
}
Console.WriteLine("===============================");

///Getting the Attributes of a particular control.
EventDescriptorCollection events =
TypeDescriptor.GetEvents(checkBox1);

foreach (EventDescriptor evt in events) {
Console.WriteLine(evt.DisplayName);
}

There is another good way to get all properties, methods and events from assembly by using System.Reflection.I’ll post this coding as soon as possible. Please feel free to let me know if you have any problem with this coding.
Thanks. Enjoy reading!

C# - Enums

Adding Enum Values to ComboBox


comboBox1.Items.AddRange(System.Enum.GetNames(typeof(importants)));

Converting String to Enum


importants ipt =  (importants)System.ComponentModel.TypeDescriptor.GetConverter(typeof(importants)).ConvertFromString(comboBox1.SelectedItem.ToString());

OR


importantsipt = (importants)System.Enum.Parse(typeof(importants), comboBox1.SelectedItem.ToString());

Getting values from Enum


foreach(int i in Enum.GetValues(typeof(importants))){
MessageBox.Show(i.ToString());
}