Sunday, May 31, 2009

WF 4.0 New Activities Tour.

In Windows Workflow 4.0 we see lot of new activities image. i just wanted to show you how to use them in series of Blog post.

ForEach /ForEach<T>:

ForEach activity contains a list of Values and a Body. At runtime, the list is iterated and the body is executed for each value in the list.

image

I created the variable called names as a array of string  with the following default values as shown below.

image 

using ForEach activity i loop through the names.

image 

Sequence :

The Sequence activity allows for the execution of one or more Activities in order.  in the above example  inside the Sequence Activity i placed ForEach and WriteLine activities .

image

Assign :

The Assign activity assigns the value of its Value argument to its To argument. The types of both arguments must be compatible. This compatibility is verified at runtime. 

Create a counter variable use assign activity to increment the value . 

image

IF :

The If activity selects a child activity for execution based on the value of a Boolean expression.

If the Boolean expression Condition yields True  “Then” activity is executed. If the expressions yields False  “Else” expression is executed.

image

 

While:

The While activity executes it's Body while a Boolean Condition is True.

image

Nandri(Thanks)

SeenivasaRagavan

Saturday, May 30, 2009

Creating Flowchart Workflow in WF 4.0

 

Flowchart workflow is a new type of Hybrid workflow in  WF 4.0. In this work flow we can able to use all type of  WF 4.0 activities.

In this Flowchart workflow i am using  FlowDecision activity to make Decision .

Flow Decision  activity contains a Boolean expression Condition. If the expression evaluates to “True”, the true path is executed otherwise, the false path is scheduled

image

This expressions are written in VB!. This means capitalization does not matter, comparison is performed using a single equals sign instead of “==”, and the Boolean operators are the words "and" and "or" instead of the symbols "&&" and "||". [I think in feature we will able to edit in C#]

.

Next i am using my Custom activity for to read user input from console . [ please refer my pervious blog post how to create custom activity http://mstecharchitect.blogspot.com/2009/05/creating-custom-activity-for-reading.html]

image

 

In this  Flowchart workflow i am giving an  example of Bank Account creation.  First i will greet the customer then ask customer to choose what type of account they wanted to create.  Once  customer input is read then using  Flow Decision  activity   i am checking  C for Checking  and S for Saving account.

accType.ToUpper() = "C" [ expression to validate or check user input ]

if Input is C then create checking account and assign customer checking account number print them and say thanks and start the workflow from start.

if Input is  S then ask details for to create a saving account. Here i am asking a questions to customer saying that what is your favorite  Search engine ? B-Bing  & G-Google.  if customer input was B then create a Saving account and assign account number print them and say thanks.  if customer input is G then i print a message saying that "Wait for Google to Open a Bank"

In this project i have defined the following list of variables  as shown below.

image

Here is the Flowchart workflow in WF 4.0 designer.

 

image

 

Nandri(Thanks)

R.SeenivasaRagavan

Friday, May 29, 2009

Creating Custom Activity for Reading Input from User [Console] in WF 4.0

In WF 3.5 we use Dependency Property to set Input and Output variables to the workflow.  Now in WF 4.0 there is no more Dependency Property.

Dependency Property is Replaced with  InArgument and OutArugment. In this Blog post  I am going to write Custom Activity using  OutArgument to read input from user.

Step1 : First Create Activity Library Project.

image

Step2 : Add WrokflowElement Template to the project.

image

Step3: Add Public property OutPut and  Override the  Exectue Method as Shown below.

namespace GetInputFromUser
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.ComponentModel;

[Designer(typeof(SreeniGetInputFromUser))]
public class GetInput : CodeActivity
{
OutArgument<string> outputString;
public OutArgument<string> OutPut
{
get
{
return outputString;
}

set
{
outputString = value;
}
}
protected override void Execute(CodeActivityContext context)
{
string userInput =Console.ReadLine();
context.SetValue(outputString, userInput);
}
}
}





Step4 : Now we are going to add Designer to our Custom Activity  so that it looks good when we add this activity into other Workflow applications.



image



Using XAML you can add Good Look and Feel of the custom activity



image



Step 5: Now add new Sequential workflow console application and Add  Reference as this custom activity project  and starting using custom activity inside newly created Sequential workflow Project.





image



once you finishing the workflow Press F5 to execute.



image



Nandri(Thanks)



R.SeenivasaRagavan,

Thursday, May 28, 2009

Microsoft New Search Engine Called Bing

Bing – Beatin(G)oogle

Microsoft is calling Bing a “decision engine” instead of a “search engine.”

For more information please  Click  here  http://blogs.zdnet.com/microsoft/?p=2900

Nandri(Thanks)

SreenivasaRagavan.

Wednesday, May 27, 2009

Creating WindowsEventLogger Custom Workflow Activity In WF 4.0

We will end up creating a custom workflow activity when we won't find in WF 4.0 designer  Toolbox.

Here i am going to create Custom Workflow Activity which logs the Message into Windows EventViewr.  This custom activity can be used for many purpose like Logging Error, Information message into Windows Event viewer. 

First we need  create a Activity Library Project..

image

After creating new Activity  Library  project add the  Workflow Element Template to the newly created project.

image

Note: This custom activity is code only activity so the  SreeniWindowsEventLogger   is inherited  from CodeActivity .

SreeniWindowsEventLogger  Custom Activity class derived from CodeActivity  class as shown below. Next we need to add public Property which takes string as a Message and write to the Windows Event Log.

namespace SreeniWindowsEventLogger
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.Diagnostics;
using System.ComponentModel;

[Designer(typeof(SreeniWindowsEventLoggerDesigner))]
public class SreeniWindowsEventLogger :
CodeActivity
{
public string Message { get; set; }
protected override void Execute(CodeActivityContext context)
{
EventLog.WriteEntry("Application", Message);
}
}
}
 
Now I am going to Add Activity Designer for my WindowsEventLogger so that it looks nice when we use it in other workflow applications.

image


Now we can use   XAML  to design our custom activity Look and feel.  this is really cool .


image


In this Activity designer inside the StackPanel  have added One Label and  TextBox where you can enter the message which you wanted to write in Windows Event Log when custom activity is executed..

<TextBox BorderBrush="Red" Margin="5" Height="30" Width="204" Text="{Binding Path=ModelItem.Message,Mode=TwoWay}"></TextBox>
Here I am binding TextBox Text property to the Message Property of the SreeniWindowsEventLogger class as shown above.

once you are done with XAML coding, now we need to  add  Designer Attribute to our Custom activity class as shown below. 

[Designer(typeof(SreeniWindowsEventLoggerDesigner))]
public class SreeniWindowsEventLogger : CodeActivity
Now Add new sequential console application workflow and add SreeniWindowsEventLogger  Reference project compile the project
you will see newly created custom activity in the ToolBox as shown here.
image 
Now Drag and Drop the newly created custom activity and edit message property and press F5 to execute. 
 





image


The message we put in Custom activity was written to Windows event log .


image


Nandri(Thanks)


SreenivasaRagavan

Tuesday, May 26, 2009

Creating Simple Sequential Workflow in WF 4.0

In this simple WF Application i am going to loop through 1 to 10

First Create new Sequential Workflow  Console Application project.

image

Now Drag and Drop WriteLine  Activity from Tool box .  Press F4 and Edit Text Property (Enter the Text in “”).   Next Drag and Drop While Activity from the Toolbox.

Note: WriteLine Activity is used for to write some text in Console.

image

Inside the while activity now Drag and Drop Sequence activity so that  we can add more then one Activity inside While.  In while activity we need to set the condition so first we need to create Variables called counter, number and use Assign activity  to manipulate the counter variable as shown below.

image

image

Now Drag and Drop If Activity   and edit the condition and Drag and Drop  WriteLine Activity in both  Then  and Else  part as shown. change the DisplayName of the WriteLine Activity as shown below.

image

Here is the XAML  View of the  above Work Flow . the same workflow we can write in C#/VB Code too.

 image

Now Press F5  we should we see the following Result.

image

Nandri( Thanks)

R.SeenivasaRagavan,

Tuesday, May 19, 2009

VS. NET 2010 Beta 1 IDE Screen Shots.

Start Page.

image

Projects : Where you can Pin your projects to show always in Recent Open Projects list.

image

VS.NET 2010 Project Templates.  and Multi-Targeting IDE development.

image

VS.NET 2010   Windows Workflow  Activity's and WF Designer  .

image

Nandri(Thanks)

Seenivasaragavan.

Visual Studio 2010 and .NET FX 4 Beta 1 ships!

Microsoft Visual Studio® 2010 First Look

It’s the next gen of next-gen applications. Visual Studio 2010 is being designed inside and out to give developers and development teams every advantage in getting groundbreaking applications to market—faster and easier than ever.

Today, we are releasing Beta 1 of Visual Studio 2010 and .NET FX 4.  If you are a MSDN subscriber, you can download the Beta today from here.  For the rest of the world, the Beta will be publicly available on Wednesday.

Nandri(Thanks)

R.SeenivasaRagavan.

Friday, May 8, 2009

Using Visual Studio 2008 SP1 (RTM) : Now we can use Add Service Reference options to Add ADO.NET Data Service Reference.

Before  Visual Studio 2008 SP1  to add a  ADO.NET Data Service  Reference (Proxy) we use  Datasvcutil.exe . Using  this tool we generate the Client side proxy and add that file in client side project  . Now using Visual Studio 2008 SP1 RTM simple we can use  Add Service Reference Options. (This is same as adding WCF Service Reference). 

First Create a Simple ADO.NET Data Service  selecting the following template. ( Add this template in ASP.NET Web Application).

image

Next Add  ADO.NET Entity Data Model or LINQ To SQL to the same project

image

Follow the Entity Data Model Wizard.

image

Here is the my  ADO.NET Data Service.

image

Now i am going to add this Service into my  Silver Light project using Add Service Reference options as shown below. ( This is same as  Adding WCF service Reference.)

image

image

After adding the service  to the client project Visual Studio generates all the client side classes , adds the references. now you can consume the service as shown below

image

Nandri( Thank you).

Sreenivasaragavan.

Tuesday, May 5, 2009

Windows 7 RC available now for public to download

 

Download   Windows-7  RC

  • A PC with these minimum recommended specifications:
    - 1 GHz 32-bit or 64-bit processor or higher
    - 1 GB of system memory or more
    - 16 GB of available disk space
    - Support for DirectX 9 graphics with 128 MB memory (to enable the Aero theme)
    - DVD-R/W Drive
    Please note these specifications could change. And, some product features of Windows 7, such as the ability to watch and record live TV or navigation through the use of "touch," may require advanced or additional hardware.

download-icon.jpg image by odd6hhsrecords

http://technet.microsoft.com/en-us/evalcenter/dd353205.aspx?ITPID=mscomsc

Nandri

R.SeenivasaRagavan.

Sunday, May 3, 2009

Today I Installed Windows-7 RC – 64 bit

Here is the list of features i like the most  because  i can easily access my files  and secure my data.  

Jump List:

Windows 7 introduces Jump Lists, a new feature that gives you easy access to the files you use most often. For example, if you have  Adobe Reader/ Microsoft Word on your taskbar, you can quickly get to your most recently opened files by right-clicking the Adobe Reader/ Microsoft Word taskbar icon. You'll see a list of recently opened files and you can also pin files that you want easy access to on a regular basis.

image image

Problem Steps Recorder :

A feature new to Windows 7 . This tool can be used  for provide technical support.  This tool basically takes screen shots of user mouse click and put it in MHTML  file.

image

Bit Locker :

This helps us to Protect Files, Folders and drives by Encrypting . Now we can enable Bit Locker for external USB drives.

image

More New Items In Control Panel

image

Nandari

R.SeenivasaRagavan.