BF2Statistics.MedalData.ScoreStatForm.Save C# (CSharp) Method

Save() public method

Converts the data in the form into a condition, and closes the form
public Save ( ) : void
return void
        public void Save()
        {
            // Tell the base condition form that we modifed the condition
            base.Canceled = false;

            // First param is always the python method name
            List<string> Params = new List<string>();

            // 1st param
            Params.Add( (StatType.SelectedIndex == 1) ? "player_stat" : "global_stat" );

            // 2nd param
            KeyValuePair I = (KeyValuePair)StatName.SelectedItem;
            Params.Add(I.Key);

            // 3rd Param (optional)
            if (ValueBox.Visible)
                Params.Add(((int)ValueBox.Value).ToString());

            // Create the new Stat Object
            if (Obj == null)
                Obj = new PlayerStat(Params);
            else
                Obj.SetParams(Params);

            // Close the form
            this.Node.Tag = Obj;
            MedalDataEditor.ChangesMade = true;
            this.DialogResult = DialogResult.OK;
        }