public static ObservableCollection <SessionTariff> LoadPriceFromXML(String fileName) { var collection = new ObservableCollection <SessionTariff>(); if (File.Exists(fileName)) { var pricesList = from price in XElement.Load(@fileName).Elements("price") select price; foreach (var pl in pricesList) { SessionTariff price = new SessionTariff { Name = pl.Attribute("name").Value, LimitedTimeMode = Boolean.Parse(pl.Attribute("mode").Value), CostPerHourGame = uint.Parse(pl.Attribute("costPerHourGame").Value), CostPerHourInternet = uint.Parse(pl.Attribute("costPerHourInternet").Value) }; collection.Add(price); } } return(collection); }
public SessionMessage(Nullable <DateTime> sessionStart, Nullable <DateTime> sessionExpire, SessionTariff tariff, Boolean isInternetSession, Boolean isPaused, Double totalPayment) { this.SessionStart = sessionStart; this.SessionExpire = sessionExpire; this.Tariff = tariff; this.IsInternetSession = isInternetSession; this.IsPaused = isPaused; this.TotalPayment = totalPayment; }