コード例 #1
0
            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);
            }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: mrhodes/Sims4Tools
        /// <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&lt;AResource.TGIBlock&gt; 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);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: falerin/Sims4Tools
 /// <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&lt;AResource.TGIBlock&gt; 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;
 }