Terminate.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Terminate.cs / 1305376 / Terminate.cs

                            namespace System.Workflow.ComponentModel 
{
 	using System;
	using System.Text;
	using System.Reflection; 
	using System.Collections;
 	using System.CodeDom; 
	using System.ComponentModel; 
 	using System.ComponentModel.Design;
 	using System.Drawing; 
	using System.Workflow.ComponentModel;
 	using System.Workflow.ComponentModel.Design;
	using System.Collections.Generic;
	using System.Drawing.Design; 
	using System.Workflow.ComponentModel.Compiler;
 	using System.Workflow.Runtime; 
 
	[SRDescription(SR.TerminateActivityDescription)]
 	[ToolboxItem(typeof(ActivityToolboxItem))] 
 	[Designer(typeof(TerminateDesigner), typeof(IDesigner))]
	[ToolboxBitmap(typeof(TerminateActivity), "Resources.Terminate.png")]
 	[SRCategory(SR.Standard)]
	public sealed class TerminateActivity: Activity 
	{
		public static readonly DependencyProperty ErrorProperty = DependencyProperty.Register("Error", typeof(string), typeof(TerminateActivity)); 
 
        #region Constructors
 
        public TerminateActivity()
        {
        }
 
        public TerminateActivity(string name)
            : base(name) 
        { 
        }
 
        #endregion

        protected internal override void Initialize(IServiceProvider provider)
        { 
            if (this.Parent == null)
                throw new InvalidOperationException(SR.GetString(SR.Error_MustHaveParent)); 
 
            base.Initialize(provider);
        } 

 		protected internal override sealed ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
		{
 			executionContext.CloseActivity(); 

 			string terminateReason = this.Error; 
            executionContext.TerminateWorkflowInstance(new WorkflowTerminatedException(terminateReason)); 
			return ActivityExecutionStatus.Closed;
 		} 
		[Browsable(true)]
		[SRCategory(SR.Activity)]
		[SRDescription(SR.TerminateErrorMessageDescr)]
 		[MergableProperty(false)] 
        [DefaultValue((string)null)]
        public string Error 
		{ 
 			get
 			{ 
				return (string)base.GetValue(ErrorProperty);
 			}
			set
			{ 
				base.SetValue(ErrorProperty, value);
 			} 
		} 

 	} 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK