Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Der Code für den benutzerdefinierten Editor zeigt einen Von der System.Drawing.Design.UITypeEditor-Klasse abgeleiteten Editor an, der ein Dropdowntextfeld zum Eingeben eines Kennworts anzeigt. Die GetEditStyle-Überschreibung gibt UIEditorEditStyle.DropDown zurück, um ein Dropdown-Untersteuerelement anzugeben. Die Dienstmethoden DropDownControl und CloseDropDown verwalten das mit CreatePassword erstellte Steuerelement.
Der folgende Code ist die Klassendefinition für den benutzerdefinierten Dropdown-Editor:
/*************************************************************************
* Copyright (c) 1999-2004 Microsoft Corporation. All rights reserved. *
* *
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
* KIND, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR *
* PURPOSE. THE ENTIRE RISK OF USE OR RESULTS IN CONNECTION WITH THE USE *
* OF THIS CODE AND INFORMATION REMAINS WITH THE USER. *
*************************************************************************/
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.Security;
using System.Security.Permissions;
using Microsoft.BizTalk.Adapter.Framework;
using Microsoft.BizTalk.Adapter.Framework.Forms;
namespace AdapterManagement.ComponentModel {
/// <summary>
/// PasswordUITypeEditor implements a user interface for acquiring passwords
/// within a visual designer.
/// </summary>
public class PasswordUITypeEditor : UITypeEditor {
public const char PasswordChar = '\u25cf';
private IWindowsFormsEditorService _service = null;
private TextBox _password = null;
[SecurityPermissionAttribute(SecurityAction.LinkDemand)]
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) {
if (null != context && null != context.Instance) {
return UITypeEditorEditStyle.DropDown;
}
return base.GetEditStyle(context);
}
[SecurityPermissionAttribute(SecurityAction.LinkDemand)]
public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider,
object value) {
if (null != context && null != context.Instance && null != provider) {
this._service = (IWindowsFormsEditorService) provider.GetService
(typeof(IWindowsFormsEditorService));
if (null != this._service) {
this._password = CreatePassword();
this._service.DropDownControl(this._password);
value = this._password.Text;
}
}
return value;
}
private TextBox CreatePassword () {
TextBox password = new TextBox();
password.PasswordChar = PasswordUITypeEditor.PasswordChar;
password.Leave += new EventHandler(password_Leave);
}
private void password_Leave(object sender, EventArgs e) {
if (null != this._service) {
this._service.CloseDropDown();
}
}
} // PasswordUITypeEditor
} // Microsoft.BizTalk.Adapter.Framework.ComponentModel
Siehe auch
Konfigurations-Designer für benutzerdefinierte Adapter
Benutzerdefinierter modaler Dialogfeld-Editor für die Adapterkonfiguration
Benutzerdefinierter Typkonverter für Adapterkonfiguration
Erweiterte Konfigurationskomponenten für Adapter