public void OnSelect(object sender, EventArgs e) { if (_object != null) { var selectedItem = GeneratorController.Current.GetSelectedItem(); if (_object.GetType() == typeof(Criteria)) { Text = @"Criteria Editor"; pgEditor.SelectedObject = new CriteriaBag(((Criteria)_object)); Size = new Size(Size.Width, 711); pgEditor.Size = new Size(pgEditor.Size.Width, 619); var cslaObject = (CslaObjectInfo)selectedItem; if ((cslaObject.IsReadOnlyObject() || cslaObject.IsReadOnlyCollection() || cslaObject.IsNameValueList() || (cslaObject.IsUnitOfWork()))) { Size = new Size(Size.Width, Size.Height - 256); pgEditor.Size = new Size(pgEditor.Size.Width, pgEditor.Size.Height - 256); } pgEditor.ExpandAllGridItems(); } else if (_object.GetType() == typeof(TypeInfo)) { Text = @"Project/Assembly Type Editor"; pgEditor.SelectedObject = new TypeInfoPropertyBag((TypeInfo)_object); Size = new Size(Size.Width + 100, Size.Height); } else if (_object.GetType() == typeof(AuthorizationRule)) { Text = @"Authorization Type Editor"; ((AuthorizationRule)_object).TypeChanged -= OnSelect; ((AuthorizationRule)_object).TypeChanged += OnSelect; if (!string.IsNullOrEmpty(PropertyCollectionForm.ParentValProp)) { ((AuthorizationRule)_object).IsPropertyRule = true; ((AuthorizationRule)_object).Parent = PropertyCollectionForm.ParentValProp; ((AuthorizationRule)_object).ActionProperty = ValueProperty.Convert(PropertyCollectionForm.ParentProperty); } else { var cslaObject = (CslaObjectInfo)selectedItem; ((AuthorizationRule)_object).ActionProperty = cslaObject.ActionProperty; ((AuthorizationRule)_object).Parent = string.Empty; } pgEditor.SelectedObject = new AuthorizationRuleBag((AuthorizationRule)_object); Size = new Size(468, Size.Height); } MaximumSize = new Size(Size.Width + 100, Size.Height); MinimumSize = new Size(Size.Width - 100, Size.Height); } }
public void OnSelect(object sender, EventArgs e) { if (_object != null) { if (_object.GetType() == typeof(Criteria)) { Text = @"Criteria Editor"; // pgEditor.SelectedObject = _object; pgEditor.SelectedObject = new CriteriaBag(((Criteria)_object)); Size = new Size(Size.Width, 711); pgEditor.Size = new Size(pgEditor.Size.Width, 619); var cslaObject = (CslaObjectInfo)GeneratorController.Current.MainForm.ProjectPanel.ListObjects.SelectedItem; if ((cslaObject.ObjectType == CslaObjectType.ReadOnlyObject || cslaObject.ObjectType == CslaObjectType.ReadOnlyCollection || cslaObject.ObjectType == CslaObjectType.NameValueList || (cslaObject.ObjectType == CslaObjectType.UnitOfWork))) { Size = new Size(Size.Width, Size.Height - 256); pgEditor.Size = new Size(pgEditor.Size.Width, pgEditor.Size.Height - 256); } if (!GeneratorController.Current.CurrentUnit.GenerationParams.TargetIsCsla4All) { Size = new Size(Size.Width, Size.Height - 32); pgEditor.Size = new Size(pgEditor.Size.Width, pgEditor.Size.Height - 32); } pgEditor.ExpandAllGridItems(); } else if (_object.GetType() == typeof(TypeInfo)) { Text = @"Inherited Type Editor"; //pgEditor.SelectedObject = _object; pgEditor.SelectedObject = new InheritedTypePropertyBag((TypeInfo)_object); Size = new Size(Size.Width + 100, Size.Height); } else if (_object.GetType() == typeof(AuthorizationRule)) { Text = @"Authorization Type Editor"; ((AuthorizationRule)_object).TypeChanged -= OnSelect; ((AuthorizationRule)_object).TypeChanged += OnSelect; if (!string.IsNullOrEmpty(PropertyCollectionForm.ParentValProp)) { ((AuthorizationRule)_object).IsPropertyRule = true; ((AuthorizationRule)_object).Parent = PropertyCollectionForm.ParentValProp; ((AuthorizationRule)_object).ActionProperty = ValueProperty.Convert(PropertyCollectionForm.ParentProperty); } else { var cslaObject = (CslaObjectInfo)GeneratorController.Current.MainForm.ProjectPanel.ListObjects.SelectedItem; ((AuthorizationRule)_object).ActionProperty = cslaObject.ActionProperty; ((AuthorizationRule)_object).Parent = string.Empty; } //pgEditor.SelectedObject = _object; pgEditor.SelectedObject = new AuthorizationRuleBag((AuthorizationRule)_object); Size = new Size(468, Size.Height); } MaximumSize = new Size(Size.Width + 100, Size.Height); MinimumSize = new Size(Size.Width - 100, Size.Height); } }