Ejemplo n.º 1
0
        private void bt_view_list_Click(object sender, EventArgs e)
        {
            //reset flpn_post
            flpn_post.Controls.Clear();

            foreach (Post p in post_Q)
            {
                //alloc new post panel and set data
                UserControl1 tmp = new UserControl1();
                tmp.SetProfile(pb_profile.Image);
                tmp.SetId(login_id);
                tmp.SetTime(new DateTimeConverter().ConvertToString(p.time));
                tmp.SetPic(new ImageConverter().ConvertFrom(p.picture) as Image);
                tmp.SetComment(p.comment);

                //add flpn_post
                flpn_post.Controls.Add(tmp);
            }
        }
Ejemplo n.º 2
0
        public void dragImg()
        {
            flowLayoutPanel1.Controls.Clear();
            UserControl1 uc = null;
            VerifyEntity ve = null;

            startIndex = (pageIndex - 1) * pageCount;
            endIndex   = pageIndex * pageCount;
            endIndex   = endIndex > libArr.Count ? libArr.Count : endIndex;
            for (int i = startIndex; i < endIndex; i++)
            {
                ve = (VerifyEntity)libArr[i];
                uc = new UserControl1();
                uc.SetText(ve.Code);
                uc.SetPic(ConfigStore.appDir + ve.ImgPath);
                uc.SetAttr1(ve.Data);
                flowLayoutPanel1.Controls.Add(uc);
            }
            label3.Text = "当前第" + pageIndex + "/" + allIndex + "页。共" + libArr.Count + "条记录";
            if (allIndex > 1 && pageIndex < allIndex)
            {
                btn_next.Enabled = true;
            }
            else
            {
                btn_next.Enabled = false;
            }

            if (pageIndex > 1)
            {
                btn_per.Enabled = true;
                button1.Enabled = true;
            }
            else
            {
                btn_per.Enabled = false;
                button1.Enabled = false;
            }
        }
Ejemplo n.º 3
0
        public void dragImg()
        {
            flowLayoutPanel1.Controls.Clear();
            UserControl1 uc = null;
            VerifyEntity ve = null;
            startIndex = (pageIndex - 1) * pageCount;
            endIndex = pageIndex * pageCount;
            endIndex = endIndex > libArr.Count ? libArr.Count : endIndex;
            for (int i = startIndex; i < endIndex; i++)
            {
                ve = (VerifyEntity)libArr[i];
                uc = new UserControl1();
                uc.SetText(ve.Code);
                uc.SetPic(ConfigStore.appDir + ve.ImgPath);
                uc.SetAttr1(ve.Data);
                flowLayoutPanel1.Controls.Add(uc);
            }
            label3.Text = "当前第" + pageIndex + "/" + allIndex + "页。共" + libArr.Count + "条记录";
            if (allIndex > 1 && pageIndex < allIndex)
            {
                btn_next.Enabled = true;
            }
            else
            {
                btn_next.Enabled = false;
            }

            if (pageIndex > 1)
            {
                btn_per.Enabled = true;
                button1.Enabled = true;
            }
            else
            {
                btn_per.Enabled = false;
                button1.Enabled = false;
            }
        }
Ejemplo n.º 4
0
        private void load_home()
        {
            //reset post_Q & map& flpn_home
            this.post_Q.Clear();
            this.map.Clear();
            flpn_home.Controls.Clear();

            //set request packet to server
            this.post         = new Post();
            this.post.Type    = (int)PacketType.post;
            this.post.purpose = 2;

            //send request packet to server
            Packet.Serialize(this.post).CopyTo(w_buffer, 0);
            this.send();

            Thread.Sleep(5000);

            //receive packet until end
            while (this.stream.DataAvailable)
            {
                //receive result packet from server
                //if error occur during prepare stream & r_buffer
                if (!preparing_receive())
                {
                    return;
                }

                Packet packet = (Packet)Packet.Deserialize(this.r_buffer);

                switch (packet.Type)
                {
                //if receive Member packet
                case (int)PacketType.member:
                {
                    this.member = (Member)Packet.Deserialize(this.r_buffer);

                    if (this.member.purpose == 5)
                    {
                        try
                        {
                            map.Add(this.member.ID, new ImageConverter().ConvertFrom(this.member.profile_pic) as Image);
                        }
                        catch (ArgumentException e)
                        {
                            MessageBox.Show(string.Format("duplicate id when input data map... id : {0}", this.member.ID));
                        }
                    }
                }
                break;

                //if receive Post packet
                case (int)PacketType.post:
                {
                    this.post = (Post)Packet.Deserialize(this.r_buffer);

                    if (this.post.purpose == 2)
                    {
                        this.post_Q.Enqueue(this.post);
                    }
                }
                break;
                }
            }

            //add post at flpn_home
            foreach (Post p in post_Q)
            {
                //alloc new post panel and set data
                UserControl1 tmp = new UserControl1();
                tmp.SetProfile(map[p.ID]);
                tmp.SetId(p.ID);
                tmp.SetPic(new ImageConverter().ConvertFrom(p.picture) as Image);
                tmp.SetComment(p.comment);
                tmp.SetTime(new DateTimeConverter().ConvertToString(p.time));

                //add flpn_post
                flpn_home.Controls.Add(tmp);
            }
        }