Ejemplo n.º 1
0
        protected virtual void EditProperty()
        {
            using (var form = new DynamicPropertyForm())
            {
                form.Text = "Edit Dynamic Property".Localize();
                form.PropertyName.Text = Descriptor.DisplayName;
                form.Category.Text     = Descriptor.Category;
                form.Description.Text  = Descriptor.Description;

                string valueType = Descriptor.AttributeInfo.Name;
                if (valueType == "stringValue")
                {
                    form.StringType.Checked = true;
                }
                else if (valueType == "floatValue")
                {
                    form.FloatingPointType.Checked = true;
                }
                else if (valueType == "vector3Value")
                {
                    form.VectorType.Checked = true;
                }
                else if (valueType == "boolValue")
                {
                    form.BooleanType.Checked = true;
                }
                else if (valueType == "intValue")
                {
                    form.IntegerType.Checked = true;
                }
                else
                {
                    throw new InvalidOperationException("Unknown type of dynamic property: " +
                                                        valueType);
                }

                // Don't let the user change the type of the dynamic property; this currently
                //  can cause a crash because PropertyView will use the old UI property editor
                //  which won't be compatible with the new value.
                form.StringType.Enabled        = false;
                form.FloatingPointType.Enabled = false;
                form.VectorType.Enabled        = false;
                form.BooleanType.Enabled       = false;
                form.IntegerType.Enabled       = false;

                do
                {
                    form.ShowDialog();
                    if (form.DialogResult == DialogResult.OK)
                    {
                        ApplyDialogResults(form, false);
                    }
                } while (form.DialogResult == DialogResult.Retry);
            }
        }
Ejemplo n.º 2
0
 protected virtual void AddNewProperty()
 {
     using (var form = new DynamicPropertyForm())
     {
         do
         {
             form.ShowDialog();
             if (form.DialogResult == DialogResult.OK)
             {
                 ApplyDialogResults(form, true);
             }
         } while (form.DialogResult == DialogResult.Retry);
     }
 }