protected void SetModel(object sender, DependencyPropertyChangedEventArgs e) { Model = DataContext as ConditionComponentListingModel; if (Model == null) return; EditButton.Visibility = Model.Atom.Type == Calculator.ConditionAtomType.Nested ? Visibility.Hidden : Visibility.Visible; }
public void Initialise(ConditionContainer condition) { ObservableCollection<ConditionComponentListingModel> atoms = new ObservableCollection<ConditionComponentListingModel>(); if (condition != null && condition.AndConditions != null) { foreach (ConditionAtom atom in condition.AndConditions) { ConditionComponentListingModel componentModel = new ConditionComponentListingModel(atom); componentModel.OnEdit += EditComponentModel; componentModel.OnDelete += DeleteComponentModel; atoms.Add(componentModel); } } AndAtoms = atoms; atoms = new ObservableCollection<ConditionComponentListingModel>(); if (condition != null && condition.OrConditions != null) { foreach (ConditionAtom atom in condition.OrConditions) { ConditionComponentListingModel componentModel = new ConditionComponentListingModel(atom); componentModel.OnEdit += EditComponentModel; componentModel.OnDelete += DeleteComponentModel; atoms.Add(componentModel); } } OrAtoms = atoms; }
public ConditionComponentListingModel GetConditionAtomForOr() { ConditionAtom atom = new ConditionAtom(); ConditionComponentListingModel componentModel = new ConditionComponentListingModel(atom); componentModel.OnEdit += EditComponentModel; componentModel.OnDelete += DeleteComponentModel; OrAtoms.Add(componentModel); return componentModel; }