Example #1
0
        void ReceiveTLResponse(TwitlongerPost post, TwitlongerResponse response)
        {
            if (response.StatusCode != HttpStatusCode.OK || post == null || post.Post == null || string.IsNullOrEmpty(post.Post.Content) || response.Sender == null)
            {
                IsLoading = false;
                MessageService.ShowError(Resources.ErrorCreatingTwitlonger);
                return;
            }

            BarText = Resources.SendingTweet;

            string name = response.Sender.Username;

            var account = Config.Accounts.FirstOrDefault(x => x.ScreenName == name);

            if (account == null)
            {
                IsLoading = false;
                MessageService.ShowError(Resources.ErrorCreatingTwitlonger);
                return;
            }

            try
            {
                lock (dicLock)
                    TwitlongerIds.Add(name, post.Post.Id);
            }
            catch
            {
                // TODO: Sometimes, this gives a weird OutOfRange exception. Don't know why, investigate it.
            }

            if (IsGeotagged)
            {
                var location = geoWatcher.Position.Location;
                ServiceDispatcher.GetService(account).SendTweet(new SendTweetOptions
                {
                    Status            = post.Post.Content,
                    InReplyToStatusId = DataTransfer.ReplyId,
                    Lat  = location.Latitude,
                    Long = location.Longitude
                }, ReceiveResponse);
            }
            else
            {
                ServiceDispatcher.GetService(account).SendTweet(new SendTweetOptions {
                    Status = post.Post.Content, InReplyToStatusId = DataTransfer.ReplyId
                }, ReceiveResponse);
            }
        }
Example #2
0
        void ReceiveTLResponse(TwitlongerPost post, TwitlongerResponse response)
        {
            if (response.StatusCode != HttpStatusCode.OK || post == null || post.Post == null || string.IsNullOrEmpty(post.Post.Content) || response.Sender == null)
            {
                IsLoading = false;
                MessageService.ShowError(Resources.ErrorCreatingTwitlonger);
                return;
            }

            BarText = Resources.SendingTweet;

            string name = response.Sender.Username;

            var account = Config.Accounts.FirstOrDefault(x => x.ScreenName == name);

            if (account == null)
            {
                IsLoading = false;
                MessageService.ShowError(Resources.ErrorCreatingTwitlonger);
                return;
            }

            try
            {
                lock (dicLock)
                    TwitlongerIds.Add(name, post.Post.Id);
            }
            catch
            {
                // TODO: Sometimes, this gives a weird OutOfRange exception. Don't know why, investigate it.
            }

            if (IsGeotagged)
            {
                var location = geoWatcher.Position.Location;
                ServiceDispatcher.GetService(account).SendTweet(new SendTweetOptions
                {
                    Status = post.Post.Content,
                    InReplyToStatusId = DataTransfer.ReplyId,
                    Lat = location.Latitude,
                    Long = location.Longitude
                }, ReceiveResponse);
            }
            else
            {
                ServiceDispatcher.GetService(account).SendTweet(new SendTweetOptions { Status = post.Post.Content, InReplyToStatusId = DataTransfer.ReplyId }, ReceiveResponse);
            }
        }