示例#1
0
        void visualize2()
        {
            if (temppostList == null)
            {
                temppostList = postList1;
                drawDelegate = new DrawDelegate(drawLine);
                pictureBox1.Invoke(drawDelegate, 1, Color.FromArgb(50, 170, 160, 255), 400, 0, ymax - K * ymax / 4.0 - 200, xmax, ymax - K * ymax / 4.0 - 200);

                drawDelegate = new DrawDelegate(drawLine);
                pictureBox1.Invoke(drawDelegate, 1, Color.FromArgb(50, 255, 255, 255), 5, 0, ymax - ymax / 4.0, xmax, ymax - ymax / 4.0);


                drawStringDelegate = new DrawStringDelegate(drawString);
                pictureBox1.Invoke(drawStringDelegate, 1, "K=1", 15, 0, ymax - ymax / 4.0);
                drawStringDelegate = new DrawStringDelegate(drawString);
                pictureBox1.Invoke(drawStringDelegate, 1, "K=2", 15, 0, ymax - 2 * ymax / 4.0);
                drawStringDelegate = new DrawStringDelegate(drawString);
                pictureBox1.Invoke(drawStringDelegate, 1, "K=3", 15, 0, ymax - 3 * ymax / 4.0);
                drawStringDelegate = new DrawStringDelegate(drawString);
                pictureBox1.Invoke(drawStringDelegate, 1, "K=4", 15, 0, ymax - 4 * ymax / 4.0);
            }
            else
            {
                r = new Random();
                int inc = 1;
                //  var sortedGroupList = getSortedGroups(groupList);

                foreach (Group group in groupList)
                {
                    drawDelegate = new DrawDelegate(drawLine);
                    pictureBox1.Invoke(drawDelegate, 1, group.color, 20, xmax - 150, inc * 15, xmax - 100, inc * 15);

                    drawStringDelegate = new DrawStringDelegate(drawString);
                    pictureBox1.Invoke(drawStringDelegate, 1, group.name, 10, xmax - 100, inc * 15 - 10);

                    foreach (Post post in postList1)
                    {
                        if (post.K != 0 && group.domain == post.domain)
                        {
                            if (post.item.MarkedAsAds == 0)
                            {
                                foreach (Post tpost in temppostList)
                                {
                                    if (tpost.id == post.id && tpost.groupId == post.groupId)
                                    {
                                        drawDelegate = new DrawDelegate(drawLine);
                                        pictureBox1.Invoke(drawDelegate, 1, group.color, 1, tempX, ymax - tpost.K * ymax / 50.0, tempX + Xinterval, ymax - post.K * ymax / 50.0);
                                    }
                                }
                            }
                        }
                    }
                    inc++;
                }
                tempX        = tempX + Xinterval;
                temppostList = postList1;
            }
        }
示例#2
0
        void visualize()
        {
            int maxX = pictureBox3.Width;
            int maxY = pictureBox3.Height;
            int inc  = 1;
            int h    = 0;

            //  var sortedGroupList = getSortedGroups(groupList);
            foreach (Group group in groupList)
            {
                h = inc * 25;

                drawStringDelegate = new DrawStringDelegate(drawString);
                pictureBox3.Invoke(drawStringDelegate, 2, group.domain, 14, maxX - 650, h - 8);
                drawDelegate = new DrawDelegate(drawLine);
                pictureBox3.Invoke(drawDelegate, 2, Color.FromArgb(1, 50, 50, 50), 15, 0, h, maxX, h);
                double score1 = 0;
                double score2 = 0;
                double score3 = 0;
                int    inc1   = 0;
                int    inc2   = 0;
                int    inc3   = 0;
                foreach (Post post in postList1)
                {
                    if (!post.already_posted && post.K != 0 && group.domain == post.domain)
                    {
                        double x = Math.Pow(post.K / post.Wl, 1.0 / 3.0);
                        if (post.item.MarkedAsAds == 0 && x < 4)
                        {
                            if (x > 1 && x < 4)
                            {
                                score2 = score2 + ((x - 1) * (x - 1));
                                inc2++;
                            }
                            else
                            {
                                score3 = score3 + ((x - 1) * (x - 1));
                                inc3++;
                            }

                            score1 = score1 + ((x - 1) * (x - 1));
                            inc1++;

                            drawDelegate = new DrawDelegate(drawLine);
                            pictureBox3.Invoke(drawDelegate, 2, Color.FromArgb(100, 0, 255, 0), 13, x * maxX / 4.0 - 1, h, x * maxX / 4.0 + 1, h);
                        }
                    }
                }

                /*    score1 = Math.Sqrt(score1 / Convert.ToDouble(inc1));
                 *  drawDelegate = new DrawDelegate(drawLine);
                 *  pictureBox3.Invoke(drawDelegate,2, Color.Cyan, 15, (score1 + 1) * maxX / 4.0, h, 1 + (score1 + 1) * maxX / 4.0 + 4, h);       */

                score2       = Math.Sqrt(score2 / Convert.ToDouble(inc2));
                drawDelegate = new DrawDelegate(drawLine);
                pictureBox3.Invoke(drawDelegate, 2, Color.Purple, 13, (score2 + 1) * maxX / 4.0, h, 1 + (score2 + 1) * maxX / 4.0 + 4, h);

                score3       = Math.Sqrt(score3 / Convert.ToDouble(inc3));
                drawDelegate = new DrawDelegate(drawLine);
                pictureBox3.Invoke(drawDelegate, 2, Color.Red, 13, (1 - score3) * maxX / 4.0, h, 1 + (1 - score3) * maxX / 4.0 + 4, h);

                drawDelegate = new DrawDelegate(drawLine);
                pictureBox3.Invoke(drawDelegate, 2, Color.White, 13, (score2 / score3) * maxX / 4.0, h, 1 + (score2 / score3) * maxX / 4.0 + 4, h);


                drawDelegate = new DrawDelegate(drawLine);
                pictureBox3.Invoke(drawDelegate, 2, Color.White, 15, maxX / 4.0, h, maxX / 4.0 + 1, h);
                drawDelegate = new DrawDelegate(drawLine);
                pictureBox3.Invoke(drawDelegate, 2, Color.White, 15, 2 * maxX / 4.0, h, 2 * maxX / 4.0 + 1, h);
                drawDelegate = new DrawDelegate(drawLine);

                /* pictureBox3.Invoke(drawDelegate,2, Color.Yellow, 15, 3 * maxX / 4.0, h, 3 * maxX / 4.0 + 2, h);
                 * drawDelegate = new DrawDelegate(drawLine);
                 * pictureBox3.Invoke(drawDelegate,2, Color.Cyan, 15, 4 * maxX / 4.0, h, 4 * maxX / 4.0 + 2, h);  */
                inc++;
            }
            inc++;
            drawStringDelegate = new DrawStringDelegate(drawString);
            pictureBox3.Invoke(drawStringDelegate, 2, "K=1", 15, maxX / 4.0, h + 5);
            drawStringDelegate = new DrawStringDelegate(drawString);
            pictureBox3.Invoke(drawStringDelegate, 2, "K=2", 15, 2 * maxX / 4.0, h + 5);
            drawStringDelegate = new DrawStringDelegate(drawString);
            pictureBox3.Invoke(drawStringDelegate, 2, "K=3", 15, 3 * maxX / 4.0, h + 5);
            drawStringDelegate = new DrawStringDelegate(drawString);
            pictureBox3.Invoke(drawStringDelegate, 2, "K=4", 15, 4 * maxX / 4.0, h + 5);
        }
示例#3
0
        public void posting(object source, EventArgs e)
        {
            /*var now = DateTime.Now;
             * if (now.Hour > 11 || now.Hour < 4)
             * {    */
A:
            try
            {
                button5_Click("1", null);
                foreach (Post post in postList1)
                {
                    if (post.K != 0)
                    {
                        if (post.K > K)
                        {
                            if (post.item.PostSource.Data.ToString() != "Profile_photo" && post.item.MarkedAsAds == 0)
                            {
                                if (!check_for_repeat(post))
                                {
                                    string resp = API.posting(post);
                                    if (resp == "3")
                                    {
                                        delegatelog("REPEAT: " + post.groupId + "_" + post.id + " " + post.domain, Color.Red);
                                        drawStringDelegate = new DrawStringDelegate(drawString);
                                        pictureBox2.Invoke(drawStringDelegate, 1, "X", 5, tempX + Xinterval - 3, ymax - (post.K * ymax / 4.0) - 3);
                                    }
                                    if (resp == "2")
                                    {
                                        delegatelog("already posted: " + post.groupId + "_" + post.id + " " + post.domain, Color.Gray);
                                        drawStringDelegate = new DrawStringDelegate(drawString);
                                        pictureBox2.Invoke(drawStringDelegate, 1, "X", 5, tempX + Xinterval - 3, ymax - (post.K * ymax / 4.0) - 3);
                                    }
                                    if (resp[0] == '-')
                                    {
                                        delegatelog("API ERROR: " + post.groupId + "_" + post.id + " " + resp, Color.Red);
                                        drawStringDelegate = new DrawStringDelegate(drawString);
                                        pictureBox2.Invoke(drawStringDelegate, 1, "!", 8, tempX + Xinterval - 10, ymax - (post.K * ymax / 4.0) - 4);
                                    }
                                    if (resp == "1")
                                    {
                                        delegatelog("posted: " + post.groupId + "_" + post.id + " " + post.domain + DateTime.Now.ToString() + '\n' + "https://vk.com/public" + post.groupId + '\n' + "likes = " + post.hist.ElementAt(post.hist.Count - 1).likes.ToString() + ";" + '\n' + "AVG = " + post.AVG.ToString() + "; " + '\n' + "K = " + post.K.ToString() + '\n' + "Wl = " + post.Wl.ToString(), Color.Cyan);

                                        drawStringDelegate = new DrawStringDelegate(drawString);
                                        pictureBox2.Invoke(drawStringDelegate, 1, "O", 10, tempX + Xinterval - 10, ymax - (post.K * ymax / 4.0) - 5);

                                        drawStringDelegate = new DrawStringDelegate(drawString);
                                        pictureBox2.Invoke(drawStringDelegate, 1, post.groupId + "_" + post.id, 10, tempX + Xinterval - 30, ymax - (post.K * ymax / 4.0) - 10);


                                        break;
                                    }
                                }
                                else
                                {
                                    delegatelog("REPEAT: " + post.groupId + "_" + post.id, Color.Red);
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                delegatelog("ERROR: line 474: posting(object source, EventArgs e){...} ", Color.Red);
                goto A;
            }

            /*  }
            *  else
            *  {
            *     delegatelog("Zzz..", Color.Blue);
            *  }  */
        }