From 1346ff67da027f203bf49ce8b459e87bb5884395 Mon Sep 17 00:00:00 2001 From: KyoPeeee Date: Mon, 19 Oct 2015 04:04:46 +0900 Subject: [PATCH] =?utf8?q?=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3=E3=83=BC?= =?utf8?q?=E3=83=AB=E7=94=BB=E9=9D=A2=E3=81=AEURL=E3=81=8Ct.co=E5=BD=A2?= =?utf8?q?=E5=BC=8F=E3=81=A0=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E5=B1=95?= =?utf8?q?=E9=96=8B=E3=81=97=E3=81=9F=E3=82=82=E3=81=AE=E3=81=AB=E5=A4=89?= =?utf8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween/UserInfoDialog.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/OpenTween/UserInfoDialog.cs b/OpenTween/UserInfoDialog.cs index 928f4c8c..0ab81f9f 100644 --- a/OpenTween/UserInfoDialog.cs +++ b/OpenTween/UserInfoDialog.cs @@ -143,15 +143,15 @@ namespace OpenTween await Task.WhenAll(new[] { - this.SetDescriptionAsync(user.Description, cancellationToken), + this.SetDescriptionAsync(user.Description, user.Entities.Description, cancellationToken), this.SetRecentStatusAsync(user.Status, cancellationToken), - this.SetLinkLabelWebAsync(user.Url, cancellationToken), + this.SetLinkLabelWebAsync(user.Url, user.Entities.Url, cancellationToken), this.SetUserImageAsync(user.ProfileImageUrlHttps, cancellationToken), this.LoadFriendshipAsync(user.ScreenName, cancellationToken), }); } - private async Task SetDescriptionAsync(string descriptionText, CancellationToken cancellationToken) + private async Task SetDescriptionAsync(string descriptionText, TwitterEntities entities, CancellationToken cancellationToken) { if (descriptionText != null) { @@ -161,7 +161,7 @@ namespace OpenTween var decodedText = descriptionText.Replace("<", "<").Replace(">", ">").Replace(""", "\""); var html = WebUtility.HtmlEncode(decodedText); - html = await this.twitter.CreateHtmlAnchorAsync(html, atlist, null); + html = await this.twitter.CreateHtmlAnchorAsync(html, atlist, entities, null); html = this.mainForm.createDetailHtml(html); if (cancellationToken.IsCancellationRequested) @@ -206,9 +206,19 @@ namespace OpenTween }); } - private async Task SetLinkLabelWebAsync(string uri, CancellationToken cancellationToken) + private async Task SetLinkLabelWebAsync(string uri, TwitterEntities entities, CancellationToken cancellationToken) { - if (uri != null) + if (entities != null) { + var expandedUrl = await ShortUrl.Instance.ExpandUrlAsync(entities.Urls[0].ExpandedUrl); + + if (cancellationToken.IsCancellationRequested) + return; + + this.LinkLabelWeb.Text = expandedUrl; + this.LinkLabelWeb.Tag = expandedUrl; + this.ToolTip1.SetToolTip(this.LinkLabelWeb, expandedUrl); + } + else if (uri != null) { var expandedUrl = await ShortUrl.Instance.ExpandUrlAsync(uri); -- 2.11.0