private FrmBigList(Core core, IDataSet config, EShow show, object automaticAddTemplate) { this.InitializeComponent(); UiControls.SetIcon(this); this._listViewHelper = new CtlAutoList(this.listView1, core, null); this.listView1.SelectedIndexChanged += this.listView1_SelectedIndexChanged; this._listViewHelper.Activate += this.listView1_ItemActivate; this._config = config; this._automaticAddTemplate = automaticAddTemplate; this.Text = "List Editor"; this.ctlTitleBar1.Text = config.Title; this.ctlTitleBar1.SubText = config.SubTitle; this.UpdateListFromSource(); if (config.ListIsSelfUpdating) { this._btnCancel.Visible = false; } if (!config.HasItemEditor) // Required for ADD EDIT VIEW DUPLICATE { this._btnAdd.Visible = false; this._btnEdit.Visible = false; this._btnView.Visible = false; this._btnDuplicate.Visible = false; } if (!config.ListSupportsReorder) // Required for UP DOWN { this._btnUp.Visible = false; this._btnDown.Visible = false; } if ((!config.ListSupportsChanges && !config.ListIsSelfUpdating) && show != EShow.Acceptor) // Required for ANY MODIFICATION { this._btnAdd.Visible = false; this._btnDuplicate.Visible = false; this._btnRemove.Visible = false; this._btnOk.Visible = false; this._btnCancel.Text = "Close"; } if (show == EShow.ReadOnly) // || Required for ANY MODIFICATION { this._btnAdd.Visible = false; this._btnEdit.Visible = false; this._btnDuplicate.Visible = false; this._btnRemove.Visible = false; this._btnEnableDisable.Visible = false; this._btnUp.Visible = false; this._btnDown.Visible = false; this._btnOk.Visible = false; this._btnCancel.Text = "Close"; } // UiControls.CompensateForVisualStyles(this); }
public static BigListResult <object> Show(Form owner, Core core, IDataSet config, EShow show, object automaticAddTemplate) { using (var frm = new FrmBigList(core, config, show, automaticAddTemplate)) { if (owner is FrmBigList) { frm.Size = new Size(Math.Max(128, owner.Width - 32), Math.Max(128, owner.Height - 32)); } if (UiControls.ShowWithDim(owner, frm) != DialogResult.OK) { return(null); } return(new BigListResult <object>(frm._list, frm._selectionResult)); } }