private void CommandBinding_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var parameters = e.Parameter.ToString().Split('_'); // Section_Type_IsParagraph var selectedIds = new List <int>(); var section = m_pageViewModel.ConfigLevels.First(x => x.Section == parameters[0]); if (section.IsParagraph && (section.ParagraphMeta != null)) { selectedIds.Add(section.ParagraphMeta.Id); } else if (section.ParagraphMeta != null && section.ParagraphMeta.QuestionMeta.Count > 0) { selectedIds = section.ParagraphMeta.QuestionMeta.Select(x => x.Id).ToList(); } var manual = new SelectQuestionManual(m_pageViewModel.GenerateConfig.TestLevel.GetSubTypeFromTestLevel(), parameters[0], Convert.ToBoolean(parameters[2]), selectedIds); manual.ShowDialog(); if (manual.DialogResult.GetValueOrDefault(true) && manual.SelectedParagraphMeta != null && manual.SelectedParagraphMeta.QuestionMeta.Count > 0) { section = m_pageViewModel.ConfigLevels.First(x => x.Section == parameters[0]); section.ParagraphMeta = manual.SelectedParagraphMeta; section.NumOfQuestion = section.IsParagraph ? 1 : section.ParagraphMeta.QuestionMeta.Count; section.IsManual = true; } }
private void CommandBinding_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var button = (RadButton)e.OriginalSource; var parameters = e.Parameter.ToString().Split('_'); // Section_Type_IsParagraph var selectedIds = new List <int>(); var section = m_pageViewModel.ConfigLevels.First(x => x.Section == parameters[0]); if (section.IsParagraph && (section.ParagraphMeta != null)) { selectedIds.Add(section.ParagraphMeta.Id); } else if (section.ParagraphMeta != null && section.ParagraphMeta.QuestionMeta.Count > 0) { selectedIds = section.ParagraphMeta.QuestionMeta.Select(x => x.Id).ToList(); } var manual = new SelectQuestionManual(m_pageViewModel.GenerateConfig.TestLevel.GetSubTypeFromTestLevel(), parameters[0], Convert.ToBoolean(parameters[2]), selectedIds); manual.ShowDialog(); if (manual.DialogResult.GetValueOrDefault(true)) { if (manual.SelectedParagraphMeta != null && manual.SelectedParagraphMeta.QuestionMeta.Count > 0) { section = m_pageViewModel.ConfigLevels.First(x => x.Section == parameters[0]); section.ParagraphMeta = manual.SelectedParagraphMeta; section.NumOfQuestion = section.IsParagraph ? 1 : section.ParagraphMeta.QuestionMeta.Count; section.TimeDone = section.ParagraphMeta.TimeDone; section.IsManual = true; button.Background = System.Windows.Media.Brushes.LightGreen; } else { section = m_pageViewModel.ConfigLevels.First(x => x.Section == parameters[0]); section.ParagraphMeta = null; section.IsManual = false; button.Background = System.Windows.Media.Brushes.Transparent; } } }