Common_SimpleServerTask_CSharp\SimpleServerTaskDesigner_CSharp.cs
// Copyright 2010 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. // namespace SimpleServerTask_CSharp { // Specifies the simple task's configuration interface in Visual Studio public class SimpleServerTaskDesigner_CSharp : ESRI.ArcGIS.ADF.Web.UI.WebControls.Design.Designers.TaskDesigner { public SimpleServerTaskDesigner_CSharp() : base() { // Add an item to the shortcut menu of the task that can be accessed in Visual Studio's // design view. When the menu item is clicked, the OnEditButtonText method is called. verbs.Add(new System.ComponentModel.Design.DesignerVerb("Edit the button text", new System.EventHandler(OnEditButtonText))); } protected void OnEditButtonText(object sender, System.EventArgs args) { // Retrieve the task instance from the designer SimpleServerTask_CSharp simpleTask = this.Component as SimpleServerTask_CSharp; // Get a reference to the simple task's ButtonText property System.ComponentModel.PropertyDescriptor propertyDescriptor = System.ComponentModel.TypeDescriptor.GetProperties(simpleTask)["ButtonText"]; // Get a reference to the UITypeEditor that is used to edit the task's button text System.Drawing.Design.UITypeEditor uiTypeEditor = new ButtonTextEditor(); // Retrieve the button text by invoking the editor's EditValue method. This method initializes // and opens the interface used to edit the task's properties. object newValue = uiTypeEditor.EditValue(new TaskControlDesignerTypeDescriptorContext(this, propertyDescriptor), (System.IServiceProvider)this, propertyDescriptor.GetValue(simpleTask)); // Set the value of the task's button text with the retrieved value propertyDescriptor.SetValue(simpleTask, newValue); } } }