private void Window_Loaded(object sender, RoutedEventArgs e) { ConfigManager.LoadConf(); this.replyToItem = new ReplyToItem(); this.DataContext = this.replyToItem; this.textBlock_Remain.DataContext = this.inputText; this.textBlock_Media.DataContext = this.media; AccountManager am = AccountManager.GetInstance(); if (am.CurrentAccountIndex < 0) { AuthorizeWindow w = new AuthorizeWindow(); bool? success = w.ShowDialog(); if (success == true) { } } Account ac = am.GetAccount(am.CurrentAccountIndex); if (ac == null) { return; } this.account = ac; this.image_UserIcon.DataContext = this.account; this.timeLineViewer_Home.Initialize(this, this.account, TimeLineMode.Home); this.timeLineViewer_Home.SetTimeLine(); this.timeLineViewer_Home.StartStreaming(); this.timeLineViewer_Mention.Initialize(this, this.account, TimeLineMode.Mention); this.timeLineViewer_Mention.SetTimeLine(); this.timeLineViewer_Mention.StartStreaming(); this.timeLineViewer_Fav.Initialize(this, ac, TimeLineMode.Fav); this.timeLineViewer_Fav.SetTimeLine(); this.timeLineViewer_Fav.StartStreaming(); this.DmListViewer_DM.Initialize(this, ac); this.DmListViewer_DM.SetDirectMessage(); // this.timeLineViewer_DM.StartStreaming(); string titleText = "Mik_Twit - @" + this.account.ScreenName; this.title = new TitleTextItem(titleText); this.textBlock_Title.DataContext = title; this.TaskIcon = new NotifyIconWrapper(); }
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(); }