public ParamsView AddAcadObject(string paramName = "ProcessingArea", string displayName = null, string message = "Выбор объектов", string allowedTypes = "*", Action <ObjectId[]> afterSelect = null) { var prop = _type.GetProperty(paramName); var selector = CreateSelector(displayName ?? GetDisplayName(paramName), "۞"); var textBox = selector.Controls[0]; BindingSource.DataSourceChanged += prop.PropertyType == typeof(AcadObject) ? new EventHandler((s, e) => textBox.Text = ((AcadObject)prop.GetValue(ParamsObject))?.GetDesc()) : new EventHandler((s, e) => textBox.Text = ((List <AcadObject>)prop.GetValue(ParamsObject))?.GetDesc()); textBox.Enter += prop.PropertyType == typeof(AcadObject) ? new EventHandler((s, e) => { if (prop.GetValue(ParamsObject) is AcadObject acadObj) { Acad.SelectAcadObjects(new List <AcadObject> { acadObj }); } }) : new EventHandler((s, e) => { if (prop.GetValue(ParamsObject) is List <AcadObject> acadObjList) { Acad.SelectAcadObjects(acadObjList); } }); var button = selector.Controls[1]; button.Click += (s, e) => { //textBox.Text = ""; //prop.SetValue(ParamsObject, null); Interaction.SetActiveDocFocus(); Acad.SelectObjectIds(); var ids = Interaction.GetSelection($"\n{message}", allowedTypes); if (ids.Length == 0) { return; } if (prop.PropertyType == typeof(AcadObject)) { var acadObject = AcadObject.Create(ids[0]); prop.SetValue(ParamsObject, acadObject); textBox.Text = acadObject.GetDesc(); } else { var acadOblects = AcadObject.CreateList(ids); prop.SetValue(ParamsObject, acadOblects); textBox.Text = acadOblects.GetDesc(); } afterSelect?.Invoke(ids); Acad.SelectObjectIds(ids); }; return(this); }