public PracticeModel(TopicModel topic) : base() { DataRowView grammar = AdoUtils.GetDataView(topic.RowView, Strings.TABLE_GRAMMAR)[0]; CultureInfo nativeInfo = AdoUtils.GetCultureInfo(grammar, Strings.COL_NATIVE_LANG); if (nativeInfo != null) _nativeLang = nativeInfo.NativeName; CultureInfo targetInfo = AdoUtils.GetCultureInfo(grammar, Strings.COL_TARGET_LANG); if (targetInfo != null) _targetLang = targetInfo.NativeName; _showRuleText = (bool)grammar[Strings.COL_SHOWRULE]; _state = PracticeState.Invalid; _examples = new Queue<DataRowView>(); IList<DataRowView> list = new List<DataRowView>(); AddTopic(list, topic.RowView); if ((bool)grammar[Strings.COL_SHUFFLE]) ListUtils.Shuffle(list); foreach (DataRowView example in list) _examples.Enqueue(example); Next(); }
public TopicWnd(TopicModel model, Validator validator) { InitializeComponent(); this.status.DataContext = validator; this.DataContext = model; this.Loaded += new RoutedEventHandler(TopicWnd_Loaded); InputLanguageUtils.SetTargetInputLangage(); Dispatcher.CurrentDispatcher.BeginInvoke( (Func<bool>)(delegate() { this.title.Select(0, model.Title.Length); return false; }), DispatcherPriority.Background); }