private void CategoryTree_Initialized(object sender, EventArgs e) { var this_tree_view = (TreeView)sender; _typeRepository.GetRootCategoryTypeDigest().Match( None: () => { this_tree_view.Items.Add(CreateCategoryTreeViewItem("No Categories(Empty)", null)); return(Unit()); }, Some: rootTypeDigest => { this_tree_view.Items.Add(CreateCategoryTreeViewItem(rootTypeDigest.Code, rootTypeDigest)); return(Unit()); } ); }
private void ButtonParentIdCheck_Click(object sender, RoutedEventArgs e) { int?idParent = ViewModel.ParentId; if (idParent.HasValue) { _typeRepository.GetTypeDigest(idParent.Value).Match( None: () => { EllopseParentId.Fill = Brushes.Red; return(Unit()); }, Some: t => { EllopseParentId.Fill = Brushes.Green; TextBlockIdParent.Text = t.Code + "(" + t.Name + ")"; return(Unit()); } ); } else { if (ViewModel.TypeCategoryId.HasValue && ViewModel.TypeCategoryId.Value == _typeRepository.GetRootCategoryTypeDigest().Match(() => - 1, t => t.Id)) { EllopseParentId.Fill = Brushes.Red; } else { EllopseParentId.Fill = Brushes.Green; } } e.Handled = true; }