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 System.Windows.Forms;

namespace LongRunningWorkflow
{
	public sealed partial class Workflow1: SequentialWorkflowActivity
	{
		public Workflow1()
		{
			InitializeComponent();
		}
        private Int32 _delay = 10;

        public Int32 Delay
        {
            get { return _delay; }
            set 
            {
                if (value < 0 || value > 120)
                    value = 10;
                if (ExecutionStatus == ActivityExecutionStatus.Initialized)
                {
                    _delay = value;
                    delayActivity1.TimeoutDuration = new TimeSpan(0, 0, _delay);
                }
            }
        }
        private void PreDelayMessage(object sender, EventArgs e)
        {
            MessageBox.Show("正在执行延时前的代码。");
        }

        private void PostDelayMessage(object sender, EventArgs e)
        {
            MessageBox.Show("正在执行延时后的代码。");
        }
	}

}
