Ejemplo n.º 1
0
        private async Task InitPanels()
        {
            relics.Clear();
            pnlRelics.Controls.Clear();
            pnlRelics.AutoScroll           = false;
            pnlRelics.VerticalScroll.Value = 0;
            Status("Initializing Relics");
            String value_type = "avg_price";

            switch (cmbPlatSource.SelectedIndex)
            {
            case 1:
                value_type = "min_price";
                break;

            case 2:
                value_type = "max_price";
                break;
            }

            for (int i = 0; i < dh.relics.Count; ++i)
            {
                Panel panel = new Panel();
                panel.Size     = new Size(1050, 50);
                panel.Location = new Point(0, 50 * i);
                Relic r = dh.relics[i];

                Label name = new Label();
                name.Text     = r.GetName();
                name.Location = new Point(10, 25);
                panel.Controls.Add(name);

                List <float> values = new List <float>();
                for (int j = 0; j < 6; ++j)
                {
                    String iname  = r.GetItemName(j);
                    Label  liname = new Label();
                    liname.Text     = iname;
                    liname.Location = new Point(10 + 150 * (j + 1), 10);
                    liname.AutoSize = true;
                    panel.Controls.Add(liname);

                    Label plat  = new Label();
                    float value = await dh.GetItemPrice(iname, value_type);

                    values.Add(value);
                    plat.Text     = value.ToString("N2") + " Plat";
                    plat.Location = new Point(10 + 150 * (j + 1), 35);
                    plat.AutoSize = true;
                    panel.Controls.Add(plat);
                }
                relics.Add(new Tuple <Panel, List <float> >(panel, values));
                pnlRelics.Controls.Add(panel);
            }
            SortPanels();
        }
Ejemplo n.º 2
0
        private void UpdateRelicPanel(GroupBox gb, int cmbIndex)
        {
            Relic r = dh.relics[cmbIndex];

            foreach (Control p in gb.Controls)
            {
                Label  min = null, max = null, avg = null;
                String name = "";
                foreach (Control c in p.Controls)
                {
                    name = r.GetItemName(int.Parse(p.Tag.ToString()));
                    switch (c.Tag)
                    {
                    case "name":
                        c.Text = name;
                        break;

                    case "min":
                        min = (Label)c;
                        break;

                    case "max":
                        max = (Label)c;
                        break;

                    case "avg":
                        avg = (Label)c;
                        break;

                    case "pb":
                        UpdateThumbnail((PictureBox)c, name);
                        break;
                    }
                }
                UpdateValue(name, min, max, avg);
            }
        }