Exemplo n.º 1
0
 private void UORTButton_Click(object sender, EventArgs e)
 {
     if (ActiveStatus != null)
     {
         PostText.Text = "RT @" + ActiveStatus.User.ScreenName + ": " + ActiveStatus.Text;
         PostText.Select(0, 0);
     }
 }
Exemplo n.º 2
0
 public void ShowActiveStatus()
 {
     if (ActiveStatus != null)
     {
         PostText.Text = "@" + ActiveStatus.User.ScreenName + " ";
         PostText.Select(PostText.Text.Length - 1, 0);
         var th = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
         {
             Invoke(new Action(() =>
             {
                 ActiveStatusView.SmallImageList = new ImageList();
             }));
             string uri = ActiveStatus.User.ProfileImageLocation;
             using (WebClient wc = new WebClient())
             {
                 using (Stream stream = wc.OpenRead(uri))
                 {
                     Bitmap bitmap = new Bitmap(stream);
                     Invoke(new Action(() => ActiveStatusView.SmallImageList.Images.Add(ActiveStatus.User.ScreenName, bitmap)));
                 }
             }
             var i = new ListViewItem(new[] { ActiveStatus.User.ScreenName, ActiveStatus.Text }, ActiveStatus.User.ScreenName);
             Invoke(new Action(() =>
             {
                 ActiveStatusView.Items.Clear();
                 ActiveStatusView.Items.Add(i);
             }));
         }));
         th.Start();
     }
     else
     {
         new Task(() =>
         {
             Invoke(new Action(() =>
             {
                 ActiveStatusView.SmallImageList = new ImageList();
             }));
             var i = new ListViewItem(new[] { "null", "null" });
             Invoke(new Action(() =>
             {
                 ActiveStatusView.Items.Clear();
                 ActiveStatusView.Items.Add(i);
             }));
         }).Start();
     }
 }
Exemplo n.º 3
0
        private void PostText_KeyDown(object sender, KeyEventArgs e)
        {
            if (!IsCommandMode)
            {
                if (e.Control && e.KeyCode == Keys.Enter)
                {
                    if (CodeDo())
                    {
                        PostText.Text  = "";
                        CommandHandled = true;
                    }
                    else if (AccountsList.SelectedItems.Count != 0)
                    {
                        if (ActiveStatus == null)
                        {
                            twitterDo.Post(PostText.Text);
                            PostText.Text = "";
                        }
                        else
                        {
                            twitterDo.Post(PostText.Text, ActiveStatus);
                            PostText.Text = "";
                        }
                        Tweeted = true;
                    }
                    else
                    {
                        MConsole.WriteLine("You haven't selected any accounts.");
                    }
                }
                else if (e.Control && e.KeyCode == Keys.F)
                {
                    if (ActiveStatus != null)
                    {
                        twitterDo.Favorite(ActiveStatus);
                    }
                }
                else if (e.Control && e.KeyCode == Keys.R)
                {
                    if (ActiveStatus != null)
                    {
                        twitterDo.Retweet(ActiveStatus);
                    }
                }
                else if (e.Control && e.KeyCode == Keys.Q)
                {
                    if (ActiveStatus != null)
                    {
                        PostText.Text = "RT @" + ActiveStatus.User.ScreenName + ": " + ActiveStatus.Text;
                        PostText.Select(0, 0);
                    }
                }
                else if (e.Control && e.KeyCode == Keys.U)
                {
                    if (ActiveStatus != null && NowTokens.Length != 0)
                    {
                        new UserView(ActiveStatus.User.ScreenName, NowTokens.First().OAuthTokens).Show();
                    }
                    else
                    {
                        MConsole.WriteLine("You haven't selected any accounts.");
                    }
                }
                else if (e.Control && e.KeyCode == Keys.D)
                {
                    IsCommandMode = true;
                    PostText.Text = @"Command Mode
";
                    MConsole.WriteLine(ActiveColumn == null ? "c[Number] ... Activate the [Number]th column" : " [Number] ... Activate the [Number]th Tweet from Column that is activated");
                    PostText.ReadOnly = true;
                }
                else if (e.KeyCode == Keys.Delete)
                {
                    ActiveStatus = null;
                    ShowActiveStatus();
                    Command       = "";
                    PostText.Text = "";
                    MConsole.WriteLine("Ready");
                }
            }
            else
            {
                if (e.Control && e.KeyCode == Keys.D)
                {
                    IsCommandMode     = false;
                    PostText.ReadOnly = false;
                    CommandCount      = 0;
                    Command           = "";
                    PostText.Text     = "";
                }
            }
        }