public StatusPanelController(TOBMain mainWindow) { //Initialize views _mainWindow = mainWindow; _userProfileView = mainWindow.userProfileTOB; _accountInfo = mainWindow.accountInfo; _tweetSender = mainWindow.userTweets; List<Status> statuses = new StatusBO().GetLimitedListBySorting((t => t.AccountId != 0), (t => t.TwitterCreatedDate), System.Data.SqlClient.SortOrder.Descending, MAX_COLLECTION_OBJECTS); List<TOBEntityBase> baseEntities = statuses.ConvertAll<TOBEntityBase>(s => s as TOBEntityBase); _statusCollection = new Collection<TOBEntityBase>(baseEntities); List<DirectMessage> dms = new DirectMessageBO().GetLimitedListBySorting((t => t.AccountId != 0 && t.Recieved == true),(t => t.TwitterCreatedDate), System.Data.SqlClient.SortOrder.Descending, MAX_COLLECTION_OBJECTS); List<TOBEntityBase> baseDmsEntities = dms.ConvertAll<TOBEntityBase>(s => s as TOBEntityBase); _directMessagesCollection = new Collection<TOBEntityBase>(baseDmsEntities); foreach (TOBBaseObject tobbaseobject in AccountManager.Instance.TobObjects) { tobbaseobject.NewStatus += new TOBBaseObject.StatusHandler(tobbaseobject_NewStatus); } PanelList pl = _mainWindow.accountInfo.CurrentPanelList as PanelList; LoadReplyView(pl.Where(s => s.PanelName == TOBEntityEnum.Replies).FirstOrDefault()); LoadReTweetView(pl.Where(s => s.PanelName == TOBEntityEnum.ReTweet).FirstOrDefault()); LoadMarkasFavoriteView(pl.Where(s => s.PanelName == TOBEntityEnum.Favorite).FirstOrDefault()); LoadDirectMessageView(pl.Where(s => s.PanelName == TOBEntityEnum.DirectMessages).FirstOrDefault()); LoadHomeView(pl.Where(s => s.PanelName == TOBEntityEnum.Home).FirstOrDefault()); }
/// <summary> /// This functino is required in order to refresh the account info in two cases. /// When a new account is added or deleted this usercontrol needs to be recreated to refrect /// the actual tob account inside the database. /// </summary> public void RefreshAccountInfoControl() { Button button = borderAccountInfo.Child as Button; accountInfo = new AccountInfo(); button.Content = accountInfo; }