public void ShowPropertyGrid(object control, PropertiesNode focusedNode) { var propertiesControl = control as IPropertiesProvider; if (propertiesControl != null) { var form = new PropertiesForm(); var validationRules = propertiesControl.GetValidationRules(); form.SetValidationRules(validationRules); var propertyEditors = propertiesControl.GetPropertyEditors(); form.SetPropertyEditors(propertyEditors); var simpleProperties = propertiesControl.GetSimpleProperties(); form.SetSimpleProperties(simpleProperties); var collectionProperties = propertiesControl.GetCollections(); form.SetCollectionProperties(collectionProperties); if (form.ShowDialog() == DialogResult.OK) { propertiesControl.ApplySimpleProperties(); propertiesControl.ApplyCollections(); RenameNode(focusedNode, simpleProperties["Name"].Value.ToString()); } else { form.RevertChanges(); } } }
private void repositoryItemButtonEditSource_ButtonClick(object sender, ButtonPressedEventArgs e) { var scriptSource = Scripts.ElementAt(GridViewScripts.FocusedRowHandle).ScriptSource as IPropertiesProvider; if (scriptSource != null) { var form = new PropertiesForm(); var validationRules = scriptSource.GetValidationRules(); form.SetValidationRules(validationRules); var propertyEditors = scriptSource.GetPropertyEditors(); form.SetPropertyEditors(propertyEditors); var simpleProperties = scriptSource.GetSimpleProperties(); form.SetSimpleProperties(simpleProperties); var collectionProperties = scriptSource.GetCollections(); form.SetCollectionProperties(collectionProperties); if (form.ShowDialog() == DialogResult.OK) { scriptSource.ApplySimpleProperties(); scriptSource.ApplyCollections(); GridViewScripts.HideEditor(); GridViewScripts.RefreshData(); } else { form.RevertChanges(); } } }