Exemple #1
0
        void webBrowserOAuth_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs e)
        {
            FacebookOAuthResult oauthResult;

            if (_fb.TryParseOAuthCallbackUrl(e.Url, out oauthResult))
            {
                if (oauthResult.IsSuccess)
                {
                    AccountFacebook fbAccount = new AccountFacebook();
                    fbAccount.AccessToken = oauthResult.AccessToken;
                    fbAccount.verifyCredentials();
                    if (AppController.Current.AllFacebookAccounts.Where(acc => acc.Id == fbAccount.Id).Count() > 0)
                    {
                        MessageBox.Show("This account already has been authorized with Nymphicus successfully. On some systems there is an auto log in active which prevents Nymphicus from asking about other credentials. Please open Internet Explorer and log off there from Facebook- then try again. This window will be closed now", "Account already authorized", MessageBoxButton.OK);
                        Close();
                        return;
                    }
                    facebookOAuthResult      = oauthResult;
                    fbAccount.TokenExpiresAt = oauthResult.Expires;
                    AppController.Current.AllAccounts.Add(fbAccount);
                    Close();
                    return;
                }
                this.WindowState = System.Windows.WindowState.Normal;
                Show();
            }
            else
            {
                this.WindowState = System.Windows.WindowState.Normal;
                Show();
                oauthResult         = null;
                facebookOAuthResult = oauthResult;
            }
        }
        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;
                }
            }
        }
Exemple #3
0
 private void buttonSendStatus_Click(object sender, RoutedEventArgs e)
 {
     if (textBoxMessage.Text.Length > 0)
     {
         account = comboBoxAccount.comboBoxAccounts.SelectedItem as AccountFacebook;
         if (!IsValidLink)
         {
             account.PostTextStatus(textBoxMessage.Text);
         }
         else
         {
             account.PostLink(textBoxMessage.Text, textBoxLink.Text);
         }
         Close();
     }
 }
 private void buttonSendComment_Click(object sender, RoutedEventArgs e)
 {
     if (textBoxComment.Text.Length > 0)
     {
         AccountFacebook account = comboBoxAccount.comboBoxAccounts.SelectedItem as AccountFacebook;
         if (account != null)
         {
             account.CommentItem(item, textBoxComment.Text);
         }
         else
         {
             item.Account.CommentItem(item, textBoxComment.Text);
         }
         Close();
     }
 }
Exemple #5
0
        public ComposeNewStatus(AccountFacebook fbAccount)
        {
            InitializeComponent();

            Cancel.InputGestures.Add(new KeyGesture(Key.Escape));
            SelectTextField.InputGestures.Add(new KeyGesture(Key.T, ModifierKeys.Control));
            SelectLinkField.InputGestures.Add(new KeyGesture(Key.L, ModifierKeys.Control));
            SelectAccount.InputGestures.Add(new KeyGesture(Key.O, ModifierKeys.Control));
            Send.InputGestures.Add(new KeyGesture(Key.Enter, ModifierKeys.Control));
            Send.InputGestures.Add(new KeyGesture(Key.Return, ModifierKeys.Control));


            account = fbAccount;
            if (account == null)
            {
                foreach (IAccount iaccount in AppController.Current.AllAccounts)
                {
                    if (iaccount.GetType() == typeof(AccountFacebook))
                    {
                        account = iaccount as AccountFacebook;
                        break;
                    }
                }
            }
            comboBoxAccount.comboBoxAccounts.SelectedItem = account;

            try
            {
                if (AppController.Current.mainWindow.WindowState == System.Windows.WindowState.Normal)
                {
                    this.Top  = AppController.Current.mainWindow.Top + 5;
                    this.Left = AppController.Current.mainWindow.Left + 5;
                }
            }
            catch
            {
            }
            textBoxMessage.Focus();
        }
Exemple #6
0
        private void hyperlinkToPurchasePage_Click(object sender, RoutedEventArgs e)
        {
            string purchaseLink = "http://www.li-ghun.de/Nymphicus/Purchase/";

            if (AppController.Current.AllAccounts.Count > 0)
            {
                try
                {
                    if (AppController.Current.AllTwitterAccounts.Count > 0)
                    {
                        AccountTwitter account = AppController.Current.AllTwitterAccounts[0] as AccountTwitter;
                        if (account != null)
                        {
                            purchaseLink += "?username="******"?username="******"Error", "Opening link failed", "While tryping to open the link Windows failed with following message: " + exp.Message, null, null);
                AppController.Current.Logger.writeToLogfile(exp);
            }
        }
            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
                    }
                }