/// <summary> /// 更新 /// </summary> private void Update() { try { if (!this.IsLoaded || !this.dirty) { return; } var bbcode = this.BBCode; if (this.Inlines.Count > 0) { this.Inlines.Clear(); } if (!string.IsNullOrWhiteSpace(bbcode)) { Inline inline; try { var parser = new BBCodeParser(bbcode, this) { Commands = this.LinkNavigator.Commands }; inline = parser.Parse(); } catch (Exception) { // 分析失败,按原样显示BBCode值 parsing failed, display BBCode value as-is inline = new Run { Text = bbcode }; } this.Inlines.Add(inline); } this.dirty = false; } catch (Exception error) { ModernDialog.ShowMessage(error.Message, ModernUI.Resources.NavigationFailed, MessageBoxButton.OK); } }
/// <summary> /// 显示提示消息 /// </summary> /// <param name="message">提示信息</param> /// <param name="title">标题</param> protected void ShowMessage(string message, string title = "提示:") { ModernDialog.ShowMessage(message, title, MessageBoxButton.OK); }