.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Wrapping an activity as it is dropped

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :Windows Application
I'm trying to create an activity that is basically a parallel activity, but whenever an activity is dropped into it, the dropped activity is automatically wrapped in a sequence activity. EG. picture a Pick activity.  Currently you can only drop PickBranches as children, and then add other activities into the pick branches  What I want would allow any type of activity to be dropped directly into the Pick.  If the activity is not a pickbranch, it will automatically wrap the dropped activity in a Pick branch, and then place the Pick branch in the Pick. Also, I really what this functionality to belong to my custom Parallel activity designer (equiv of Pick branch in the example), as I want this to work for all activity types, not just ones that expect to be added here (i.e. ActivityTemplateFactory is not a solution). Any suggestions will be gratefully received. Cheers  Jason Bolstad

View Complete Post

More Related Resource Links

How do I get the parent activity when an activity is moved/dropped/pasted?

I can't seem to find a way of determining the parent activity of an activity when it is moved about.  I have an activity that needs to be bound to a parent activity when it is inside a certain parent activity, but when outside of the parent, it needs to have the inarg blanked out so that it can be manually bound to the parent. I have all the logic worked out other than determining the parent activity. I'm using the ModelService_changed event in my rehost to detect the movement of the activity (this seems to be the only way of detecting when an activity is added, moved or copied).  The only problem is that when an activity is moved within the patern (dragged to a new location) the ModelService_changed event fires before the activities model item has been updated. So my attemps to bind always end up binding to the previous parent activity! Is there either 1. A way of getting the current (new) parent activity from the modelItem inside the ModelService_changed event? 2. Another way of detecting if an activity has been added, moved, or pasted into a new location in the workflow? Any help will be greatly appreciated. Cheers,  JasonJason Bolstad

Coroutines: Implementing Coroutines for .NET by Wrapping the Unmanaged Fiber API


Coroutines are a powerful feature of many programming languages including CLU, Scheme, Python, Ruby, and ICON. Coroutines can save processor overhead and reduce redundancy because they allow you to stop execution of a procedure midstream, return a value, and resume exactly where the procedure left off.This article shows how coroutines can be implemented for the .NET Framework by using the Fiber API and Managed Extensions for C++, and how they can be easily used with other .NET-compliant languages. This article also shows a sophisticated use of the runtime host for running multiple managed threads on a single OS thread.

Ajai Shankar

MSDN Magazine September 2003

A Simple XML-driven Tool: Monitor Your Web Site's Activity with COM and Active Scripting


This article describes a simple Web site monitoring tool built with XML, JScript, Windows Script Host, and COM objects. Although it is not intended to replace complete Web site monitoring software products, it has many useful features that help to keep Web servers up and running. An XML configuration file specifies which Web sites to monitor and the actions to be taken if the site isn't functioning properly. In addition, the tool can be scheduled to run at any specified interval using the Windows Task Scheduler. Functions that probe the sites, log events, and send e-mail notifications are written in JScript.

Panos Kougiouris

MSDN Magazine July 2000

System.NullReferenceException: At Createtask Activity



I created  Approval Workflow application(.net3.0), it has successfully deployed at sharepoint server, but when executing  workflow at createTask activity, the following errror has occured.

System.NullReferenceException: Object reference not set to an instance of an object.     at BasicApprovalWorkflow.Workflow2.createApprovalTask_MethodInvoking(Object sender, EventArgs e)

below is the code :



void createApprovalTask_MethodInvoking(object sender, EventArgs e)



How to Cancel a Workflow Activity - LogToHistoryListActivity


How can I cancel a LogToHistoryListActivity? I don't understand how to get access to the ActivityExecutionContext. I guess one way is to add an IfElse before entry to avoid the activity completely. Casting the sender object does not work. Help anyone?

  private void logToHistoryListActivity_WorkflowActivated_MethodInvoking(object sender, EventArgs e)
   LogToHistoryListActivity log = (LogToHistoryListActivity)sender;
   string msg = string.Format("Work Request has been SAVED by {0}. Awaiting submittal.", workflowProperties.Originator);
   WFHelper.LogMessageToHistoryList(log, msg, null);

C# - Creating web client for automating user activity on a HTTPS site

I've been wracking my brain for a couple of weeks on this.  I need to create a web client (I don't want to use the webBrowser control because I need this to be as lightweight as possible) to log in to a secure web site, and then effectively click links and fill in fields to get the data that would normally be displayed in the web browser.  I'm then going to parse the data and perform other actions with it. I have been working with HttpWebRequest and HttpWebResponse and many permutations of suggestions I have found while Googling my issue, but I can't get rid of my problem:  Sometimes when I effictively click the ultimate link that I need to click to get to my data, I get what I am looking for.  However, MOST of the timel, I get a response page that tells me my connection timed out and that I need to log in again.  I have tried messing with cookies and such, but to no avail. I know it's good form to post my code, but it is so sloppy and screwed up right now from tweaking this and trying that, that I'd rather not take the approach of fixing what's there, rather I'd like to start with solid, clean code to begin with. Your help will be greatly appreciated. Thanks, ALo

SQL Server 2008 - Job Activity Monitor Failing

I recently began migrating to Windows 2008. One of the first servers is a server which we install our tools on. This is a new server which currently is only running the SQL Server management tools. On this server I installed the SQL Server 2008 R2 management tools, prior to this install there were no other SQL Server tools installed on this server. The majority of the functionality works and I can connect and manage multiple databases servers from SQL Server version 2000 through 2008. But when I try to bring up the Job Activity monitor I get an error ==> Can not show requested dialog. From Windows XP Windows Server 2003 SP2 this functionality works. I get this error if I connect to a SQL Server 2005 or 2008 database instance. I have tried re-installing the client tools but I still get this error..... any ideas?

Is all this activity wasted

I support a third party application that is absolutely terrible.  Most of the bad I understand, but my SQL Profiler comes back with these types of entries RPC:Starting declare @p1 int set @p1=-1 exec sp_prepare @p1 output,NULL,N'SELECT * FROM Payments',1 select @p1 SP:Statement complete SELECT * FROM Payments RPC:complete declare @p1 int set @p1=-1 exec sp_prepare @p1 output,NULL,N'SELECT * FROM Payments',1 select @p1 Even when their is an SP_sqlexecute, they don't pass the plan handle and the SQL is more select * from payments where customer = 111 What are they trying to do   Thanks for any replies   mark      

Properties of a child activity are null when the activity executes

I have an activity library containing several activites; one of my activities, let's call it MainActivity, contains another one, InnerActivity. A code block in MainActivity sets some properties of InnerActivity, but then when InnerActivity is executed, these properties are null. Some of these properties being set are dependency properties, other are "plain" properties. I had done the same thing in another activity and had got no problems at all. Any hints why this is happening? Thanks, PaoloPaolo Tedesco - http://cern.ch/idm

TFS 2010:Testing Workflow 4.0 activity

Hi EveryOne, Is there any way to test the workflow activity with out queing the new build?Usually while working with TFS2008, we ll test the particular class  through console application by passing parameters. In TFS 2010 ,i need to test the workflow ?is there any way some thing like creating an object for workflow and calling through console application? Please  suggest me. Thanks & Regards, eswar reddy 

Should I Use an Extenal Activity

I have a windows services hosted 3.5 Workflow. It mostly wakes up periodically makes a call to a secure service and retreives NOTAMS for the period it was sleeping. This works fine. Now I need to alter this by adding a new branch, If it is a certain time of day I need to retreive a list of NOTAMS and check to see if My process has gotten everything I'm supposed to have. I then take the result set of missing Notams and iteratively call the sercure service to retreive the missing NOTAMS one at a time. This is where my process breaks as I am unable to serialize the Certificate that the secure service requires as part of the https request object. Would this be a target for an external Data exchange? Thanks

Creating a Validator class for a custom activity

I created a new Workflow Activity Library and then added a new Activity called BindForm2Activity. After that I added a new class called BindForm2Validator and then placed an attribute to the BindForm2Activity to link it to the validator class.   Here is the code for each of the classes:   BindForm2Activity.xoml.cs: Code Snippet   using System;using System.ComponentModel;using System.ComponentModel.Design;using System.Collections;using System.Drawing;using System.Linq;using System.Workflow.ComponentModel.Compiler;using System.Workflow.ComponentModel.Serialization;using System.Workflow.ComponentModel;using System.Workflow.ComponentModel.Design;using System.Workflow.Runtime;using System.Workflow.Activities;using System.Workflow.Activities.Rules; using FormsCollection;using Utils; namespace ActivityLibrary{    [ActivityValidator(typeof(BindForm2Validator))] public partial class BindForm2Activity : SequenceActivity {        public static DependencyProperty FormToBindProperty = System.Workflow.ComponentModel.DependencyProperty.Register("FormToBind", typeof(FormsCollection.Form2), typeof(BindForm2Activity));         [Description("Form to bind a datasource to it ")]        [Category("BindForm2ToDataSource")]        [Browsable(true)]        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]        public FormsCollection.Form2 Form

Sequential Workflow project unable to compile referencing x64 Workflow Activity Library

Folks -   I have an sequential workflow project targeting x64 that will not compile if the workflow activity library that it references is compiled for x64 (it will compile if the activity library targets x86).  The compile error I receive is: Compilation failed. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. [project name]   Any thoughts on how to figure this out?   Thanks.

How to get this.Parent in execute method of activity.

Hi, Inside execute "protected override void Execute" of the NativeActivity i want to get its parent.    protected override void Execute     (     NativeActivityContext context     )       { this.Parent Actually my problem is that i want to check if this activity is in sequence or parallel during execution. Please help me.    ilogik

Can anyone please tell me how to Change DisplayName of the activity

Can anyone please tell me how to Change DisplayName of the activity. For example my activity name is MyActivity when i drop it to designer its ok its name appear as MyActivity, but when i drop it second time in that work flow its DisplayName should be MyActivity1. Similary third and fourth instance should be named as MyActivity2 and MyActivity3.ilogik

Freeform Custom Activity Designers using ICompositeView

Hello,   I'm using code posted here http://blogs.msdn.com/b/tilovell/archive/2009/12/31/freeform-custom-activity-designers-using-icompositeview.aspx hosted in a designer taken from Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4( UsingWorkflowItemPresenter.sln). However, I can't drag & drop Activity1 given as sample into Canvas or any other kind of activity for that matter. Could you tell me what I'm doing wrong, please? Also, I would like to know how I could make the Canvas activity fill the WorkflowDesigner and not being able to be deleted. Thank you
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend