예제 #1
0
        public SellItemDialogForm(MarketForm market, MarketRecord record, int amount)
        {
            InitializeComponent();

            this.Market = market;
            this.Item   = record;
            this.Amount = amount;
        }
예제 #2
0
        public string ReturnItem(MarketForm market, string username, int id, int amount, int price)
        {
            using (var wc = new WebClient()
            {
                Proxy = null
            })
            {
                wc.Headers = new WebHeaderCollection();
                wc.Headers.Set("password", this.ClientPassword);

                return(wc.DownloadString($"{APIEndpoint}/api/v1/request/return/{username}/{id}/{amount}/{price}"));
            }
        }
예제 #3
0
        public string PurchaseItem(MarketForm market, string buyer, string seller, int id, int amount, int price)
        {
            using (var wc = new WebClient()
            {
                Proxy = null
            })
            {
                wc.Headers = new WebHeaderCollection();
                wc.Headers.Set("password", this.ClientPassword);

                return(wc.DownloadString($"{APIEndpoint}/api/v1/request/purchase/{buyer}/{seller}/{id}/{amount}/{price}"));
            }
        }
예제 #4
0
        public Shop LoadShop(MarketForm market, string seller)
        {
            using (var wc = new WebClient()
            {
                Proxy = null
            })
            {
                var response = wc.DownloadString($"{APIEndpoint}/api/v1/index/username/{seller}");

                try
                {
                    var deserialized = JsonConvert.DeserializeObject <MarketRecord[]>(response);
                    return(new Shop(seller, deserialized));
                }
                catch
                {
                    MessageBox.Show($"Unable to complete request. (response: {response}");
                }
            }

            return(null);
        }