public TournamentSettingsViewModel(RWLigamodusViewModel parent) { _buttonCommands = new CommandHelper(buttonCommands); _parent = parent; _currentSettings = new TournamentSettings(); serializer = new XmlSerializer(typeof(TournamentSettings)); //load persistent settings if ((_actualSettings = this.loadSettings()) == null) { _actualSettings = new TournamentSettings(); _actualSettings.setDefaultVaules(this.Leagues[0], this.WeaponTypes[0]); } this.setCurrent(); }
public bool saveSettings(TournamentSettings settings) { FileStream file = new FileStream(SETTINGSPATH, FileMode.Create); try { serializer.Serialize(file, settings); file.Close(); } catch (Exception) { return false; } return true; }