private void buttonAddAccount_Click(object sender, RoutedEventArgs e) { if (qfmUser != null) { AccountQuoteFM account = new AccountQuoteFM(); account.User = qfmUser; account.UpdateItems(); AppController.Current.AllAccounts.Add(account); this.Close(); } }
void listViewAccounts_SelectionChanged(object sender, SelectionChangedEventArgs e) { applyViewSettings(); userInfoTwitter.Visibility = System.Windows.Visibility.Collapsed; userInfoFacebook.Visibility = System.Windows.Visibility.Collapsed; userInfoQuoteFm.Visibility = System.Windows.Visibility.Collapsed; buttonEditLists.Visibility = System.Windows.Visibility.Collapsed; ListView listView = sender as ListView; if (listView != null) { IAccount iaccount = listView.SelectedItem as IAccount; if (iaccount != null) { buttonRemoveAccount.IsEnabled = true; borderAccountInfo.Visibility = Visibility.Visible; colorPicker.SelectedColor = iaccount.accountColor; if (iaccount.GetType() == typeof(AccountTwitter)) { AccountTwitter twAccount = iaccount as AccountTwitter; buttonEditLists.Visibility = System.Windows.Visibility.Visible; userInfoTwitter.Visibility = System.Windows.Visibility.Visible; userInfoTwitter.DataContext = twAccount.Login; } else if (iaccount.GetType() == typeof(AccountFacebook)) { AccountFacebook fbAccount = iaccount as AccountFacebook; userInfoFacebook.Visibility = System.Windows.Visibility.Visible; userInfoFacebook.DataContext = fbAccount.User; } else if (iaccount.GetType() == typeof(AccountQuoteFM)) { AccountQuoteFM qfmAccount = iaccount as AccountQuoteFM; userInfoQuoteFm.Visibility = System.Windows.Visibility.Visible; userInfoQuoteFm.DataContext = qfmAccount.User; } if (iaccount.accountColor != null) { colorPicker.SelectedColor = iaccount.accountColor; colorPicker.UpdateLayout(); } } else { buttonRemoveAccount.IsEnabled = false; borderAccountInfo.Visibility = Visibility.Hidden; } } }
public static TreeView CreateViewTreeView(View view, TreeView treeview, bool IncludeFilter) { treeview.Items.Clear(); if (view == null) { return(null); } foreach (IAccount iaccount in AppController.Current.AllAccounts) { if (view.isTwitterOnlyView) { if (iaccount.GetType() == typeof(AccountTwitter)) { #region Twitter AccountTwitter account = iaccount as AccountTwitter; string accountIdString = account.Login.Id.ToString(); TreeViewItem accountItem = new TreeViewItem(); accountItem.Name = "account_" + accountIdString; accountItem.ToolTip = account.Login.NameAndLogin; accountItem.Header = "@" + account.Login.Username; accountItem.IsExpanded = true; CheckBox timeline = new CheckBox(); timeline.Name = "timeline_" + accountIdString; timeline.Content = "Timeline"; if (view.subscribedTimelines.Contains(account.Login.Id)) { timeline.IsChecked = true; } accountItem.Items.Add(timeline); CheckBox mentions = new CheckBox(); mentions.Name = "mentions_" + accountIdString; mentions.Content = "Mentions"; if (view.subscribedMentions.Contains(account.Login.Id)) { mentions.IsChecked = true; } accountItem.Items.Add(mentions); CheckBox directMessages = new CheckBox(); directMessages.Name = "directMessages_" + accountIdString; directMessages.Content = "Direct messages"; if (view.subscribedDirectMessages.Contains(account.Login.Id)) { directMessages.IsChecked = true; } accountItem.Items.Add(directMessages); CheckBox retweets = new CheckBox(); retweets.Name = "retweets_" + accountIdString; retweets.Content = "Retweets"; if (view.subscribedRetweets.Contains(account.Login.Id)) { retweets.IsChecked = true; } accountItem.Items.Add(retweets); CheckBox favorites = new CheckBox(); favorites.Name = "favorites_" + accountIdString; favorites.Content = "Favorites"; if (view.subscribedFavorites.Contains(account.Login.Id)) { favorites.IsChecked = true; } accountItem.Items.Add(favorites); if (account.Lists.Count > 0) { TreeViewItem lists = new TreeViewItem(); lists.Name = "lists_" + accountIdString; lists.Header = "Lists"; lists.IsExpanded = true; foreach (TweetList list in account.Lists) { CheckBox listCheckbox = new CheckBox(); listCheckbox.Name = "list_" + list.Id.ToString(); listCheckbox.Content = list.NameAndCreator; listCheckbox.ToolTip = list.Description; if (view.subscribedLists.Contains(list.Id)) { listCheckbox.IsChecked = true; } lists.Items.Add(listCheckbox); } accountItem.Items.Add(lists); } if (account.Searches.Count > 0) { TreeViewItem searches = new TreeViewItem(); searches.Name = "searches_" + accountIdString; searches.Header = "Searches"; searches.IsExpanded = true; foreach (Search search in account.Searches) { CheckBox searchCheckbox = new CheckBox(); searchCheckbox.Name = "search_" + search.Id.ToString(); searchCheckbox.Content = search.name; if (view.subscribedSearches.Contains(search.Id)) { searchCheckbox.IsChecked = true; } searches.Items.Add(searchCheckbox); } accountItem.Items.Add(searches); } treeview.Items.Add(accountItem); #endregion } } else { if (iaccount.GetType() == typeof(AccountFacebook)) { #region Facebook AccountFacebook account = iaccount as AccountFacebook; string accountIdString = account.Id.ToString(); TreeViewItem accountItem = new TreeViewItem(); accountItem.Name = "fbAccount_" + accountIdString; accountItem.ToolTip = account.username; accountItem.Header = "Facebook " + account.username; accountItem.IsExpanded = true; CheckBox statusMessages = new CheckBox(); statusMessages.Name = "statusMessages_" + accountIdString; statusMessages.Content = "Status Messages"; if (view.subscribedFbStatusMessages.Contains(account.Id)) { statusMessages.IsChecked = true; } accountItem.Items.Add(statusMessages); CheckBox links = new CheckBox(); links.Name = "links_" + accountIdString; links.Content = "Links"; if (view.subscribedFbLinks.Contains(account.Id)) { links.IsChecked = true; } accountItem.Items.Add(links); CheckBox videos = new CheckBox(); videos.Name = "videos_" + accountIdString; videos.Content = "Videos"; if (view.subscribedFbVideos.Contains(account.Id)) { videos.IsChecked = true; } accountItem.Items.Add(videos); CheckBox photos = new CheckBox(); photos.Name = "photos_" + accountIdString; photos.Content = "Photos"; if (view.subscribedFbPhotos.Contains(account.Id)) { photos.IsChecked = true; } accountItem.Items.Add(photos); CheckBox events = new CheckBox(); events.Name = "events_" + accountIdString; events.Content = "Events"; if (view.subscribedFbEvents.Contains(account.Id)) { events.IsChecked = true; } accountItem.Items.Add(events); CheckBox checkIns = new CheckBox(); checkIns.Name = "checkIns_" + accountIdString; checkIns.Content = "CheckIns"; if (view.subscribedFbCheckIns.Contains(account.Id)) { checkIns.IsChecked = true; } accountItem.Items.Add(checkIns); CheckBox notes = new CheckBox(); notes.Name = "notes_" + accountIdString; notes.Content = "Notes"; if (view.subscribedFbNotes.Contains(account.Id)) { notes.IsChecked = true; } accountItem.Items.Add(notes); treeview.Items.Add(accountItem); #endregion } else if (iaccount.GetType() == typeof(AccountAppDotNet)) { #region App.net AccountAppDotNet account = iaccount as AccountAppDotNet; string accountIdString = account.Id.ToString(); TreeViewItem accountItem = new TreeViewItem(); accountItem.Name = "apnPersonalStream_" + accountIdString; accountItem.ToolTip = account.username; accountItem.Header = "App.net @" + account.username; accountItem.IsExpanded = true; CheckBox personalStream = new CheckBox(); personalStream.Name = "apnPersonalStream_" + accountIdString; personalStream.Content = "My stream"; if (view.subscribedApnPersonalStreams.Contains(account.Id)) { personalStream.IsChecked = true; } accountItem.Items.Add(personalStream); CheckBox privateMessages = new CheckBox(); privateMessages.Name = "apnPrivateMessages_" + accountIdString; privateMessages.Content = "Private Messages"; if (view.subscribedApnPrivateMessages.Contains(account.Id)) { privateMessages.IsChecked = true; } accountItem.Items.Add(privateMessages); CheckBox mentions = new CheckBox(); mentions.Name = "apnMentions_" + accountIdString; mentions.Content = "Mentions"; if (view.subscribedApnMentions.Contains(account.Id)) { mentions.IsChecked = true; } accountItem.Items.Add(mentions); CheckBox reposts = new CheckBox(); reposts.Name = "apnReposts_" + accountIdString; reposts.Content = "Reposts"; reposts.IsEnabled = false; if (false && view.subscribedApnPersonalStreams.Contains(account.Id)) { personalStream.IsChecked = true; } accountItem.Items.Add(reposts); treeview.Items.Add(accountItem); #endregion } else if (iaccount.GetType() == typeof(AccountQuoteFM)) { # region QUOTE.fm AccountQuoteFM account = iaccount as AccountQuoteFM; string accountIdString = account.User.Id.ToString(); TreeViewItem accountItem = new TreeViewItem(); accountItem.Name = "account_" + accountIdString; accountItem.ToolTip = account.User.Fullname; accountItem.Header = "QUOTE.fm " + account.User.username; accountItem.IsExpanded = true; CheckBox recommendations = new CheckBox(); recommendations.Name = "qfmRecos_" + accountIdString; recommendations.Content = "Recommendations"; if (view.subscribedQuoteFmRecommendations.Contains(account.User.Id)) { recommendations.IsChecked = true; } accountItem.Items.Add(recommendations); treeview.Items.Add(accountItem); } } if (AppController.Current.HasQuoteFmAccounts && QuoteFmCategories.Categories != null && !view.isTwitterOnlyView) { TreeViewItem categorytItem = new TreeViewItem(); categorytItem.Name = "qfmCategories"; categorytItem.ToolTip = "QUOTE.fm categories"; categorytItem.Header = "QUOTE.fm categories"; categorytItem.IsExpanded = true; foreach (QuoteSharp.Category category in QuoteFmCategories.Categories.catagories.entities) { CheckBox checkboxCategory = new CheckBox(); checkboxCategory.Name = "qfmCat_" + category.id.ToString(); checkboxCategory.Content = category.name; checkboxCategory.ToolTip = category.name; if (view.subscribedQuoteFmCategories.Contains(category.id)) { checkboxCategory.IsChecked = true; } categorytItem.Items.Add(checkboxCategory); } treeview.Items.Add(categorytItem); #endregion } }