internal void Update(ruleSet RuleSet, ruleSetWindow rsW) { SelectedRuleSet = RuleSet; txtName.Text = rsW.Title; for (int i = 0; i < GSApp.settings.rulesets.GetLength(0); i++) { if (SelectedRuleSet.Equals(GSApp.settings.rulesets[i])) { txtName.Text += " (set to RuleSet #" + i + ")"; break; } } txtTriggerRuleNo.Text = SelectedRuleSet.TriggerRuleNum.ToString(); cmdChoiceMethod.SelectedIndex = cmdChoiceMethod.Items.IndexOf(SelectedRuleSet.choiceMethod); cmdInterimCandidates.SelectedIndex = cmdInterimCandidates.Items.IndexOf(SelectedRuleSet.interimCandidates); cmdFinalCandidates.SelectedIndex = cmdFinalCandidates.Items.IndexOf(SelectedRuleSet.finalCandidates); cmdAfterNormalCycle.SelectedIndex = cmdAfterNormalCycle.Items.IndexOf(SelectedRuleSet.generationAfterNormal); cmdChoiceSendsStop.SelectedIndex = cmdChoiceSendsStop.Items.IndexOf(SelectedRuleSet.generationAfterChoice); cmdNoOfCallsReached.SelectedIndex = cmdNoOfCallsReached.Items.IndexOf(SelectedRuleSet.generationAfterCycleLimit); cmdNoRulesRecognized.SelectedIndex = cmdNoRulesRecognized.Items.IndexOf(SelectedRuleSet.generationAfterNoRules); cmdTriggerRuleInvoked.SelectedIndex = cmdTriggerRuleInvoked.Items.IndexOf(SelectedRuleSet.generationAfterTriggerRule); txtRecognizeSourceFiles.Text = StringCollectionConverter.Convert(SelectedRuleSet.recognizeSourceFiles); txtApplySourceFiles.Text = StringCollectionConverter.Convert(SelectedRuleSet.applySourceFiles); }
public void NewRuleSet_ClickOnExecuted(object sender, ExecutedRoutedEventArgs e) { try { var rSW = new ruleSetWindow( new ruleSet(GSApp.settings.RulesDirAbs), null, null); windowsMgr.AddandShowWindow(rSW); } catch (Exception exc) { ErrorLogger.Catch(exc); } }
public void addAndShowRuleSetWindow(object obj, string title = null) { var rs = new ruleSet(); string filename = null; if (obj == null) { rs = null; } else if (obj is ruleSet) { rs = (ruleSet)obj; } else if (obj is object[]) { var objArray = (object[])obj; if (objArray.GetLength(0) > 0) { if (objArray[0] is ruleSet) { rs = (ruleSet)objArray[0]; } else if (objArray[0] is string) { filename = (string)objArray[0]; } } if (objArray.GetLength(0) > 1) { if (objArray[1] is ruleSet) { rs = (ruleSet)objArray[1]; } else if (objArray[1] is string) { filename = (string)objArray[1]; } } } if (title == null) { title = rs.name; } if (!windowsMgr.FindAndFocusFileInCollection(filename, WindowType.RuleSet)) { var rSW = new ruleSetWindow(rs, filename, title); windowsMgr.AddandShowWindow(rSW); } }