void _s_题_判断_答案_获取Completed(object sender, 务.题_判断_答案_获取CompletedEventArgs e) { var data = new 判断题 { 题 = _题, 答案 = e.Result.ToList <题.题_判断_答案>().FirstOrDefault() }; var f = new 题_判断_修改(data) { ParentLayoutRoot = this.LayoutRoot }; f.Closed += f_Closed; f.ShowDialog(); }
void _s_题_判断_答案_获取Completed(object sender, 务.题_判断_答案_获取CompletedEventArgs e) { if (_selected_row == null || _selected_row.题编号 != _判断题.题.题编号) { return; } _判断题.答案 = e.Result.ToList <题.题_判断_答案>().FirstOrDefault(); #region 预览 var result = _判断题; _预览_RichTextBox.Blocks.Clear(); var s = "<___root___>" + result.题.显示模板 + "</___root___>"; var xe = XElement.Parse(s); var xns = xe.Nodes(); var p = new Paragraph { FontSize = 16 }; p.Inlines.Add(new Run { Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)) , FontWeight = FontWeights.Bold , Text = @"题面: " }); foreach (var xn in xns) { if (xn.NodeType == XmlNodeType.Text) { p.Inlines.Add(new Run { Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)) , FontWeight = FontWeights.Normal , Text = ((XText)xn).Value }); } else { // todo: 判断是图片 还是 答案格子 p.Inlines.Add(new Run { Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255)) , FontWeight = FontWeights.Bold , Text = "___" }); } } p.Inlines.Add(new Run { Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)) , FontWeight = FontWeights.Bold , Text = @" 答案: " }); p.Inlines.Add(new Run { Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)) , FontWeight = FontWeights.Bold , Text = result.答案.答案 ? "正确" : "错误" }); _预览_RichTextBox.Blocks.Add(p); #endregion // 还原控件状态 _DataGrid.IsEnabled = true; _DataGrid.Focus(); }