public void getOptions(ref XMLGenerator.CombinationOptions combinationOptions) { // General options combinationOptions.TimeTolerance = timeTolerance.Value; combinationOptions.TimeToleranceType = timeToleranceType.SelectedItem.ToString(); combinationOptions.TransitionTolerance = transitionTolerance.Value; combinationOptions.TrainType = getTrainType(); // Per state options combinationOptions.States.Clear(); for (var i = 0; i < m_stateOptions.Count; ++i) { var gridName = "stateOptionsGrid" + i; foreach (UIElement el in mainGrid.Children) { if (el is Grid) { var g = el as Grid; if (g.Name == gridName) { var state = new XMLGenerator.CombinationStateOptions(); foreach (Control ctrl in g.Children) { if (ctrl.Name == "recognizers" && ctrl is ComboBox) { var cb = ctrl as ComboBox; if (cb.DataContext is DataTable) { var dt = cb.DataContext as DataTable; foreach (var row in dt.Select("IsChecked=true")) { state.Recognizers.Add(row["Name"].ToString()); } } } else if (ctrl.Name == "minDuration" && ctrl is NumericUpDown) { var n = ctrl as NumericUpDown; state.MinDuration = n.Value; } else if (ctrl.Name == "maxDuration" && ctrl is NumericUpDown) { var n = ctrl as NumericUpDown; state.MaxDuration = n.Value; } else if (ctrl.Name == "timeForTransition" && ctrl is NumericUpDown) { var n = ctrl as NumericUpDown; state.TimeForTransition = n.Value; } } combinationOptions.States.Add(state); break; } } } } }
public CombinationXMLGenerator(string name, MainWindow window, XMLGenerator.CombinationOptions options) : base(name, window, XMLGenerator.RecognizerType.Combination) { CombOptions = options; }