private ImageCache IconCache
=> this.iconCache ?? throw this.NotInitializedException();
+ private DetailsHtmlBuilder HtmlBuilder
+ => this.detailsHtmlBuilder ?? throw this.NotInitializedException();
+
/// <summary><see cref="PostClass"/> のダンプを表示するか</summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
private TweenMain? owner;
private ImageCache? iconCache;
private ThemeManager? themeManager;
+ private DetailsHtmlBuilder? detailsHtmlBuilder;
public TweetDetailsView()
{
this.PostBrowser.AllowWebBrowserDrop = false; // COMException を回避するため、ActiveX の初期化が終わってから設定する
}
- public void Initialize(TweenMain owner, ImageCache iconCache, ThemeManager themeManager)
+ public void Initialize(TweenMain owner, ImageCache iconCache, ThemeManager themeManager, DetailsHtmlBuilder detailsHtmlBuilder)
{
this.owner = owner;
this.iconCache = iconCache;
this.themeManager = themeManager;
+ this.detailsHtmlBuilder = detailsHtmlBuilder;
}
private Exception NotInitializedException()
=> new InvalidOperationException("Cannot call before initialization");
public void ClearPostBrowser()
- => this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml("");
+ => this.PostBrowser.DocumentText = this.HtmlBuilder.Build("");
public async Task ShowPostDetails(PostClass post)
{
}
sb.Append("-----End PostClass Dump<br>");
- this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(sb.ToString());
+ this.PostBrowser.DocumentText = this.HtmlBuilder.Build(sb.ToString());
return;
}
using (ControlTransaction.Update(this.PostBrowser))
{
this.PostBrowser.DocumentText =
- this.Owner.CreateDetailHtml(post.IsDeleted ? "(DELETED)" : post.Text);
+ this.HtmlBuilder.Build(post.IsDeleted ? "(DELETED)" : post.Text);
this.PostBrowser.Document.Window.ScrollTo(0, 0);
}
var body = post.Text + string.Concat(loadingQuoteHtml) + loadingReplyHtml;
using (ControlTransaction.Update(this.PostBrowser))
- this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(body);
+ this.PostBrowser.DocumentText = this.HtmlBuilder.Build(body);
// 引用ツイートを読み込み
var loadTweetTasks = quoteStatusIds.Select(x => this.CreateQuoteTweetHtml(x, isReply: false)).ToList();
body = post.Text + string.Concat(quoteHtmls);
using (ControlTransaction.Update(this.PostBrowser))
- this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(body);
+ this.PostBrowser.DocumentText = this.HtmlBuilder.Build(body);
}
private async Task<string> CreateQuoteTweetHtml(PostId statusId, bool isReply)
langFrom: null,
langTo: SettingManager.Instance.Common.TranslateLanguage);
- this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(translatedText);
+ this.PostBrowser.DocumentText = this.HtmlBuilder.Build(translatedText);
}
catch (WebApiException e)
{