Exemplo n.º 1
0
        private void Startup(object sender, EventArgs e)
        {
            var pe = new PEFileCollection();

            pe.PopulateCollectionWithStandardGFX();

            this.EIF = ItemFile.FromBytes(File.ReadAllBytes(Path.Combine(Environment.CurrentDirectory, "pub", "dat001.eif")));
            this.GFX = new NativeGraphicsManager(new NativeGraphicsLoader(pe));

            itemPillow = GFX.BitmapFromResource(GFXTypes.MapTiles, 0, true);

            flowItemPanel.HorizontalScroll.Enabled = false;
            flowItemPanel.HorizontalScroll.Visible = false;

            EOItemScrollBar.Padding             = new Padding(0);
            EOItemScrollBar.BorderColor         = Color.Transparent;
            EOItemScrollBar.DisabledBorderColor = Color.Transparent;

            panel2.Controls.Add(EOItemScrollBar);

            EOItemScrollBar.BringToFront();

            EOItemScrollBar.Maximum = flowItemPanel.VerticalScroll.Maximum;
            EOItemScrollBar.Minimum = flowItemPanel.VerticalScroll.Minimum;
            EOItemScrollBar.Height  = flowItemPanel.Height;

            EOItemScrollBar.Scroll += EOItemsScrollBar_Scroll;

            tabWeapons.PerformClick();

            // load your shop
            using (var wc = new WebClient()
            {
                Proxy = null
            })
            {
                var response = wc.DownloadString($"{APIEndpoint}/api/v1/index/username/{this.Username}");

                try
                {
                    var deserialized = JsonConvert.DeserializeObject <MarketIndexByUsernameRecord[]>(response);

                    this.CurrentShop = new Shop(deserialized, this.Username);
                }
                catch
                {
                    MessageBox.Show(response);
                }
            }
        }