コード例 #1
0
ファイル: main_menu.cs プロジェクト: ykcycvl/Zeus2013
        private void LoadTop5(int inches)
        {
            TimerEnabled = false;
            LoadGroups();

            try
            {
                zeus.HelperClass.zMainMenuForm frm = Ipaybox.ifc.systemForms.Find(p => p.name == "main_menu").top;
                int count        = frm.count;
                int startx       = int.Parse(frm.startPos.Split(';')[0]);
                int starty       = int.Parse(frm.startPos.Split(';')[1]);
                int inline_count = frm.hcount;
                int dx           = frm.dx;
                int dy           = frm.dy;

                for (int i = 0; i < frm.buttons.Count; i++)
                {
                    Ipaybox.AddButton(frm.buttons[i], ref pics[pb_count], this, new EventHandler(this.Pic_Click));
                    pb_count++;
                }

                for (int i = 0; i < frm.banners.Count; i++)
                {
                    Ipaybox.AddBanner(frm.banners[i], this, new EventHandler(this.Pic_Click));
                    //AddFlash(frm.banners[i], this, new EventHandler(this.Pic_Click));
                }

                XmlElement root = (XmlElement)Ipaybox.config.DocumentElement.SelectSingleNode("top");

                if (root == null)
                {
                    root = (XmlElement)Ipaybox.config.DocumentElement.SelectSingleNode("top5");
                }

                int x = startx, y = starty;
                int count1 = 0;

                for (int i = 0; i < root.ChildNodes.Count; i++)
                {
                    if (i >= count)
                    {
                        break;
                    }

                    XmlElement row = (XmlElement)root.ChildNodes[i];

                    if (row.Name == "prv")
                    {
                        string id  = row.GetAttribute("id");
                        string img = Ipaybox.GetImageFromInterface_Prv(id);

                        if (img == "")
                        {
                            break;
                        }

                        CreateNewProvider(img, x, y, id, new Size());
                        x += dx;
                        count1++;

                        if (count1 > inline_count - 1)
                        {
                            x      = startx;
                            y     += dy;
                            starty = y;
                            count1 = 0;
                        }
                    }
                    else
                    {
                        if (row.Name == "group")
                        {
                            string id  = "group-" + row.GetAttribute("id");
                            string img = Ipaybox.GetImageFromInterface_Group(row.GetAttribute("id"));

                            if (img == "")
                            {
                                break;
                            }

                            CreateNewProvider(img, x, y, id, new Size());
                            x += dx;
                            count1++;

                            if (count1 > inline_count - 1)
                            {
                                x      = startx;
                                y     += dy;
                                starty = y;
                                count1 = 0;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Ipaybox.Working = false;
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "LoadTop5. " + ex.Message);
            }
        }