Common SimpleTask
Common_SimpleTask_CSharpSimpleTask_CSharp\SimpleTaskDesigner_CSharp.cs
// Copyright 2007 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Design;
using System.ComponentModel;
using System.ComponentModel.Design;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Design.Designers;

namespace SimpleTask_CSharp
{
    public class SimpleTaskDesigner_CSharp : TaskDesigner
    {
        public SimpleTaskDesigner_CSharp()
            : base()
        {
            verbs.Add(new DesignerVerb("Edit the button text", new EventHandler(OnEditButtonText)));
        }

        protected void OnEditButtonText(object sender, EventArgs args)
        {
            SimpleTask_CSharp task = this.Component as SimpleTask_CSharp;
            PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(task)["ButtonText"];
            UITypeEditor editor = new ButtonTextEditor();
            object newValue = editor.EditValue(new TaskControlDesignerTypeDescriptorContext(this, propertyDescriptor), (IServiceProvider)this, propertyDescriptor.GetValue(task));
            propertyDescriptor.SetValue(task, newValue);
        }
    }
}