예제 #1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            User user = null;

            try
            {
                if (string.IsNullOrEmpty(this.targetScreenName))
                {
                    user = await TwitterUtil.GetUserAsync(this.account.TokensData, this.targetId);
                }
                else
                {
                    user = await TwitterUtil.GetUserAsync(this.account.TokensData, this.targetScreenName);
                }
            }
            catch (TwitterException tex)
            {
                MessageBox.Show(tex.Message,
                                "Twitter Exception.",
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);

                this.Close();
                return;
            }

            if (user == null)
            {
                this.Close();
                return;
            }

            UserInfoItem item = new UserInfoItem(this.account.TokensData, user);

            this.userInfo    = item;
            this.DataContext = this.userInfo;

            try
            {
                this.timeLineViewer_Tweet.Initialize(this, this.account, TimeLineMode.UserTweet);
                await this.timeLineViewer_Tweet.SetUserStatusesAsync(this.userInfo.Id);

                this.userListViewer_Follow.Initialize(this, this.account, UserListMode.Follow);
                await this.userListViewer_Follow.SetFollowsAsync(this.userInfo.Id);

                this.userListViewer_Follower.Initialize(this, this.account, UserListMode.Follower);
                await this.userListViewer_Follower.SetFollowersAsync(this.userInfo.Id);
            }
            catch (TwitterException tex)
            {
                MessageBox.Show(tex.Message,
                                "Twitter Exception.",
                                MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }

            this.title = new TitleTextItem(string.Format("User Information - @{0}", user.ScreenName));
            this.textBlock_Title.DataContext = this.title;

            this.Activate();
        }