public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService)); if (edSvc != null) { var style = (TextStyle) value; using (var tsd = new TextStyleDesignerDialog(style) ) { context.OnComponentChanging(); if (edSvc.ShowDialog(tsd) == DialogResult.OK) { ValueChanged(this, EventArgs.Empty); context.OnComponentChanged(); return style; } } } } return value; }
/// <summary> /// Edits the specified object's value using the editor style indicated by GetEditStyle. /// </summary> /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param> /// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context?.Instance != null) && (provider != null)) { // Must use the editor service for showing dialogs IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { // Cast the value to the correct type KryptonCheckSet checkSet = (KryptonCheckSet)context.Instance; // Create the dialog used to edit the set of KryptonCheckButtons KryptonCheckButtonCollectionForm dialog = new(checkSet); if (editorService.ShowDialog(dialog) == DialogResult.OK) { // Notify container that value has been changed context.OnComponentChanged(); } } } // Return the original value return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { object originalValue = value; _context = context; edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); _collection = value as IList <T>; _backup = new List <T>(_collection); if (edSvc != null) { CollectionEditorForm collEditorFrm = CreateForm(); collEditorFrm.Init(this); context.OnComponentChanging(); if (edSvc.ShowDialog(collEditorFrm) == DialogResult.OK) { context.OnComponentChanged(); } } } return(value); }
/// <include file='doc\QueuePathEditor.uex' path='docs/doc[@for="QueuePathEditor.EditValue"]/*' /> /// <devdoc> /// Edits the given object value using the editor style provided by /// GetEditorStyle. A service provider is provided so that any /// required editing services can be obtained. /// </devdoc> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { QueuePathDialog dialog = new QueuePathDialog(provider); MessageQueue queue = null; if (value is MessageQueue) queue = (MessageQueue)value; else if (value is string) queue = new MessageQueue((string)value); else if (value != null) return value; if (queue != null) dialog.SelectQueue(queue); IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost)); DesignerTransaction trans = null; if (host != null) trans = host.CreateTransaction(); try { if ((context == null || context.OnComponentChanging()) && edSvc.ShowDialog(dialog) == DialogResult.OK) { if (dialog.Path != String.Empty) { if (context.Instance is MessageQueue || context.Instance is MessageQueueInstaller) value = dialog.Path; else { value = MessageQueueConverter.GetFromCache(dialog.Path); if (value == null) { value = new MessageQueue(dialog.Path); MessageQueueConverter.AddToCache((MessageQueue)value); if (context != null) context.Container.Add((IComponent)value); } } context.OnComponentChanged(); } } } finally { if (trans != null) { trans.Commit(); } } } } return value; }
/// <summary> /// Edits the specified object's value using the editor style indicated by GetEditStyle. /// </summary> /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param> /// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context != null) && (context.Instance != null) && (provider != null)) { // Convert to the correct class. CommandBaseCollection commands = value as CommandBaseCollection; // Create the dialog used to edit the commands CommandCollectionDialog dialog = new CommandCollectionDialog(commands); // Give user the chance to modify the nodes if (dialog.ShowDialog() == DialogResult.OK) { // Reflect changes back into original copy and generate appropriate // component changes to designer to reflect these changes SynchronizeCollections(commands, dialog.Commands, context); // Notify container that value has been changed context.OnComponentChanged(); } } // Return the original value return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof (IWindowsFormsEditorService)); if (edSvc != null) { var style = (TextStyle)value; using (var tsd = new TextStyleDesignerDialog(style) ) { context.OnComponentChanging(); if (edSvc.ShowDialog(tsd) == DialogResult.OK) { ValueChanged(this, EventArgs.Empty); context.OnComponentChanged(); return(style); } } } } return(value); }
/// <summary> /// Edits the specified object value using the editor style provided by GetEditorStyle. /// A service provider is provided so that any required editing services can be obtained.</summary> /// <param name="context">A type descriptor context that can be used to provide additional context information</param> /// <param name="provider">A service provider object through which editing services may be obtained</param> /// <param name="value">An instance of the value being edited</param> /// <returns>The new value of the object. If the value of the object hasn't changed, /// this should return the same object it was passed.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { EditingEventArgs e = new EditingEventArgs(value); OnEditorOpening(e); NestedCollectionEditorForm collEditorFrm = CreateForm(context, m_selectionContext, value, e.GetCollectionItemCreators, e.GetItemInfo); context.OnComponentChanging(); if (editorService.ShowDialog(collEditorFrm) == DialogResult.OK) { OnCollectionChanged(context.Instance, value); context.OnComponentChanged(); } } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { ParameterCollection parameters = value as ParameterCollection; if (parameters == null) { throw new ArgumentException(System.Design.SR.GetString("ParameterCollectionEditor_InvalidParameters"), "value"); } System.Web.UI.Control instance = context.Instance as System.Web.UI.Control; ControlDesigner designer = null; if ((instance != null) && (instance.Site != null)) { IDesignerHost service = (IDesignerHost)instance.Site.GetService(typeof(IDesignerHost)); if (service != null) { designer = service.GetDesigner(instance) as ControlDesigner; } } ParameterCollectionEditorForm form = new ParameterCollectionEditorForm(provider, parameters, designer); if ((form.ShowDialog() == DialogResult.OK) && (context != null)) { context.OnComponentChanged(); } return(value); }
/// <summary> /// Edits the specified object's value using the editor style indicated by GetEditStyle. /// </summary> /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param> /// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context != null) && (context.Instance != null) && (provider != null)) { // Must use the editor service for showing dialogs IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { // Cast the value to the correct type KryptonCheckSet checkSet = (KryptonCheckSet)context.Instance; // Create the dialog used to edit the set of KryptonCheckButtons KryptonCheckButtonCollectionForm dialog = new KryptonCheckButtonCollectionForm(checkSet); if (editorService.ShowDialog(dialog) == DialogResult.OK) { // Notify container that value has been changed context.OnComponentChanged(); } } } // Return the original value return value; }
/// <summary> /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method. /// </summary> /// /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param> /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// /// <returns> /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed. /// </returns> /// public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { this.editorService = (IWindowsFormsEditorService)provider .GetService(typeof(IWindowsFormsEditorService)); this.CollectionType = context.PropertyDescriptor.ComponentType; this.CollectionItemType = detectCollectionType(); if (editorService != null) { NumericCollectionEditorForm form = new NumericCollectionEditorForm(this, value); context.OnComponentChanging(); if (editorService.ShowDialog(form) == DialogResult.OK) { context.OnComponentChanged(); } } } return(value); }
//============================================================ // <T>编辑属性内容。</T> // // @param context 类型描述器环境 // @param provider 服务提供对象 // @param value 属性内容 // @return 属性内容 //============================================================ public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((null != context) && (null != context.Instance) && (null != provider)) { IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; if (null != editorService) { // 获得属性集合 FProperties properties = value as FProperties; if (properties == null) { throw new FFatalException("Properties is not exists."); } // 显示属性表单 context.OnComponentChanging(); // 编辑控件属性 QPropertiesEditorForm qForm = new QPropertiesEditorForm(); qForm.Properties = properties; if (editorService.ShowDialog(qForm) == DialogResult.OK) { context.OnComponentChanged(); return(properties); } } } return(base.EditValue(context, provider, value)); }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value is string) { if (context != null) { IsValid(context, value); context.OnComponentChanged(); } } return(base.ConvertFrom(context, culture, value)); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { object obj2; try { context.OnComponentChanging(); obj2 = base.EditValue(context, provider, value); } finally { context.OnComponentChanged(); } return obj2; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); var F = new nHydrate.Generator.Forms.VersionHistoryCollectionForm((VersionHistoryCollection)value); if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { context.OnComponentChanged(); } } catch (Exception ex) { } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { System.Windows.Forms.Design.IWindowsFormsEditorService edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); Widgetsphere.Generator.Forms.CustomViewColumnCollectionForm F = new Widgetsphere.Generator.Forms.CustomViewColumnCollectionForm(); if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { context.OnComponentChanged(); } } catch (Exception ex) { } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); var F = new Widgetsphere.Generator.Forms.VersionHistoryCollectionForm((VersionHistoryCollection)value); if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { context.OnComponentChanged(); } } catch (Exception ex) { } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { object instance; FlexDesignerHostServices services; if (!Util.EditableModelHelper.GetInstanceAndServices(context, out instance, out services)) { return(base.EditValue(context, provider, value)); } var series = instance as ChartUnboundDataSeries; if (context.PropertyDescriptor == null || series == null) { return(base.EditValue(context, provider, value)); } var propertyName = context.PropertyDescriptor.Name; Debug.Assert(propertyName == "SeriesData" || propertyName == "X" || propertyName == "Y" || propertyName == "Y1" || propertyName == "Y2" || propertyName == "Y3"); var c1Series = CreateChartDataSeries(series); var c1Property = TypeDescriptor.GetProperties(c1Series)[propertyName]; object c1Value = c1Property.GetValue(c1Series); var c1Editor = c1Property.GetEditor(typeof(UITypeEditor)) as UITypeEditor; if (c1Editor == null) { return(base.EditValue(context, provider, value)); } var c1Context = new ContextWrapper(context, c1Series, c1Property); c1Editor.EditValue(c1Context, provider, c1Value); object newValue = value; if (c1Context.ComponentChanged) { ApplyData(c1Series, series, propertyName); context.OnComponentChanged(); newValue = context.PropertyDescriptor.GetValue(series); } return(newValue); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { var relation = (Relation)context.Instance; var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); var F = new nHydrate.Generator.Forms.ColumnRelationshipCollectionEditorForm(relation); if(edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { context.OnComponentChanged(); } } catch(Exception ex) { } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { object obj2; try { context.OnComponentChanging(); obj2 = base.EditValue(context, provider, value); } finally { context.OnComponentChanged(); } return(obj2); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { var parentTable = (Table)context.Instance; var referenceCollection = ((ReferenceCollection)value); var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); var F = new nHydrate.Generator.Forms.RelationCollectionForm(parentTable, referenceCollection); if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { context.OnComponentChanged(); } } catch (Exception ex) { } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); var table = (nHydrate.Generator.Models.Table)context.Instance; var F = new nHydrate.Generator.Forms.RowEntryCollectionForm(table); if(edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { table.Root.Dirty = true; context.OnComponentChanged(); } } catch(Exception ex) { } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); var table = (nHydrate.Generator.Models.Table)context.Instance; var F = new nHydrate.Generator.Forms.RowEntryCollectionForm(table); if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { table.Root.Dirty = true; context.OnComponentChanged(); } } catch (Exception ex) { } return(value); }
public override object EditValue ( ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context == null || context.Instance == null || provider == null) return value; object originalValue = value; // if the value is null if (value==null) { Type type = context.PropertyDescriptor.PropertyType; value = Activator.CreateInstance(type); } m_context = context; edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc == null) { Trace.WriteLine("Editor service is null"); return value; } CustomCollectionEditorForm collEditorFrm = CreateForm(); collEditorFrm.ItemAdded += new CustomCollectionEditorForm.InstanceEventHandler(ItemAdded); collEditorFrm.ItemRemoved += new CustomCollectionEditorForm.InstanceEventHandler(ItemRemoved); collEditorFrm.Collection = value as IList; context.OnComponentChanging(); if (edSvc.ShowDialog(collEditorFrm) == DialogResult.OK) { OnCollectionChanged(context.Instance, value); context.OnComponentChanged(); } IList newValue = (IList)Activator.CreateInstance(value.GetType()); foreach (object obj in (IList)value) { newValue.Add(obj); } return (object)newValue; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { /* * PropertyDescriptor member = TypeDescriptor.GetProperties(context.Instance)["ItemBindings"]; * System.Web.UI.Design.ControlDesigner.InvokeTransactedChange((Component)context.Instance, new TransactedChangeCallback(this.InnerEditValues), null, null, member); */ DataBindingControl control = (DataBindingControl)context.Instance; DataBindingItemCollection bindings = (DataBindingItemCollection)control.ItemBindings; DataBindingItem binding = new DataBindingItem(); binding.ControlID = "Shen Zheng"; bindings.Add(binding); context.OnComponentChanged(); return(bindings); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { /* PropertyDescriptor member = TypeDescriptor.GetProperties(context.Instance)["ItemBindings"]; System.Web.UI.Design.ControlDesigner.InvokeTransactedChange((Component)context.Instance, new TransactedChangeCallback(this.InnerEditValues), null, null, member); */ DataBindingControl control = (DataBindingControl)context.Instance; DataBindingItemCollection bindings = (DataBindingItemCollection)control.ItemBindings; DataBindingItem binding = new DataBindingItem(); binding.ControlID = "Shen Zheng"; bindings.Add(binding); context.OnComponentChanged(); return bindings; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider == null || context == null) { return(value); } if (context.Instance == null) { return(value); } try { context.OnComponentChanging(); object newConnection = base.EditValue(context, provider, value); string connectionString = newConnection as string; int index = -1; if (connectionString == null && newConnection != null) { if (_managerType != null) { object manager = Activator.CreateInstance(_managerType, new object[] { provider }); if (manager != null) { index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { "Npgsql" }); if (index > -1 && _selector != null) { connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }); _selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }), connectionString, null); } } } } if (String.IsNullOrEmpty(connectionString) == false) { value = connectionString; } context.OnComponentChanged(); } catch { } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if(value==null) return value; if(!(value is Parameters)) return value; ParametersEditorForm dlg=new ParametersEditorForm(value as Parameters); IWindowsFormsEditorService editorService=(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); DialogResult res; if(editorService!=null) res=editorService.ShowDialog(dlg); else res=dlg.ShowDialog(); if(res!=DialogResult.OK) return value; context.OnComponentChanged(); return dlg.Result; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { System.Windows.Forms.Design.IWindowsFormsEditorService edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); Table table = (Table)context.Instance; Widgetsphere.Generator.Forms.UnitTestDependencyForm F = new Widgetsphere.Generator.Forms.UnitTestDependencyForm(table); if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { table.UnitTestDependencies.Clear(); table.UnitTestDependencies.AddRange(F.GetSelectedList()); table.Name = table.Name; //Make Dirty context.OnComponentChanged(); } } catch (Exception ex) { } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { System.Windows.Forms.Design.IWindowsFormsEditorService edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); Table table = (Table)context.Instance; Widgetsphere.Generator.Forms.UnitTestDependencyForm F = new Widgetsphere.Generator.Forms.UnitTestDependencyForm(table); if(edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK) { table.UnitTestDependencies.Clear(); table.UnitTestDependencies.AddRange(F.GetSelectedList()); table.Name = table.Name; //Make Dirty context.OnComponentChanged(); } } catch(Exception ex) { } return value; }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { _context = context; var form = new IconCssClassForm() { IconCssClass = (string)value, ServiceProvider = provider }; if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _context.OnComponentChanging(); _context.PropertyDescriptor.SetValue(_context.Instance, form.IconCssClass); _context.OnComponentChanged(); } return(base.EditValue(context, provider, value)); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is String) { AnlagenElement adr = (AnlagenElement)context.Instance; if (context.PropertyDescriptor.DisplayName == "Ausgang") { adr.Ausgang.SpeicherString = (string)value; context.OnComponentChanged(); return(adr.Ausgang); } else if ((adr is Gleis) && (context.PropertyDescriptor.DisplayName == "Eingang")) { Gleis gl = (Gleis)adr; gl.Eingang.SpeicherString = (string)value; return(gl.Eingang); } } return(null); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context!=null && context.Instance!=null && provider!=null) { m_EditorService=(System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService)); if(m_EditorService!=null) { if(context.Instance is Bar) { Bar bar=context.Instance as Bar; if(bar.Owner is DotNetBarManager && ((DotNetBarManager)bar.Owner).UseGlobalColorScheme) System.Windows.Forms.MessageBox.Show("Please note that your DotNetBarManager has its UseGlobalColorScheme set to true and any changes you make to ColorScheme object on the bar will not be used."); } else if(context.Instance is DotNetBarManager && !((DotNetBarManager)context.Instance).UseGlobalColorScheme) { System.Windows.Forms.MessageBox.Show("Please note that you need to set UseGlobalColorScheme=true in order for all bars to use ColorScheme you change on this dialog."); } if(value==null) value=new ColorScheme(); ColorSchemeEditor editor=new ColorSchemeEditor(); editor.CreateControl(); editor.ColorScheme=(ColorScheme)value; m_EditorService.ShowDialog(editor); if(editor.ColorSchemeChanged) { value=editor.ColorScheme; context.OnComponentChanged(); ((ColorScheme)value)._DesignTimeSchemeChanged=true; if(context.Instance is Bar) { ((Bar)context.Instance).Refresh(); } } editor.Close(); } } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider == null || context == null) return value; if (context.Instance == null) return value; try { context.OnComponentChanging(); object newConnection = base.EditValue(context, provider, value); string connectionString = newConnection as string; int index = -1; if (connectionString == null && newConnection != null) { if (_managerType != null) { object manager = Activator.CreateInstance(_managerType, new object[] { provider }); if (manager != null) { index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { "System.Data.SQLite" }); if (index > -1 && _selector != null) { connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }); _selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }), connectionString, null); } } } } if (String.IsNullOrEmpty(connectionString) == false) { value = connectionString; } context.OnComponentChanged(); } catch { } return value; }
public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value) { var service = (IWindowsFormsEditorService)provider .GetService(typeof(IWindowsFormsEditorService)); if (service != null) { var host = (IDesignerHost)context .GetService(typeof(IDesignerHost)); var trans = host .CreateTransaction("NodesCollectionEditor"); var dialog = new EditorNodes(); var collection = (ShortcutCollection)value; if (collection.Count == 0) { var root = new CustomShortcut(typeof(Type), "Base"); collection.Add(root); } dialog._collection = collection; if (service.ShowDialog(dialog) == DialogResult.OK) { context.OnComponentChanged(); context.OnComponentChanging(); trans.Commit(); return(dialog._collection); } trans.Cancel(); return(value); } return(value); }
public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value) { var service = (IWindowsFormsEditorService)provider .GetService(typeof (IWindowsFormsEditorService)); if (service != null) { var host = (IDesignerHost)context .GetService(typeof (IDesignerHost)); var trans = host .CreateTransaction("NodesCollectionEditor"); var dialog = new EditorNodes(); var collection = (ShortcutCollection)value; if (collection.Count == 0) { var root = new CustomShortcut(typeof (Type), "Base"); collection.Add(root); } dialog._collection = collection; if (service.ShowDialog(dialog) == DialogResult.OK) { context.OnComponentChanged(); context.OnComponentChanging(); trans.Commit(); return dialog._collection; } trans.Cancel(); return value; } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { object instance; FlexDesignerHostServices services; if (!Util.EditableModelHelper.GetInstanceAndServices(context, out instance, out services)) { return(base.EditValue(context, provider, value)); } var set = instance as Chart3DDataSetGrid; if (set == null) { return(base.EditValue(context, provider, value)); } var c1Set = CreateSet(set); var c1Property = TypeDescriptor.GetProperties(c1Set)["GridData"]; var c1Editor = c1Property.GetEditor(typeof(UITypeEditor)) as UITypeEditor; if (c1Editor == null) { return(base.EditValue(context, provider, value)); } var c1Context = new ContextWrapper(context, c1Set, c1Property); var c1Values = c1Editor.EditValue(c1Context, provider, c1Set.GridData); object newValue = value; if (c1Context.ComponentChanged) { newValue = c1Values; context.OnComponentChanged(); } return(newValue); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { Type underlyingType = Nullable.GetUnderlyingType(context.PropertyDescriptor.PropertyType) ?? context.PropertyDescriptor.PropertyType; if (context == null || context.Instance == null || provider == null) { return(value); } //use IWindowsFormsEditorService object to display a control in the dropdown area IWindowsFormsEditorService frmsvr = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (frmsvr == null) { return(value); } MinMaxAttribute attr = (MinMaxAttribute)context.PropertyDescriptor.Attributes[typeof(MinMaxAttribute)]; if (attr != null) { NumericUpDown nmr = new NumericUpDown { Size = new Size(60, 120), Minimum = attr.Min, Maximum = attr.Max, Increment = attr.Increment, DecimalPlaces = attr.DecimalPlaces, Value = (value == null) ? attr.PutInRange(Decimal.One) : attr.PutInRange(value) }; frmsvr.DropDownControl(nmr); context.OnComponentChanged(); return(Convert.ChangeType(nmr.Value, underlyingType)); } } catch { } return(value); }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection properties = base.GetProperties(context, value, attributes); ActionBinding binding = value as ActionBinding; if (binding != null) { Control control = GetBindingControl(binding.Parent, context); if (control != null) { if (EnsureEventName(control, binding)) context.OnComponentChanged(); bool isCommandEvent = EventUtil.IsCommandEvent(control, binding.EventName); if (!isCommandEvent) { List<PropertyDescriptor> effective = new List<PropertyDescriptor>(); foreach (PropertyDescriptor property in properties) { if (property.Name != "CommandBindings") { effective.Add(property); } } properties = new PropertyDescriptorCollection(effective.ToArray(), true); } binding.ResetCommandDefaults(isCommandEvent); } } return properties; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if(value==null) return value; if(!(value is List<long>)) return value; TypedListEditorForm<long> dlg=new TypedListEditorForm<long>(value as List<long>, Properties.Resources.ListOfLongEditorCaption, (v) => { return v.ToString(); }, () => { return 0; }, new CategoryAttribute(Properties.Resources.ListOfLongEditorGridValueTypeText), new DescriptionAttribute(Properties.Resources.NumberInListDescription), new TypeConverterAttribute(typeof(NumericUpDownTypeConverter)), new EditorAttribute(typeof(NumericUpDownTypeEditor), typeof(UITypeEditor)) ); IWindowsFormsEditorService editorService=(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); DialogResult res; if(editorService!=null) res=editorService.ShowDialog(dlg); else res=dlg.ShowDialog(); if(res!=DialogResult.OK) return value; context.OnComponentChanged(); return dlg.Result; }
/* * protected SageCRMConnection getConnection(ITypeDescriptorContext context) * { * if (context == null) * return null; * foreach (Control c in context.Container.Components) * { * if (c.GetType().ToString().Equals("SageCRM.AspNet.SageCRMConnection")) * { * return (c as SageCRMConnection); * } * if (c.Controls.Count > 0) * { * c2 = IterateThroughChildren(c); * if (c2 is SageCRMConnection) * return (c2 as SageCRMConnection); * } * } * return null; * } */ public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context != null) && (provider != null)) { context.OnComponentChanging(); IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { listBlockPicker form = new listBlockPicker(); //set properties here form.ListValue = (string)value; //form.SageCRMConnectionObject=this.getConnection(context); DialogResult result = edSvc.ShowDialog(form); if (result == DialogResult.OK) { //set the value value = form.ListValue; } } context.OnComponentChanged(); } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context != null) && (provider != null)) { _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (_editorService != null) { foreach (Component component in context.Container.Components) { if (component != null) { if (component is NugenCCalcBase) { if ((component as NugenCCalcBase).FunctionParameters == (FunctionParameters)context.Instance) { context.OnComponentChanging(); if (component is NugenCCalc2D) { NugenCCalcDesignerForm designerForm = new NugenCCalcDesignerForm((component as NugenCCalc2D)); _editorService.ShowDialog(designerForm); } else { NugenCCalc3DDesignerForm designerForm = new NugenCCalc3DDesignerForm((component as NugenCCalc3D)); _editorService.ShowDialog(designerForm); } context.OnComponentChanged(); } } } } RefreshPropertyGrid(); } } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context != null) && (provider != null)) { _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (_editorService != null) { foreach (Component component in context.Container.Components) { if (component != null) { if (component is NugenCCalcBase) { if ((component as NugenCCalcBase).FunctionParameters == (FunctionParameters)context.Instance) { context.OnComponentChanging(); if (component is NugenCCalc2D) { NugenCCalcDesignerForm designerForm = new NugenCCalcDesignerForm((component as NugenCCalc2D)); _editorService.ShowDialog(designerForm); } else { NugenCCalc3DDesignerForm designerForm = new NugenCCalc3DDesignerForm((component as NugenCCalc3D)); _editorService.ShowDialog(designerForm); } context.OnComponentChanged(); } } } } RefreshPropertyGrid(); } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { ParameterCollection parameters = value as ParameterCollection; if (parameters == null) { throw new ArgumentException(System.Design.SR.GetString("ParameterCollectionEditor_InvalidParameters"), "value"); } System.Web.UI.Control instance = context.Instance as System.Web.UI.Control; ControlDesigner designer = null; if ((instance != null) && (instance.Site != null)) { IDesignerHost service = (IDesignerHost) instance.Site.GetService(typeof(IDesignerHost)); if (service != null) { designer = service.GetDesigner(instance) as ControlDesigner; } } ParameterCollectionEditorForm form = new ParameterCollectionEditorForm(provider, parameters, designer); if ((form.ShowDialog() == DialogResult.OK) && (context != null)) { context.OnComponentChanged(); } return value; }
/// <summary> /// Called when the component property changes. /// </summary> public void OnComponentChanged() { innerTypeDescriptor.OnComponentChanged(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service == null) { return(value); } QueuePathDialog dialog = new QueuePathDialog(provider); MessageQueue queue = null; if (value is MessageQueue) { queue = (MessageQueue)value; } else if (value is string) { queue = new MessageQueue((string)value); } else if (value != null) { return(value); } if (queue != null) { dialog.SelectQueue(queue); } IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost)); DesignerTransaction transaction = null; if (host != null) { transaction = host.CreateTransaction(); } try { if ((context != null) && !context.OnComponentChanging()) { return(value); } if ((service.ShowDialog(dialog) != DialogResult.OK) || !(dialog.Path != string.Empty)) { return(value); } if ((context.Instance is MessageQueue) || (context.Instance is MessageQueueInstaller)) { value = dialog.Path; } else { value = MessageQueueConverter.GetFromCache(dialog.Path); if (value == null) { value = new MessageQueue(dialog.Path); MessageQueueConverter.AddToCache((MessageQueue)value); if (context != null) { context.Container.Add((IComponent)value); } } } context.OnComponentChanged(); } finally { if (transaction != null) { transaction.Commit(); } } } return(value); }
void ITypeDescriptorContext.OnComponentChanged() { context.OnComponentChanged(); }
/// <summary> /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method. /// </summary> /// /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param> /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// /// <returns> /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed. /// </returns> /// public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { object originalValue = value; this.editorService = (IWindowsFormsEditorService)provider .GetService(typeof(IWindowsFormsEditorService)); this.CollectionType = context.PropertyDescriptor.ComponentType; this.CollectionItemType = detectCollectionType(); if (editorService != null) { NumericCollectionEditorForm form = new NumericCollectionEditorForm(this, value); context.OnComponentChanging(); if (editorService.ShowDialog(form) == DialogResult.OK) { context.OnComponentChanged(); } } } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { if(context==null||context.Instance==null||provider==null) return value; //use IWindowsFormsEditorService object to display a control in the dropdown area IWindowsFormsEditorService frmsrv=(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if(frmsrv==null) return value; NumericUpDown nmr; NumericUpDownTypeSettingsAttribute attr=(NumericUpDownTypeSettingsAttribute)context.PropertyDescriptor.Attributes[typeof(NumericUpDownTypeSettingsAttribute)]; if(attr==null) { // check context.PropertyDescriptor.PropertyType and make Range depending on the type Type type=context.PropertyDescriptor.PropertyType; decimal Min=0; decimal Max=100; if(type==typeof(byte)) { Min=byte.MinValue; Max=byte.MaxValue; } else if(type==typeof(sbyte)) { Min=sbyte.MinValue; Max=sbyte.MaxValue; } else if(type==typeof(short)) { Min=short.MinValue; Max=short.MaxValue; } else if(type==typeof(ushort)) { Min=ushort.MinValue; Max=ushort.MaxValue; } else if(type==typeof(int)) { Min=int.MinValue; Max=int.MaxValue; } else if(type==typeof(uint)) { Min=uint.MinValue; Max=uint.MaxValue; } else if(type==typeof(long)) { Min=long.MinValue; Max=long.MaxValue; } else if(type==typeof(ulong)) { Min=ulong.MinValue; Max=ulong.MaxValue; } else if(type==typeof(float)||type==typeof(double)||type==typeof(decimal)) { Min=decimal.MinValue; Max=decimal.MaxValue; } else { Min=0; Max=100; } decimal v=(decimal)Convert.ChangeType(value, typeof(decimal)); int decimalPlaces=Math.Min((int)BitConverter.GetBytes(decimal.GetBits(v)[3])[2], 10); nmr=new NumericUpDown { Size=new Size(60, 120), Minimum=Min, Maximum=Max, Increment=decimal.One, DecimalPlaces=decimalPlaces, Value=v }; } else { decimal v=attr.PutInRange(value); int decimalPlaces=attr.DecimalPlaces; if(decimalPlaces<0) decimalPlaces=Math.Min((int)BitConverter.GetBytes(decimal.GetBits(v)[3])[2], 10); nmr=new NumericUpDown { Size=new Size(60, 120), Minimum=attr.Min, Maximum=attr.Max, Increment=attr.Increment, DecimalPlaces=decimalPlaces, Value=v }; } frmsrv.DropDownControl(nmr); context.OnComponentChanged(); return Convert.ChangeType(nmr.Value, context.PropertyDescriptor.PropertyType); } catch { } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (service == null) { return value; } QueuePathDialog dialog = new QueuePathDialog(provider); MessageQueue queue = null; if (value is MessageQueue) { queue = (MessageQueue) value; } else if (value is string) { queue = new MessageQueue((string) value); } else if (value != null) { return value; } if (queue != null) { dialog.SelectQueue(queue); } IDesignerHost host = (IDesignerHost) provider.GetService(typeof(IDesignerHost)); DesignerTransaction transaction = null; if (host != null) { transaction = host.CreateTransaction(); } try { if ((context != null) && !context.OnComponentChanging()) { return value; } if ((service.ShowDialog(dialog) != DialogResult.OK) || !(dialog.Path != string.Empty)) { return value; } if ((context.Instance is MessageQueue) || (context.Instance is MessageQueueInstaller)) { value = dialog.Path; } else { value = MessageQueueConverter.GetFromCache(dialog.Path); if (value == null) { value = new MessageQueue(dialog.Path); MessageQueueConverter.AddToCache((MessageQueue) value); if (context != null) { context.Container.Add((IComponent) value); } } } context.OnComponentChanged(); } finally { if (transaction != null) { transaction.Commit(); } } } return value; }
public void OnComponentChanged() { context.OnComponentChanged(); }
/// <summary> /// Edits the specified object value using the editor style provided by GetEditorStyle. /// A service provider is provided so that any required editing services can be obtained.</summary> /// <param name="context">A type descriptor context that can be used to provide additional context information</param> /// <param name="provider">A service provider object through which editing services may be obtained</param> /// <param name="value">An instance of the value being edited</param> /// <returns>The new value of the object. If the value of the object hasn't changed, /// this should return the same object it was passed.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { EditingEventArgs e = new EditingEventArgs(value); OnEditorOpening(e); NestedCollectionEditorForm collEditorFrm = CreateForm(context, m_selectionContext, value, e.GetCollectionItemCreators, e.GetItemInfo); context.OnComponentChanging(); if (editorService.ShowDialog(collEditorFrm) == DialogResult.OK) { OnCollectionChanged(context.Instance, value); context.OnComponentChanged(); } } } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { if (context == null || context.Instance == null || provider == null) return value; //use IWindowsFormsEditorService object to display a control in the dropdown area IWindowsFormsEditorService frmsvr = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (frmsvr == null) return value; MinMaxAttribute attr = (MinMaxAttribute)context.PropertyDescriptor.Attributes[typeof(MinMaxAttribute)]; if (attr != null) { NumericUpDown nmr = new NumericUpDown { Size = new Size(60, 120), Minimum = (decimal)attr.Min, Maximum = (decimal)attr.Max, Increment = (decimal)attr.Increment, DecimalPlaces = attr.DecimalPlaces, Value = (decimal)attr.PutInRange(value) }; frmsvr.DropDownControl(nmr); context.OnComponentChanged(); return Convert.ChangeType(nmr.Value, context.PropertyDescriptor.PropertyType); } } catch { } return value; }
public void OnComponentChanged() { originalTypeDescriptor.OnComponentChanged(); }