public ToggleButton CreateFavoriteButton(Status s) { ToggleButton b = new ToggleButton (); Binding fontSizeBinding = CreateBinding (this, FontSizeProperty.Name, BindingMode.OneWay); b.SetBinding (ToggleButton.WidthProperty, fontSizeBinding); b.SetBinding (ToggleButton.HeightProperty, fontSizeBinding); Binding favBinding = CreateBinding (s, "IsFavorited", BindingMode.OneWay); b.SetBinding (ToggleButton.IsCheckedProperty, favBinding); b.Margin = new Thickness (0, 0, 3, 0); b.VerticalAlignment = VerticalAlignment.Center; b.Click += isFav_Click; b.Style = (Style)Resources["favoriteButton"]; return b; }
public StatusArrivedEventArgs(Status status) { Status = status; }
void Favorite(TwitterAccount account, Status status, bool isFavorite) { ThreadPool.QueueUserWorkItem (delegate (object o) { bool new_fav = isFavorite; try { if (isFavorite) { account.TwitterClient.FavoritesCreate (status.ID); } else { account.TwitterClient.FavoritesDestroy (status.ID); } } catch { new_fav = !isFavorite; } try { new_fav = account.TwitterClient.Show (status.ID).IsFavorited; } catch {} Dispatcher.Invoke (new EmptyDelegate (delegate () { status.IsFavorited = new_fav; })); }); }
private void BadRetweetMenuItem_Click(object sender, RoutedEventArgs e) { Status status = ((ListBox)((ContextMenu)((MenuItem)sender).Parent).PlacementTarget).SelectedItem as Status; _replyInfo = status; _replyName = "RT @" + status.User.ScreenName; postTextBox.Text = _replyName + ": " + status.Text; SetReplySetting (); Dispatcher.BeginInvoke (new EmptyDelegate (delegate () { postTextBox.SelectionStart = 0; ShowPostArea (true); })); }
private void TwitterStatusViewer_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Status selected = sender as Status; if (selected == null) selected = (sender as TwitterStatusViewer).Status; if (selected.ID == 0 || selected.User.ScreenName == null) return; _replyInfo = selected; _replyName = "@" + selected.User.ScreenName; postTextBox.Text = _replyName + " "; SetReplySetting (); Dispatcher.BeginInvoke (new EmptyDelegate (delegate () { postTextBox.SelectionStart = postTextBox.Text.Length; ShowPostArea (true); })); }
void ResetReplySetting(bool btnTextOnly) { if (!btnTextOnly) { _replyInfo = null; _replyName = null; } postButton.Content = "Post"; }
bool IsMention(Status status) { if ((SelfUserID != 0 && status.InReplyToUserId == SelfUserID) || status.Text.Contains ("@" + ScreenName)) return true; return false; }