void initializationOfTheFlats() { flat1 = new Flat(heat1.Text.Replace('.', ','), yardCleaning1.Text.Replace('.', ','), gas1.Text.Replace('.', ','), trash1.Text.Replace('.', ','), electricity1.Text.Replace('.', ','), intercom1.Text.Replace('.', ','), hotWater1LastMonth.Text, hotWater1Currently.Text, coldWater1LastMonth.Text, coldWater1Currently.Text); flat2 = new Flat(heat2.Text.Replace('.', ','), yardCleaning2.Text.Replace('.', ','), gas2.Text.Replace('.', ','), trash2.Text.Replace('.', ','), electricity2.Text.Replace('.', ','), intercom2.Text.Replace('.', ','), hotWater2LastMonth.Text, hotWater2Currently.Text, coldWater2LastMonth.Text, coldWater2Currently.Text); }
void GetLastMonthValues() { try { using (Stream inputForFlat1 = File.OpenRead("flat1.dat")) { BinaryFormatter formatter1 = new BinaryFormatter(); flat1 = (Flat)formatter1.Deserialize(inputForFlat1); } using (Stream inputForFlat2 = File.OpenRead("flat2.dat")) { BinaryFormatter formatter2 = new BinaryFormatter(); flat2 = (Flat)formatter2.Deserialize(inputForFlat2); } updateForm(); } catch { SetLastMonthValues(); } }