예제 #1
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if ((context != null) && (provider != null))
     {
         // Access the Property Browser's UI display service
         IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (editorService != null && value.GetType() == typeof(Ras.Ras.EntryOptions)) // edit Options flags
         {
             // Create an instance of the UI editor control
             OptionsFlagsEditorForm ed = new OptionsFlagsEditorForm();
             // Pass the UI editor control the current property value
             ed.Val = (Ras.Ras.EntryOptions)value;
             // Display the UI editor control
             editorService.ShowDialog(ed);
             // Return the new property value from the UI editor control
             return(ed.Val);
         }
         else if (editorService != null && value.GetType() == typeof(Ras.Ras.EntryProtocols)) // edit Protocols flags
         {
             // Create an instance of the UI editor control
             ProtocolsFlagsEditorForm ed = new ProtocolsFlagsEditorForm();
             // Pass the UI editor control the current property value
             ed.Val = (Ras.Ras.EntryProtocols)value;
             // Display the UI editor control
             editorService.ShowDialog(ed);
             // Return the new property value from the UI editor control
             return(ed.Val);
         }
     }
     return(base.EditValue(context, provider, value));
 }
예제 #2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if ((context != null) && (provider != null))
     {
         // Access the Property Browser's UI display service
         IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (editorService != null && value.GetType() == typeof(Ras.Ras.EntryOptions)) // edit Options flags
         {
             // Create an instance of the UI editor control
             OptionsFlagsEditorForm ed = new OptionsFlagsEditorForm();
             // Pass the UI editor control the current property value
             ed.Val = (Ras.Ras.EntryOptions)value;
             // Display the UI editor control
             editorService.ShowDialog(ed);
             // Return the new property value from the UI editor control
             return ed.Val;
         }
         else if (editorService != null && value.GetType() == typeof(Ras.Ras.EntryProtocols)) // edit Protocols flags
         {
             // Create an instance of the UI editor control
             ProtocolsFlagsEditorForm ed = new ProtocolsFlagsEditorForm();
             // Pass the UI editor control the current property value
             ed.Val = (Ras.Ras.EntryProtocols)value;
             // Display the UI editor control
             editorService.ShowDialog(ed);
             // Return the new property value from the UI editor control
             return ed.Val;
         }
     }
     return base.EditValue(context, provider, value);
 }