Common_SimpleServerTask_VBNet\SimpleServerTaskDesigner_VBNet.vb
' 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. ' Imports Microsoft.VisualBasic Imports System Namespace Commom_SimpleServerTask_VBNet ' Specifies the simple task's configuration interface in Visual Studio Public Class SimpleServerTaskDesigner_VBNet Inherits ESRI.ArcGIS.ADF.Web.UI.WebControls.Design.Designers.TaskDesigner Public Sub New() MyBase.New() ' 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(AddressOf OnEditButtonText))) End Sub Protected Sub OnEditButtonText(ByVal sender As Object, ByVal args As System.EventArgs) ' Retrieve the task instance from the designer Dim simpleTask As SimpleServerTask_VBNet = TryCast(Me.Component, SimpleServerTask_VBNet) ' Get a reference to the simple task's ButtonText property Dim propertyDescriptor As System.ComponentModel.PropertyDescriptor = System.ComponentModel.TypeDescriptor.GetProperties(simpleTask)("ButtonText") ' Get a reference to the UITypeEditor that is used to edit the task's button text Dim uiTypeEditor As System.Drawing.Design.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. Dim newValue As Object = uiTypeEditor.EditValue(New TaskControlDesignerTypeDescriptorContext(Me, propertyDescriptor), CType(Me, System.IServiceProvider), propertyDescriptor.GetValue(simpleTask)) ' Set the value of the task's button text with the retrieved value propertyDescriptor.SetValue(simpleTask, newValue) End Sub End Class End Namespace