private void resetLabels() { ParseResults results = new ParseResults(); updateBuyLabel(ref results); updateSellLabel(ref results); updateVolumeStacksLabel(ref results); updateCopyUrlButton(ref results); }
private void updateCopyUrlButton(ref ParseResults results) { if (results.Success) { copyUrl.Enabled = true; copyUrl.BackColor = Color.OrangeRed; } else { copyUrl.Enabled = false; copyUrl.BackColor = Color.LightGray; } }
private void updateLabels(ref ParseResults results) { if (results.Success) { updateBuyLabel(ref results); updateSellLabel(ref results); updateVolumeStacksLabel(ref results); updateCopyUrlButton(ref results); } else { resetLabels(); } }
public async Task <ParseResults> Parse(string clip) { reset(); if (clip.Contains("\n")) { using (var client = new HttpClient()) { var vals = new Dictionary <string, string> { { "raw_paste", clip }, { "load_full", "1" }, { "market", "30000142" } }; HttpResponseMessage response = await client.PostAsync("http://www.evepraisal.com/estimate", new FormUrlEncodedContent(vals)); var responseString = await response.Content.ReadAsStringAsync(); List <string> buySell = parseBuySell(responseString); string volume = parseVolume(responseString); string url = parseUrl(responseString); int stacks = parseStacks(clip); bool success = false; if (!string.IsNullOrWhiteSpace(volume)) { success = true; } LastParseResult = new ParseResults(buySell[0], buySell[1], url, volume, stacks, success); return(LastParseResult); } } return(new ParseResults()); }
private void reset() { LastParseResult = new ParseResults(); }
private void updateSellLabel(ref ParseResults results) { lblSell.Text = String.Format("{0} Sell", results.SellValue); }
private void updateBuyLabel(ref ParseResults results) { lblBuy.Text = String.Format("{0} Buy", results.BuyValue); }
private void updateVolumeStacksLabel(ref ParseResults results) { lblVolumeStacks.Text = String.Format("{0} stacks / {1} m3", results.Stacks, results.Volume); }
private async void clipboardMonitor1_ClipboardChanged(object sender, ClipboardChangedEventArgs e) { ParseResults results = await parser.Parse(Clipboard.GetText()); updateLabels(ref results); }