public StatisticsWindow(GameStatistics statistics) { InitializeComponent(); this.statistics = statistics; DataContext = statistics; }
private void LoadStatistics() { if (!File.Exists(fileName)) { Statistics = new GameStatistics(); return; } XmlSerializer deserializer = new XmlSerializer(typeof(GameStatistics)); using (TextReader reader = new StreamReader(fileName)) { Statistics = deserializer.Deserialize(reader) as GameStatistics; } }