Example #1
0
        public void ListFollowings()
        {
            this.Dispatch(() =>
            {
                TabItem ti = new TabItem();

                StackPanel h = new StackPanel();
                h.Orientation = Orientation.Horizontal;
                TextBlock tx = new TextBlock { Text = String.Format(MessageHeaderUserFollowingFormat, ViewingUser.ScreenName) };
                Button cl = new Button();
                cl.Margin = new Thickness(2);
                cl.Content = new TextBlock { FontFamily = new FontFamily("Marlett"), FontSize = 7, Text = "r" };
                cl.Tag = ti;
                cl.Click += cl_Click;
                cl.Template = GetTemplate("FlatButton");
                cl.Background = Brushes.LightGray;
                h.Children.Add(tx);
                h.Children.Add(cl);
                ti.Header = h;

                ListBox lb = new ListBox();
                lb.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
                lb.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                lb.SetValue(ScrollViewer.CanContentScrollProperty, false);
                ti.Content = lb;
                MainTab.Items.Add(ti);
                MainTab.SelectedItem = ti;
                Service.ListFriends(new ListFriendsOptions { UserId = ViewingUser.Id, Count = (byte)ListFollowingCount }, (tl, res) =>
                {
                    lb.Dispatch(() =>
                    {
                        //TwitterState.Dispatch(() => TwitterState.Content = res.ToString());
                        if (tl == null) return;
                        foreach (var u in tl)
                        {
                            lb.Items.Add(CreateUserPanel(u));
                        }

                        if (tl.NextCursor == 0) return;
                        Button morefw = new Button();
                        morefw.Content = "さらに表示";
                        morefw.Click += morefr_Click;
                        morefw.Tag = new FFInfo { Cursor = tl.NextCursor, User = ViewingUser, TargetListBox = lb };
                        lb.Items.Add(morefw);
                    });

                });
            });
        }