Exemplo n.º 1
0
 public EditPropertyForm(Document document, EditElementProperties editElementProperties, Element element, ElementType family, PropertyType propertyType)
 {
     _element               = element;
     _family                = family;
     _propertyType          = propertyType;
     _editElementProperties = editElementProperties;
     _document              = document;
     InitializeComponent();
 }
Exemplo n.º 2
0
 private void ShowFormDialog(bool canEdit, PropertyType propertyType, ComponentFactory.Krypton.Toolkit.KryptonDataGridView kryptonDataGridView)
 {
     if (canEdit)
     {
         EditElementProperties editElementProperties = new EditElementProperties();
         editElementProperties.Name    = kryptonDataGridView.SelectedRows[0].Cells["Name"].Value.ToString();
         editElementProperties.Value   = (kryptonDataGridView.SelectedRows[0].Cells["Value"].Value == null) ? "" : kryptonDataGridView.SelectedRows[0].Cells["Value"].Value.ToString();
         editElementProperties.CanEdit = canEdit;
         EditPropertyForm frmEditProp = new EditPropertyForm(_document, editElementProperties, _element, _family, propertyType);
         frmEditProp.ShowDialog();
         kryptonDataGridView.SelectedRows[0].Cells["Value"].Value = frmEditProp.ReturnValue1;
     }
     else
     {
         TaskDialog.Show("Warning", "You can not edit this property!");
     }
 }
Exemplo n.º 3
0
        private EditElementProperties GetEditElementProperties(ExternalCommandData commandData, Parameter parameter)
        {
            EditElementProperties editElementProperties = new EditElementProperties();

            editElementProperties.Name = parameter.Definition.Name;
            switch (parameter.StorageType)
            {
            case StorageType.None:
                editElementProperties.Value   = parameter.AsValueString();
                editElementProperties.CanEdit = false;
                break;

            case StorageType.Integer:
                editElementProperties.Value   = parameter.AsInteger().ToString();
                editElementProperties.CanEdit = false;
                break;

            case StorageType.Double:
                editElementProperties.Value   = parameter.AsDouble().ToString();
                editElementProperties.CanEdit = false;
                break;

            case StorageType.String:
                editElementProperties.Value   = parameter.AsString();
                editElementProperties.CanEdit = true;
                break;

            case StorageType.ElementId:
                ElementId elementId = new ElementId(parameter.AsElementId().IntegerValue);
                Element   elem      = commandData.Application.ActiveUIDocument.Document.GetElement(elementId);
                editElementProperties.Value = (elem != null) ? elem.Name : "Not Set";

                break;

            default:
                break;
            }
            return(editElementProperties);
        }