OSDN Git Service

SettingCommon.xml に bit.ly のアクセストークンの項目を追加
[opentween/open-tween.git] / OpenTween / Tween.cs
index 6bf4f12..998b739 100644 (file)
@@ -811,6 +811,7 @@ namespace OpenTween
             tw.AllAtReply = SettingManager.Common.AllAtReply;
             AllrepliesToolStripMenuItem.Checked = tw.AllAtReply;
             ShortUrl.Instance.DisableExpanding = !SettingManager.Common.TinyUrlResolve;
+            ShortUrl.Instance.BitlyAccessToken = SettingManager.Common.BitlyAccessToken;
             ShortUrl.Instance.BitlyId = SettingManager.Common.BilyUser;
             ShortUrl.Instance.BitlyKey = SettingManager.Common.BitlyPwd;
 
@@ -3731,6 +3732,7 @@ namespace OpenTween
                     tw.RestrictFavCheck = SettingManager.Common.RestrictFavCheck;
                     tw.ReadOwnPost = SettingManager.Common.ReadOwnPost;
                     ShortUrl.Instance.DisableExpanding = !SettingManager.Common.TinyUrlResolve;
+                    ShortUrl.Instance.BitlyAccessToken = SettingManager.Common.BitlyAccessToken;
                     ShortUrl.Instance.BitlyId = SettingManager.Common.BilyUser;
                     ShortUrl.Instance.BitlyKey = SettingManager.Common.BitlyPwd;
                     TwitterApiConnection.RestApiHost = SettingManager.Common.TwitterApiHost;
@@ -10301,7 +10303,7 @@ namespace OpenTween
             {
                 try
                 {
-                    var task = this.twitterApi.FriendshipsCreate(id);
+                    var task = this.twitterApi.FriendshipsCreate(id).IgnoreResponse();
                     await dialog.WaitForAsync(this, task);
                 }
                 catch (WebApiException ex)
@@ -10344,7 +10346,7 @@ namespace OpenTween
             {
                 try
                 {
-                    var task = this.twitterApi.FriendshipsDestroy(id);
+                    var task = this.twitterApi.FriendshipsDestroy(id).IgnoreResponse();
                     await dialog.WaitForAsync(this, task);
                 }
                 catch (WebApiException ex)
@@ -10544,11 +10546,13 @@ namespace OpenTween
                     return;
                 }
 
-                StatusText.Text = " " + MyCommon.GetStatusUrl(_curPost);
+                var selection = (this.StatusText.SelectionStart, this.StatusText.SelectionLength);
+
+                StatusText.Text += " " + MyCommon.GetStatusUrl(_curPost);
 
                 this.inReplyTo = null;
 
-                StatusText.SelectionStart = 0;
+                (this.StatusText.SelectionStart, this.StatusText.SelectionLength) = selection;
                 StatusText.Focus();
             }
         }
@@ -10569,14 +10573,16 @@ namespace OpenTween
                 string rtdata = _curPost.Text;
                 rtdata = CreateRetweetUnofficial(rtdata, this.StatusText.Multiline);
 
-                StatusText.Text = " RT @" + _curPost.ScreenName + ": " + rtdata;
+                var selection = (this.StatusText.SelectionStart, this.StatusText.SelectionLength);
+
+                StatusText.Text += " RT @" + _curPost.ScreenName + ": " + rtdata;
 
                 // 投稿時に in_reply_to_status_id を付加する
                 var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
                 var inReplyToScreenName = this._curPost.ScreenName;
                 this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
 
-                StatusText.SelectionStart = 0;
+                (this.StatusText.SelectionStart, this.StatusText.SelectionLength) = selection;
                 StatusText.Focus();
             }
         }