Пример #1
0
        private void resetLabels()
        {
            ParseResults results = new ParseResults();

            updateBuyLabel(ref results);
            updateSellLabel(ref results);
            updateVolumeStacksLabel(ref results);
            updateCopyUrlButton(ref results);
        }
Пример #2
0
 private void updateCopyUrlButton(ref ParseResults results)
 {
     if (results.Success)
     {
         copyUrl.Enabled   = true;
         copyUrl.BackColor = Color.OrangeRed;
     }
     else
     {
         copyUrl.Enabled   = false;
         copyUrl.BackColor = Color.LightGray;
     }
 }
Пример #3
0
 private void updateLabels(ref ParseResults results)
 {
     if (results.Success)
     {
         updateBuyLabel(ref results);
         updateSellLabel(ref results);
         updateVolumeStacksLabel(ref results);
         updateCopyUrlButton(ref results);
     }
     else
     {
         resetLabels();
     }
 }
Пример #4
0
        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());
        }
Пример #5
0
 private void reset()
 {
     LastParseResult = new ParseResults();
 }
Пример #6
0
 private void updateSellLabel(ref ParseResults results)
 {
     lblSell.Text = String.Format("{0} Sell", results.SellValue);
 }
Пример #7
0
 private void updateBuyLabel(ref ParseResults results)
 {
     lblBuy.Text = String.Format("{0} Buy", results.BuyValue);
 }
Пример #8
0
 private void updateVolumeStacksLabel(ref ParseResults results)
 {
     lblVolumeStacks.Text = String.Format("{0} stacks / {1} m3", results.Stacks, results.Volume);
 }
Пример #9
0
        private async void clipboardMonitor1_ClipboardChanged(object sender, ClipboardChangedEventArgs e)
        {
            ParseResults results = await parser.Parse(Clipboard.GetText());

            updateLabels(ref results);
        }