public IEnumerable <Sample> Read(StreamReader stream) { var results = new List <Sample>(); var line = stream.ReadLine(); while (string.IsNullOrEmpty(line) == false) { var parts = line.Split(';'); var date = DateTimeOffset.Parse(parts[0]); var result = MassValue.Parse(parts[1]); var sample = new Sample(date, result); results.Add(sample); line = stream.ReadLine(); } return(results); }
/// <summary> /// Resets and refreshes the labels during gameplay /// </summary> private void ResetLabels() { // Set label values if (world.cubes.ContainsKey(playerId)) { FPSValue.Text = "" + fps[0]; FoodValue.Text = "" + world.foodCount; MassValue.Text = "" + (int)world.cubes[playerId].Mass; WidthValue.Text = "" + (int)world.cubes[playerId].width; } // Refresh all the labels FPSLabel.Refresh(); FPSValue.Refresh(); FoodLabel.Refresh(); FoodValue.Refresh(); MassLabel.Refresh(); MassValue.Refresh(); WidthLabel.Refresh(); WidthValue.Refresh(); }
private void OKButton_Click(object sender, EventArgs e) { try { Price = PriceValue; Count = Count - CountValue; Summ = Summ - SummValue; CratesCount = CratesCount - CratesCountBalue; Mass = Mass - MassValue; if (!File.Exists(Application.StartupPath + "//Raw.Residue.Data.xml")) { General.ShowErrorBox("Список продуктов сырья отсутствует!\nВозможно была потеря данных, обратитесь к администрации программы!"); } else { XmlDocument xDoc = new XmlDocument(); xDoc.Load(Application.StartupPath + "//Raw.Residue.Data.xml"); XmlElement xRoot = xDoc.DocumentElement; XmlNode childnode = xRoot.SelectSingleNode(String.Format("RawResidue[Имя='{0}']", titlebox.Text)); if (childnode != null) { XmlNode nameChildNode = childnode.SelectSingleNode("Имя"); string elemNameStr = "NONE"; if (nameChildNode != null) { elemNameStr = nameChildNode.InnerText; XmlNode massElem = childnode.SelectSingleNode("Масса"); XmlNode countElem = childnode.SelectSingleNode("Количество"); XmlNode cratesElem = childnode.SelectSingleNode("КоличествоКаробок"); XmlNode pricesElem = childnode.SelectSingleNode("Цена"); XmlNode summElem = childnode.SelectSingleNode("Сумма"); if (massElem != null && countElem != null && cratesElem != null && pricesElem != null && summElem != null) { massElem.InnerText = Mass.ToString(); countElem.InnerText = Count.ToString(); cratesElem.InnerText = CratesCount.ToString(); pricesElem.InnerText = Price.ToString(); summElem.InnerText = Summ.ToString(); } } } xDoc.Save(Application.StartupPath + "//Raw.Residue.Data.xml"); } /* * General.UpdateCellData("RawMaterialsResidue", "Цена", Price.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "Количество", Count.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "КоличествоКаробок", CratesCount.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "Масса", Mass.ToString().Replace(",", "."), Convert.ToInt32(ID)); * General.UpdateCellData("RawMaterialsResidue", "Сумма", Summ.ToString().Replace(",", "."), Convert.ToInt32(ID)); */ Date = DateControl.Value.ToString(); if (ProviderTextBox.Text != null) { Provider = ProviderTextBox.Text; } if (RecipientTextBox.Text != null) { Recipient = RecipientTextBox.Text; } RemovedRawMaterialsForm RRMF = new RemovedRawMaterialsForm(); RRMF.InsertRecords(titlebox.Text, MassValue.ToString().Replace(",", "."), PriceValue.ToString().Replace(",", "."), CountValue.ToString().Replace(",", "."), CratesCountBalue.ToString().Replace(",", "."), SummValue.ToString().Replace(",", "."), Date, Provider, Recipient); RRMF.ShowDialog(this); this.Close(); } catch (Exception) { } }