[Reference from codeproject Articles...]
Friday, February 22, 2013
Tuesday, February 12, 2013
Three Layer Architecture in C# .NET
Introduction
Monday, December 3, 2012
Differences of Desktop Applications and Metro Applications in Windows 8
Modern UI was introduced tend to Tablet users, but this assumption is only from SOT. That’s why Windows 8 is provided in two versions, which are Pro and also RT. Its application is also available in two versions, desktop and also Metro. Do you know the difference between both? If you haven’t found out, SOT now will discuss about the difference between desktop and metro applications in Windows 8.
#1 Metro UI Application Design Display
In the beginning, we have discussed about Windows 8 display renewal with its Modern UI. What do you think about this Modern UI from Windows 8, do you like or hate it? In the first time Windows 8 appeared, actually this Modern UI design named Metro UI, since it is focused on image typography which appeared in Traffic sign. The average of Metro UI applications run in full screen display and hide Option display which made us focused on the application.
#2 Application is always in Windows Store
If you want Windows 8 with Metro UI or Modern UI applications, you can get it in Windows Store. By visiting Windows Store, then searching for applications you wanted and install it, then you have already enjoy this Metro UI design application. It surely different with desktop application you commonly download and install easily. But it is more profitable for user, since by this way, malware and viruses would be filtered first by Microsoft.
#3 Sandboxed
In Windows with desktop application, we know what we called as User Account Control, it means that application can be run as Administrator. So, this application would be able to access files or system they needed. Does it endanger your privacy? But it is different with Metro UI application. This Metro UI application is similar like Android, you can read what the application needed to be installed. So, if you feel disturbed because this application accessing your privacy too much, you don’t need to install it. This feature is called as Sandboxed.
#4 Always active and cannot be terminated
This metro application is similar like mobile application, so you cannot close the application when you come out from the application. The application will be run in background and doesn’t consume too much memory. If you think you can use Task Manager to close the Metro application, that’s definitely wrong. Microsoft makes an unclear reason so that user wouldn’t be able to close Metro application. That’s why you wouldn’t be able to see close button on upper right of Metro application exists.
#5 Applications cannot run at the same time
Not similar as desktop application which is able to run many application at once, whether application which seemed with various window or run in background, Metro UI application is only able to run by using two applications, the first application run on ¾ of screen, while the second apps run on ¼ screen. This feature is called as Snap. It surely different with Windows 7 which has Aero display with 50/50 snap when we do apps multitasking from the screen.
#6 Metro UI Application programming
In Metro application, developers are able to create it using C/C++ or .NET, JavaScript and HTML5 language programming. Here, Microsoft expects that there would be so many developers would be interested in creating Windows 8 apps according to language programming they understood. Metro UI application also support x86 and ARM devices, makes it possible to run in Windows 8 Pro and Windows 8 RT.
Reference from spyontech
Friday, November 30, 2012
Delegates in C#.Net
Delegate is a type which holds the method(s) reference in an object. It is also referred to as a type safe function pointer.
Advantages
- Encapsulating the method's call from caller
- Effective use of delegate improves the performance of application
- Used to call a method asynchronously
Declaration:
public delegate type_of_delegate delegate_name()
Example:
public delegate int mydelegate(int delvar1,int delvar2)
Note
- You can use delegates without parameters or with parameter list
- You should follow the same syntax as in the method
(If you are referring to the method with twoint
parameters andint
return type, the delegate which you are declaring should be in the same format. This is why it is referred to as type safe function pointer.)
Sample Program using Delegate
public delegate double Delegate_Prod(int a,int b);
class Class1
{
static double fn_Prodvalues(int val1,int val2)
{
return val1*val2;
}
static void Main(string[] args)
{
//Creating the Delegate Instance
Delegate_Prod delObj = new Delegate_Prod(fn_Prodvalues);
Console.Write("Please Enter Values");
int v1 = Int32.Parse(Console.ReadLine());
int v2 = Int32.Parse(Console.ReadLine());
//use a delegate for processing
double res = delObj(v1,v2);
Console.WriteLine ("Result :"+res);
Console.ReadLine();
}
}
Explanation
Here I have used a small program which demonstrates the use of delegate.
The delegate "
Delegate_Prod
" is declared with double return type and accepts only two integer parameters.
Inside the class, the method named
fn_Prodvalues
is defined with double return type and two integer parameters. (The delegate and method have the same signature and parameter type.)
Inside the
Main
method, the delegate instance is created and the function name is passed to the delegate instance as follows:Delegate_Prod delObj = new Delegate_Prod(fn_Prodvalues);
After this, we are accepting the two values from the user and passing those values to the delegate as we do using method:
delObj(v1,v2);
Here delegate object encapsulates the method functionalities and returns the result as we specified in the method.
Example 2:
1. Defining the delegate
public delegate int Calculate (int value1, int value2);
2. Creating methods which will be assigned to delegate object
//a method, that will be assigned to delegate objects //having the EXACT signature of the delegatepublic int add(int value1, int value2) { return value1 + value2; } //a method, that will be assigned to delegate objects //having the EXACT signature of the delegatepublic int sub( int value1, int value2) { return value1 - value2; }
3. Creating the delegate object and assigning methods to those delegate objects
//creating the class which contains the methods //that will be assigned to delegate objectsMyClass mc = new MyClass(); //creating delegate objects and assigning appropriate methods //having the EXACT signature of the delegateCalculate add = new Calculate(mc.add); Calculate sub = new Calculate(mc.sub);
4. Calling the methods via delegate objects
//using the delegate objects to call the assigned methods Console.WriteLine("Adding two values: " + add(10, 6)); Console.WriteLine("Subtracting two values: " + sub(10,4));
Thanks...
--Reference from codeproject,...
Subscribe to:
Posts (Atom)