private void LoadAllConditionalActions() { if (File.Exists("ConditionActions.xml")) { ConditionAction ca = new ConditionAction(); List <ConditionAction> lca = new List <ConditionAction>(); XElement root = XElement.Load("ConditionActions.xml"); root.Elements("ConditionActions").All <XElement>(xe2 => { xe2.Elements("ConditionAction").All <XElement>(xe => { lca.Add(new ConditionAction() { id = Convert.ToInt32(xe.Attribute("id").Value), ObjType = xe.Attribute("Type").Value, ParentID = Convert.ToInt32(xe.Attribute("Parent").Value), CondAct = (xe.Attribute("Type").Value == "Condition" ? (object)AMAActionableObjects.FixedConditionCollection.Where(x => x.id == Convert.ToInt32(xe.Attribute("ConditionAction").Value)).FirstOrDefault() : (object)AMAActionableObjects.FixedWorkflowActionCollection.Where(x => x.id == Convert.ToInt32(xe.Attribute("ConditionAction").Value)).FirstOrDefault()) }); return(true); }); ConditionActionCollection cac = new ConditionActionCollection(); cac.AddConditionAction(lca); lca.Clear(); cac.ConditionActionID = Convert.ToInt32(xe2.Attribute("ID").Value); objAllCondAction.AddConditionActionCollection(cac); return(true); }); AMAActionableObjects.FixedAllConditionsActions = objAllCondAction; } }
private void SaveConditionalAction_Click(object sender, RoutedEventArgs e) { ConditionActionCollection ConditionsActions = new ConditionActionCollection(); ConditionsActions.AddConditionAction(ListConditionAction); ConditionsActions.ConditionActionID = ObjAllConditionsActions.Count + 1; ObjAllConditionsActions.AddConditionActionCollection(ConditionsActions); AMAActionableObjects.FixedAllConditionsActions = ObjAllConditionsActions; ListConditionAction.Clear(); GrdConditionalAction.Visibility = Visibility.Collapsed; TxtCode.Text = ""; }