/// <summary> /// Puts the mineral prices. /// </summary> private void PutMineralPrices() { textBoxPriceTritanium.Text = MineralList.Get("Tritanium").Price.ToString("F2"); textBoxPricePyerite.Text = MineralList.Get("Pyerite").Price.ToString("F2"); textBoxPriceMexallon.Text = MineralList.Get("Mexallon").Price.ToString("F2"); textBoxPriceIsogen.Text = MineralList.Get("Isogen").Price.ToString("F2"); textBoxPriceNocxium.Text = MineralList.Get("Nocxium").Price.ToString("F2"); textBoxPriceZydrine.Text = MineralList.Get("Zydrine").Price.ToString("F2"); textBoxPriceMegacyte.Text = MineralList.Get("Megacyte").Price.ToString("F2"); textBoxPriceMorphite.Text = MineralList.Get("Morphite").Price.ToString("F2"); }
/// <summary> /// Initializes a new instance of the <see cref="CalculatorForm"/> class. /// </summary> public CalculatorForm() { InitializeComponent(); comboStandTax.SelectedIndex = Config <Settings> .Instance.StandTaxe; pictureBoxTritanium.Tag = MineralList.Get("Tritanium"); textBoxPriceTritanium.Tag = MineralList.Get("Tritanium"); pictureBoxPyerite.Tag = MineralList.Get("Pyerite"); textBoxPricePyerite.Tag = MineralList.Get("Pyerite"); pictureBoxMexallon.Tag = MineralList.Get("Mexallon"); textBoxPriceMexallon.Tag = MineralList.Get("Mexallon"); pictureBoxIsogen.Tag = MineralList.Get("Isogen"); textBoxPriceIsogen.Tag = MineralList.Get("Isogen"); pictureBoxNocxium.Tag = MineralList.Get("Nocxium"); textBoxPriceNocxium.Tag = MineralList.Get("Nocxium"); pictureBoxZydrine.Tag = MineralList.Get("Zydrine"); textBoxPriceZydrine.Tag = MineralList.Get("Zydrine"); pictureBoxMegacyte.Tag = MineralList.Get("Megacyte"); textBoxPriceMegacyte.Tag = MineralList.Get("Megacyte"); pictureBoxMorphite.Tag = MineralList.Get("Morphite"); textBoxPriceMorphite.Tag = MineralList.Get("Morphite"); pictureBoxVeldspar.Tag = OreList.Get("Veldspar"); pictureBoxScordite.Tag = OreList.Get("Scordite"); pictureBoxPyroxeres.Tag = OreList.Get("Pyroxeres"); pictureBoxPlagioclase.Tag = OreList.Get("Plagioclase"); pictureBoxOmber.Tag = OreList.Get("Omber"); pictureBoxKernite.Tag = OreList.Get("Kernite"); pictureBoxJaspet.Tag = OreList.Get("Jaspet"); pictureBoxHemorphite.Tag = OreList.Get("Hemorphite"); pictureBoxHedbergite.Tag = OreList.Get("Hedbergite"); pictureBoxGneiss.Tag = OreList.Get("Gneiss"); pictureBoxDarkOchre.Tag = OreList.Get("Dark Ochre"); pictureBoxSpodumain.Tag = OreList.Get("Spodumain"); pictureBoxCrokite.Tag = OreList.Get("Crokite"); pictureBoxBistot.Tag = OreList.Get("Bistot"); pictureBoxArkonor.Tag = OreList.Get("Arkonor"); pictureBoxMercoxit.Tag = OreList.Get("Mercoxit"); PutMineralPrices(); histogram1.ShowLabels = true; histogram1.ShowValues = true; }
private void GetMineralsPricesFromEveCentral() { // Строки: URI и имя локального файла const string webAddress = "http://eve-central.com/api/evemon"; const string localAddress = "EveCentral.xml"; if(LoadXmlData(webAddress, localAddress)) { try { System.Globalization.NumberFormatInfo info = new System.Globalization.NumberFormatInfo { NumberDecimalSeparator = "." }; using(XmlTextReader reader = new XmlTextReader(localAddress)) { Mineral min = null; while(reader.Read()) { switch(reader.NodeType) { case XmlNodeType.Text: { if(min == null) min = MineralList.Get(reader.Value); else { min.Price = Convert.ToDouble(reader.Value, info); min = null; } break; } } } } } catch(XmlException) { } } }
/// <summary> /// Handles the Click event of the btnEveCentral control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BtnEveCentralClick(object sender, EventArgs e) { // Строки: URI и имя локального файла const string webAddress = "http://eve-central.com/api/evemon"; const string localAddress = "EveCentral.xml"; try { // Два объекта для получения информации о предполагаемом скачиваемом xml HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(webAddress); WebClient httpClient = new WebClient(); HttpWebResponse httpWResp = (HttpWebResponse)httpWReq.GetResponse(); // Проверяем, действительно ли по данному адресу находится xml //string type = httpWResp.ContentType.Substring(0, "text/xml".Length); //if (type == "text/xml") //{ // Скачиваем httpClient.DownloadFile(webAddress, localAddress); //} httpWResp.Close(); } catch (WebException ex) { MessageBox.Show(ex.Message); return; } try { System.Globalization.NumberFormatInfo info = new System.Globalization.NumberFormatInfo(); info.NumberDecimalSeparator = "."; using (XmlTextReader reader = new XmlTextReader(localAddress)) { Mineral min = null; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Text: { if (min == null) { min = MineralList.Get(reader.Value); } else { min.Price = Convert.ToDouble(reader.Value, info); min = null; } break; } } } } } catch (XmlException) { } PutMineralPrices(); }