Exemplo n.º 1
0
 public void Insert(TweetInput tweet)
 {
     using (var connection = new SqlConnection(_connectionString))
     {
         connection.Execute("INSERT INTO Tweets (Id, TweetText, RetweetCount, TweetImage, CreationTime) " +
                            "VALUES(@Id, @TweetText, @RetweetCount, @TweetImage, @CreationTime); ",
                            new { Id           = tweet.Id, TweetText = tweet.TweetText,
                                  RetweetCount = tweet.RetweetCount,
                                  TweetImage   = tweet.TweetImage,
                                  CreationTime = tweet.CreationTime });
     }
 }
        public void Tweet(Tweet tweet)
        {
            TweetInput.Click();
            TweetInput.SendKeys(tweet.Message);

            Driver.Wait(Timeouts.Wait)
            .Until(driver => TweetButton.Enabled);

            TweetButton.Click();

            Thread.Sleep(2000);

            Driver.Wait(Timeouts.Wait)
            .Until(driver => TweetButton.Displayed && !TweetButton.Enabled);
        }
Exemplo n.º 3
0
        private void OpenInputBox(object sender, RoutedEventArgs e)
        {
            TransitionDisplay.SetState(TweetBox, TransitionState.Active);

            if (InReplyTo != null)
            {
                ReplyToName.Text = InReplyTo.User.ScreenName;
            }

            TweetInput.Text           = " " + Keywords.Text + " #wenku10";
            TweetInput.SelectionStart = 0;
            TweetInput.Focus(FocusState.Keyboard);

            UpdateCharLeft();

            MajorControls = InputControls;
            ControlChanged?.Invoke(this);
        }
Exemplo n.º 4
0
 public void Insert(TweetInput tweet)
 {
     _tweetService.InsertTweet(tweet);
 }
Exemplo n.º 5
0
 public void InsertTweet(TweetInput tweet)
 {
     _tweetRepo.Insert(tweet);
 }
Exemplo n.º 6
0
        private async void Submit()
        {
            string TweetContent = TweetInput.Text.Replace("\r\n", "\n").Trim();

            if (TweetLimit < TweetContent.Length)
            {
                return;
            }

            if (!SubmitBtn.IsEnabled)
            {
                return;
            }
            SubmitBtn.IsEnabled = false;

            if (!(TweetContent.Contains("#wenku10") && TweetContent.Contains(Keywords.Text)))
            {
                bool            Continue = false;
                StringResources stx      = StringResources.Load("Message");
                await Popups.ShowDialog(UIAliases.CreateDialog(
                                            string.Format(stx.Str("Desc_OSTweet"), Keywords.Text, "#wenku10")
                                            , stx.Str("OSTweet")
                                            , () => Continue = true
                                            , stx.Str("Yes"), stx.Str("No")
                                            ));

                if (!Continue)
                {
                    string ScopeText = "";

                    if (!TweetContent.Contains(Keywords.Text))
                    {
                        ScopeText += Keywords.Text + " ";
                    }
                    if (!TweetContent.Contains("#wenku10"))
                    {
                        ScopeText += "#wenku10 ";
                    }

                    TweetInput.Text            = TweetContent + " " + ScopeText;
                    TweetInput.SelectionStart  = TweetContent.Length;
                    TweetInput.SelectionLength = ScopeText.Length;

                    TweetInput.Focus(FocusState.Keyboard);

                    UpdateCharLeft();

                    SubmitBtn.IsEnabled = true;
                    return;
                }
            }

            try
            {
                TweetInput.IsEnabled = false;
                if (InReplyTo == null)
                {
                    await TwitterService.Instance.TweetStatusAsync(TweetContent);
                }
                else
                {
                    await TSExtended.Instance.ReplyStatusAsync(TweetContent, InReplyTo.Id);
                }

                InsertFakeTweet(TweetContent);

                TweetInput.Text     = "";
                SubmitBtn.IsEnabled = true;

                CloseInputBox();
            }
            catch (TwitterException ex)
            {
                var j = Popups.ShowDialog(UIAliases.CreateDialog(ex.Message));
            }

            TweetInput.IsEnabled = true;
        }