Twitter fix

This commit is contained in:
Jaex 2014-07-07 04:21:59 +03:00
parent 18a3dedd80
commit 2b29b3e125
2 changed files with 14 additions and 8 deletions

View file

@ -1022,7 +1022,7 @@ public void DoSocialNetworkingService()
if (!string.IsNullOrEmpty(url)) if (!string.IsNullOrEmpty(url))
{ {
url = URLHelpers.URLEncode(url); string encodedUrl = URLHelpers.URLEncode(url);
switch (Info.TaskSettings.SocialNetworkingServiceDestination) switch (Info.TaskSettings.SocialNetworkingServiceDestination)
{ {
@ -1031,24 +1031,23 @@ public void DoSocialNetworkingService()
if (twitterOAuth != null) if (twitterOAuth != null)
{ {
using (TwitterTweetForm twitter = new TwitterTweetForm(twitterOAuth)) using (TwitterTweetForm twitter = new TwitterTweetForm(twitterOAuth, " " + url))
{ {
twitter.Message = url;
twitter.ShowDialog(); twitter.ShowDialog();
} }
} }
break; break;
case SocialNetworkingService.Facebook: case SocialNetworkingService.Facebook:
URLHelpers.OpenURL("https://www.facebook.com/sharer/sharer.php?u=" + url); URLHelpers.OpenURL("https://www.facebook.com/sharer/sharer.php?u=" + encodedUrl);
break; break;
case SocialNetworkingService.GooglePlus: case SocialNetworkingService.GooglePlus:
URLHelpers.OpenURL("https://plus.google.com/share?url=" + url); URLHelpers.OpenURL("https://plus.google.com/share?url=" + encodedUrl);
break; break;
case SocialNetworkingService.VK: case SocialNetworkingService.VK:
URLHelpers.OpenURL("http://vk.com/share.php?url=" + url); URLHelpers.OpenURL("http://vk.com/share.php?url=" + encodedUrl);
break; break;
case SocialNetworkingService.Pinterest: case SocialNetworkingService.Pinterest:
URLHelpers.OpenURL(string.Format("http://pinterest.com/pin/create/button/?url={0}&media={0}", url)); URLHelpers.OpenURL(string.Format("http://pinterest.com/pin/create/button/?url={0}&media={0}", encodedUrl));
break; break;
} }
} }

View file

@ -40,7 +40,7 @@ public string Message
{ {
return txtTweet.Text; return txtTweet.Text;
} }
set private set
{ {
txtTweet.Text = value; txtTweet.Text = value;
} }
@ -86,6 +86,12 @@ public TwitterTweetForm(OAuthInfo oauth)
AuthInfo = oauth; AuthInfo = oauth;
} }
public TwitterTweetForm(OAuthInfo oauth, string message)
: this(oauth)
{
Message = message;
}
private void UpdateLength() private void UpdateLength()
{ {
lblTweetLength.Text = (Length - Message.Length).ToString(); lblTweetLength.Text = (Length - Message.Length).ToString();
@ -123,6 +129,7 @@ private void SendTweet()
private void TwitterMsg_Shown(object sender, EventArgs e) private void TwitterMsg_Shown(object sender, EventArgs e)
{ {
txtTweet.SelectionLength = 0;
this.ShowActivate(); this.ShowActivate();
} }