コード例 #1
0
        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();
        }
コード例 #2
0
        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;
        }