示例#1
0
        private void backgroundWorkerRecentStatuses_DoWork(object sender, DoWorkEventArgs e)
        {
            if (this == null)
            {
                AppController.Current.Logger.writeToLogfile("Null this at recent status messages");
                return;
            }

            ObservableCollection <FacebookItem> items = new ObservableCollection <FacebookItem>();

            try
            {
                if (MyPerson.ReceivingAccount != null)
                {
                    dynamic parameters = new System.Dynamic.ExpandoObject();
                    dynamic result     = MyPerson.ReceivingAccount.facebookClient.Get(MyPerson.Id + "/feed", parameters); // User feed

                    if (result != null)
                    {
                        foreach (dynamic post in result.data)
                        {
                            FacebookItem item = FacebookItem.ConvertResponseToItem(post, MyPerson.ReceivingAccount);
                            backgroundWorkerRecentStatuses.ReportProgress(100, item);
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                AppController.Current.Logger.writeToLogfile("Retrieving recent tweets failed for " + MyPerson.FullName);
                AppController.Current.Logger.writeToLogfile(exp);
            }
        }
示例#2
0
    public void SetUpMailbox(List <FacebookAppRequest> appRequests)
    {
        foreach (Transform childTransform in this.Grid.transform)
        {
            Destroy(childTransform.gameObject);
        }

        foreach (FacebookAppRequest appRequest in appRequests)
        {
            string appDataTypeString = FacebookAppRequestDataParser.GetAppDataType(appRequest.Data);

            FacebookAppRequest.AppDataType appDataType = FacebookAppRequest.AppDataType.MonsterUnlock;

            // Ignore unknown types for future proofing
            if (appDataType.TryParse(appDataTypeString, out appDataType))
            {
                GameObject item = NGUITools.AddChild(this.Grid.gameObject, this.FacebookAcceptItem.gameObject);

                FacebookItem facebookItem = item.GetComponent <FacebookItem>();
                facebookItem.SetItem(appRequest);
                facebookItem.Grid = this.Grid;

                UIWidget widgetItem = item.GetComponent <UIWidget>();
                widgetItem.leftAnchor   = this.LeftAnchor;
                widgetItem.rightAnchor  = this.RightAnchor;
                widgetItem.topAnchor    = this.TopAnchor;
                widgetItem.bottomAnchor = this.BottomAnchor;
                widgetItem.ResetAnchors();
            }
        }

        this.Grid.Reposition();
    }
示例#3
0
        private void ButtoShowComments_Click(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                item.ShowComments = !item.ShowComments;
            }
        }
示例#4
0
        private void buttonLike_Click(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                item.LikeThisItem();
            }
        }
示例#5
0
        private void buttonComment_Click(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                UserInterface.Facebook.ComposeNewComment commentWindow = new UserInterface.Facebook.ComposeNewComment(item);
                commentWindow.Show();
            }
        }
示例#6
0
        private void ButtonUsername_Click(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                UserInterface.Facebook.ShowUser showUser = new UserInterface.Facebook.ShowUser();
                showUser.setUser(item.User);
                showUser.Show();
            }
        }
示例#7
0
        void backgroundWorkerRecentStatuses_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            FacebookItem item = (FacebookItem)e.UserState;

            if (item != null)
            {
                if (Items.Where(i => i.Id == item.Id).Count() == 0)
                {
                    Items.Add(item);
                }
            }
        }
示例#8
0
        private void contextMenuShowClientHomepage_Click_1(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                if (item.HasApplication)
                {
                    try
                    {
                        System.Diagnostics.Process.Start(item.ApplicationLink);
                    }
                    catch { }
                }
            }
        }
示例#9
0
        private void textblockCaption_MouseDown(object sender, MouseButtonEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                if (!string.IsNullOrEmpty(item.Link))
                {
                    try
                    {
                        System.Diagnostics.Process.Start(item.Link);
                    }
                    catch (Exception exp)
                    {
                        AppController.Current.Logger.writeToLogfile(exp);
                    }
                }
            }
        }
示例#10
0
        private void Image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                if (item.PictureLink != null)
                {
                    try
                    {
                        System.Diagnostics.Process.Start(item.PictureLink);
                    }
                    catch (Exception exp)
                    {
                        AppController.Current.Logger.writeToLogfile(exp);
                    }
                }
            }
        }
示例#11
0
        private void buttonApplication_Click(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                if (item.Application != null)
                {
                    if (!string.IsNullOrEmpty(item.Application.Link))
                    {
                        try
                        {
                            System.Diagnostics.Process.Start(item.Application.Link);
                        }
                        catch (Exception exp)
                        {
                            AppController.Current.Logger.writeToLogfile(exp);
                        }
                    }
                }
            }
        }
示例#12
0
        private void contextMenuFilterClient_Click_1(object sender, RoutedEventArgs e)
        {
            FacebookItem item = this.DataContext as FacebookItem;

            if (item != null)
            {
                if (item.HasApplication)
                {
                    try {
                        if (AppController.Current.AllFilters.Where(f => f.FilterString.ToLower() == item.ApplicationName.ToLower() && f.FilterClient).Count() > 0)
                        {
                            Filter existingFilter = AppController.Current.AllFilters.Where(f => f.FilterString.ToLower() == item.ApplicationName.ToString().ToLower() && f.FilterClient).First();
                            if (existingFilter != null)
                            {
                                if (!AppController.Current.CurrentView.subscribedFilter.Contains(existingFilter))
                                {
                                    AppController.Current.CurrentView.subscribeToFilter(existingFilter.Id);
                                }
                            }
                        }
                        else
                        {
                            Filter filter = new Filter();
                            filter.Name            = "Mute client " + item.ApplicationName;
                            filter.FilterString    = item.ApplicationName;
                            filter.FilterAuthor    = false;
                            filter.FilterClient    = true;
                            filter.FilterText      = false;
                            filter.IsExcludeFilter = true;
                            filter.FilterRetweeter = false;
                            AppController.Current.AllFilters.Add(filter);
                            AppController.Current.CurrentView.subscribeToFilter(filter.Id);
                        }
                    }
                    catch {}
                }
            }
        }
        public ComposeNewComment(FacebookItem fbItem)
        {
            InitializeComponent();

            item = fbItem;
            if (fbItem != null)
            {
                comboBoxAccount.comboBoxAccounts.SelectedItem = fbItem.Account;
            }
            try
            {
                textblockCommentedText.Text = "Comment on: " + fbItem.Text.Substring(0, Math.Min(200, fbItem.Text.Length)) + " ... by " + fbItem.AuthorName;
                if (AppController.Current.mainWindow.WindowState == System.Windows.WindowState.Normal)
                {
                    this.Top  = AppController.Current.mainWindow.Top + 5;
                    this.Left = AppController.Current.mainWindow.Left + 5;
                }
            }
            catch
            {
            }
            textBoxComment.Focus();
        }
示例#14
0
        private void filter_update()
        {
            ListOfItems.listView_Tweets.Items.Filter = delegate(object obj)
            {
                IItem item = obj as IItem;
                if (item != null)
                {
                    bool show_text = true;
                    bool show_type = true;

                    if (string.IsNullOrEmpty(filter_text))
                    {
                        show_text = true;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(item.Text) && !string.IsNullOrEmpty(item.AuthorName))
                        {
                            if (item.Text.ToLower().Contains(filter_text.ToLower()) || item.AuthorName.ToLower().Contains(filter_text.ToLower()))
                            {
                                AppController.Current.Logger.addDebugMessage("Item has been decided to be shown in text search", filter_text.ToLower(), type: DebugMessage.DebugMessageTypes.Display, item: item);
                                show_text = true;
                            }
                            else
                            {
                                AppController.Current.Logger.addDebugMessage("Item has been decided to be NOT shown in text search", filter_text.ToLower(), type: DebugMessage.DebugMessageTypes.Display, item: item);
                                show_text = false;
                            }
                        }
                        else
                        {
                            AppController.Current.Logger.addDebugMessage("Item has been decided to be NOT shown in filter", "Item text or AuthorName is null", type: DebugMessage.DebugMessageTypes.Display, item: item);
                            show_text = false;
                        }
                    }

                    if (!string.IsNullOrEmpty(filter_type))
                    {
                        if (filter_type.StartsWith("twitter"))
                        {
                            TwitterItem twitterItem = item as TwitterItem;
                            if (twitterItem == null)
                            {
                                show_type = false;
                            }
                            else
                            {
                                switch (filter_type)
                                {
                                case "twitterAll":
                                    show_type = true;
                                    break;

                                case "twitterTimeline":
                                    show_type = (!twitterItem.isDirectMessage && !twitterItem.isMention && !twitterItem.isRetweeted && !twitterItem.isSearchResult && !twitterItem.isList);
                                    break;

                                case "twitterMentions":
                                    show_type = twitterItem.isMention;
                                    break;

                                case "twitterDM":
                                    show_type = twitterItem.isDirectMessage;
                                    break;

                                case "twitterRetweets":
                                    show_type = twitterItem.isRetweeted;
                                    break;

                                case "twitterFavs":
                                    show_type = twitterItem.isFavorited;
                                    break;

                                case "twitterSearchResults":
                                    show_type = twitterItem.isSearchResult;
                                    break;

                                case "twitterListEntries":
                                    show_type = twitterItem.isList;
                                    break;

                                default:
                                    show_type = false;
                                    break;
                                }
                            }
                        }
                        else if (filter_type.StartsWith("apn"))
                        {
                            ApnItem apnItem = item as ApnItem;
                            if (apnItem == null)
                            {
                                show_type = false;
                            }
                            else
                            {
                                switch (filter_type)
                                {
                                case "apnAll":
                                    show_type = true;
                                    break;

                                case "apnPersonalStream":

                                    break;

                                case "apnMentions":
                                    show_type = apnItem.isMention;
                                    break;

                                case "apnPM":
                                    show_type = apnItem.isPrivateMessage;
                                    break;

                                case "apnReposts":
                                    show_type = apnItem.isReposted;
                                    break;

                                case "apnFavs":
                                    throw new NotImplementedException();
                                    break;

                                case "apnPhotos":
                                    show_type = apnItem.hasEmbeddedImages;
                                    break;

                                default:
                                    show_type = false;
                                    break;
                                }
                            }
                        }
                        else if (filter_type.StartsWith("fb"))
                        {
                            FacebookItem fbItem = item as FacebookItem;
                            if (fbItem == null)
                            {
                                show_type = false;
                            }
                            else
                            {
                                switch (filter_type)
                                {
                                case "fbAll":
                                    show_type = true;
                                    break;

                                case "fbStatusMessages":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.StatusMessage;
                                    break;

                                case "fbLinks":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.Link;
                                    break;

                                case "fbPhotos":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.Photo;
                                    break;

                                case "fbVideos":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.Video;
                                    break;

                                case "fbEvents":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.Event;
                                    break;

                                case "fbNotes":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.Note;
                                    break;

                                case "fbCheckIns":
                                    show_type = fbItem.MessageType == FacebookItem.MessageTypes.CheckIn;
                                    break;

                                default:
                                    show_type = false;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            show_type = false;
                        }
                    }
                    else
                    {
                        show_type = true;
                    }

                    return(show_text && show_type);
                }
                else
                {
                    AppController.Current.Logger.addDebugMessage("Item has been decided to be NOT shown in filter", "It is null", type: DebugMessage.DebugMessageTypes.Display, item: item);
                    return(false);
                }
            };
        }