Ejemplo n.º 1
0
 void LoadData(Response_Posts data)
 {
     try
     {
         if (data != null)
         {
             MainGrid.DataSource = data.data;
             MainGrid.RefreshDataSource();
         }
     }catch (Exception ex)
     {
     }
 }
Ejemplo n.º 2
0
        void InitEvents()
        {
            cbChucNang.SelectedIndexChanged += (o, e) =>
            {
                lblError.Visible = false;
                try
                {
                    object         Result   = null;
                    FacebookClient fc       = new FacebookClient(Token);
                    var            request  = "";
                    var            selected = cbChucNang.SelectedItem as BoxItem;
                    if (selected != null)
                    {
                        switch (selected.MaChucNang)
                        {
                        case 1:
                            request = "https://graph.facebook.com/v3.3/me/groups?access_token=" + Token;
                            Result  = fc.Get(request).ToString();
                            Response_JoinedGroups response = JsonConvert.DeserializeObject <Response_JoinedGroups>(Result.ToString());
                            if (response != null)
                            {
                                usGroup usGroup = new usGroup(response);
                                usGroup.TopLevel = false;
                                usGroup.Dock     = DockStyle.Fill;
                                pnFill.Controls.Add(usGroup);
                                usGroup.BringToFront();
                                usGroup.Show();
                            }
                            break;

                        case 2:
                            request = "https://graph.facebook.com/v3.3/me/posts?access_token=" + Token;
                            Result  = fc.Get(request).ToString();
                            Response_Posts response_Posts = JsonConvert.DeserializeObject <Response_Posts>(Result.ToString());
                            if (response_Posts != null)
                            {
                                usPost usPosts = new usPost(response_Posts);
                                usPosts.TopLevel = false;
                                usPosts.Dock     = DockStyle.Fill;
                                pnFill.Controls.Add(usPosts);
                                usPosts.Show();
                            }
                            break;

                        case 3:
                            request = "https://graph.facebook.com/v3.3/me/feed?access_token=" + Token;
                            Result  = fc.Get(request).ToString();
                            Response_Posts response_Feed = JsonConvert.DeserializeObject <Response_Posts>(Result.ToString());
                            if (response_Feed != null)
                            {
                                usFeed usFeeds = new usFeed(response_Feed);
                                usFeeds.TopLevel = false;
                                usFeeds.Dock     = DockStyle.Fill;
                                pnFill.Controls.Add(usFeeds);
                                usFeeds.Show();
                            }
                            break;

                        case 4:
                            var client = new FacebookClient(Token);
                            Result = client.Get("/me/friends").ToString();

                            Response_Friends response_friend = JsonConvert.DeserializeObject <Response_Friends>(Result.ToString());
                            if (response_friend != null)
                            {
                                usFriend usFriend_ = new usFriend(response_friend);
                                usFriend_.TopLevel = false;
                                usFriend_.Dock     = DockStyle.Fill;
                                pnFill.Controls.Add(usFriend_);
                                usFriend_.Show();
                            }
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    lblError.Visible = true;
                    lblError.Text    = ex.Message;
                }
            };
            btnProcess.Click += (o, e) =>
            {
                try
                {
                }
                catch (Exception ex)
                {
                }
            };
            //gridView.DoubleClick += (o, e) =>
            //{
            //    DXMouseEventArgs ea = e as DXMouseEventArgs;
            //    GridView view = o as GridView;
            //    GridHitInfo info = view.CalcHitInfo(ea.Location);
            //    if (info.InRow || info.InRowCell)
            //    {
            //        try
            //        {


            //        }
            //        catch (Exception ex)
            //        {

            //        }
            //    }
            //};
        }
Ejemplo n.º 3
0
 //public List<ListBoxItem> Source { get { return MainGrid.DataSource as List<ListBoxItem>; } set { MainGrid.DataSource = value; MainGrid.RefreshDataSource(); } }
 public usFeed(Response_Posts data)
 {
     InitializeComponent();
     LoadData(data);
     InitEvents();
 }