public void OnEventHandler(ComboValueSelectedAggEvent e) { Transaction tempTransaction = new Transaction(); string catName = tempTransaction.GetName(() => tempTransaction.Category); string subName = tempTransaction.GetName(() => tempTransaction.SubCategory); TransactionRowModel row = e.EditedObject as TransactionRowModel; if (e.PropertyName == catName) { row.Item.IsEdited = true; AggEventCategoriesNeeded eventCategories = new AggEventCategoriesNeeded(); _eventAggregator.PublishEvent <AggEventCategoriesNeeded>(eventCategories); Category category = eventCategories.Categories.GetCategoryByName(e.NewValue); row.Item.Color = category.Color; SubCategory firstSubCategory = category.SubCategories.FirstOrDefault(); if (firstSubCategory.IsNotNullObj()) { row.Item.SubCategory = firstSubCategory.Name; } } if (e.PropertyName == subName) { row.Item.IsEdited = true; } _grid.Refresh(); _grid.Invalidate(); }
void DisplayEditControl(ITreeViewItem item) { panel1.Controls.Clear(); rulesGridControl1.Visible = false; Category category = item as Category; if (category.IsNotNullObj()) { PropertyFormGenerator.Options options = new PropertyFormGenerator.Options(); string colorName = category.Color.GetName(() => category.Color); options.Edited.Add(colorName); Control ctr = PropertyFormGenerator.Instance.CreateControlFor(category, options, _aggregator); panel1.Controls.Add(ctr); return; } SubCategory subCategory = item as SubCategory; if (subCategory.IsNotNullObj() && subCategory.Rules.IsNotNullObj()) { rulesGridControl1.DisplayRules(subCategory.Rules); rulesGridControl1.Visible = true; } }
void TreeView1OnAfterSelect(object sender, TreeViewEventArgs treeViewEventArgs) { ITreeViewItem item = (ITreeViewItem)treeViewEventArgs.Node.Tag; Category category = item as Category; if (category.IsNotNullObj()) { var obj = new { category.Name, category.Color }; Control ctr = PropertyFormGenerator.Instance.CreateControlFor(obj, null, EventAggregator.Empty); panel1.Controls.Clear(); panel1.Controls.Add(ctr); return; } SubCategory subCategory = item as SubCategory; if (subCategory.IsNotNullObj() && subCategory.Rules.IsNotNullObj()) { rulesGridControl1.DisplayRules(subCategory.Rules); } }