Ejemplo n.º 1
0
        void SendBufferUpdate(object param)
        {
            if (!TrialInformation.IsFullFeatured)
            {
                TrialInformation.ShowBuyDialog();
                return;
            }

            if (Config.BufferProfiles.Count == 0)
            {
                AskBufferLogin();
                return;
            }

            List <string> profiles = new List <string>();

            foreach (var account in SelectedAccounts.Cast <UserToken>())
            {
                var profile = Config.BufferProfiles.Where(x => x.ServiceUsername == account.ScreenName).FirstOrDefault();

                if (profile != null)
                {
                    profiles.Add(profile.Id);
                }
            }

            var service = ServiceDispatcher.GetBufferService();

            if (service != null)
            {
                IsLoading = true;
                service.PostUpdate(TweetText, profiles, ReceiveBufferResponse);
            }
        }
Ejemplo n.º 2
0
        void Send(object param)
        {
            if (!CheckProtectedAccounts())
            {
                return;
            }

            requestsLeft = 0;

            if (SelectedAccounts.Count == 0)
            {
                MessageService.ShowError(Resources.SelectAccount);
                return;
            }

            BarText   = Resources.SendingTweet;
            IsLoading = true;

            if (IsDM)
            {
                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).SendDirectMessage(new SendDirectMessageOptions {
                    UserId = (int)DataTransfer.DMDestinationId, Text = TweetText
                }, ReceiveDM);
            }
            else
            {
                if (UsesTwitlonger)
                {
                    if (!EnsureTwitlonger())
                    {
                        IsLoading = false;
                        return;
                    }

                    BarText = Resources.UploadingTwitlonger;
                    foreach (UserToken account in SelectedAccounts.Cast <UserToken>())
                    {
                        ServiceDispatcher.GetTwitlongerService(account).PostUpdate(TweetText, ReceiveTLResponse);
                        requestsLeft++;
                    }
                }
                else
                {
                    if (IsGeotagged)
                    {
                        var location = geoWatcher.Position.Location;

                        foreach (UserToken account in SelectedAccounts.Cast <UserToken>())
                        {
                            ServiceDispatcher.GetService(account).SendTweet(new SendTweetOptions
                            {
                                Status            = TweetText,
                                InReplyToStatusId = DataTransfer.ReplyId,
                                Lat  = location.Latitude,
                                Long = location.Longitude
                            }, ReceiveResponse);
                            requestsLeft++;
                        }
                    }
                    else
                    {
                        foreach (UserToken account in SelectedAccounts.Cast <UserToken>())
                        {
                            ServiceDispatcher.GetService(account).SendTweet(new SendTweetOptions {
                                Status = TweetText, InReplyToStatusId = DataTransfer.ReplyId
                            }, ReceiveResponse);
                            requestsLeft++;
                        }
                    }
                }
            }

            if (DataTransfer.Draft != null)
            {
                if (Config.Drafts.Contains(DataTransfer.Draft))
                {
                    Config.Drafts.Remove(DataTransfer.Draft);
                }

                DataTransfer.Draft = null;
                Config.SaveDrafts();
            }
        }