public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (ui == null) { ui = new System.Windows.Forms.TGIBlockListEditorForm.MainForm(); //ui.Icon = ((System.Drawing.Icon)(new ComponentResourceManager(typeof(MainForm)).GetObject("$this.Icon"))); ui.Icon = Settings.Default.FormIcon; } TGIBlockListCTD ctd = value as TGIBlockListCTD; DependentList <TGIBlock> list = ctd.owner[ctd.field].Value as DependentList <TGIBlock>; ui.Items = list; DialogResult dr = edSvc.ShowDialog(ui); if (dr != DialogResult.OK) { return(value); } list.Clear(); list.AddRange(ui.Items); return(value); }
/// <summary> /// Displays a modal form allowing a list of TGIBlocks to be edited (created, updated, deleted). /// </summary> /// <param name="owner">Any object that implements System.Windows.Forms.IWin32Window /// and represents the top-level window that will own this form.</param> /// <param name="ltgi">an AResource.DependentList<AResource.TGIBlock> object.</param> /// <returns>the DialogResult</returns> public static DialogResult Show(IWin32Window owner, DependentList <TGIBlock> ltgi) { TGIBlockListEditorForm.MainForm theForm = new System.Windows.Forms.TGIBlockListEditorForm.MainForm(); theForm.Items = ltgi; if (owner as Form != null) { theForm.Icon = (owner as Form).Icon; } DialogResult dr = theForm.ShowDialog(); if (dr != DialogResult.OK) { return(dr); } ltgi.Clear(); ltgi.AddRange(theForm.Items); return(dr); }
/// <summary> /// Displays a modal form allowing a list of TGIBlocks to be edited (created, updated, deleted). /// </summary> /// <param name="owner">Any object that implements System.Windows.Forms.IWin32Window /// and represents the top-level window that will own this form.</param> /// <param name="ltgi">an AResource.DependentList<AResource.TGIBlock> object.</param> /// <returns>the DialogResult</returns> public static DialogResult Show(IWin32Window owner, DependentList<TGIBlock> ltgi) { TGIBlockListEditorForm.MainForm theForm = new System.Windows.Forms.TGIBlockListEditorForm.MainForm(); theForm.Items = ltgi; if (owner as Form != null) theForm.Icon = (owner as Form).Icon; DialogResult dr = theForm.ShowDialog(); if (dr != DialogResult.OK) return dr; ltgi.Clear(); ltgi.AddRange(theForm.Items); return dr; }