/// <summary> /// Save the settings /// </summary> /// <param name="sender">The object that raised the event</param> /// <param name="e">The event arguments</param> /// <history> /// <Created 1 May 2014>Arun Gopinath</Created> /// <Modified 1 May 2014></Modified> /// </history> private void ButtonPressEvent_SaveProblemSetDefault ( object sender, EventArgs e ) { Operation operation; bool allowNegNum = cbxAdditionAllowNegative.Checked; bool allowNegAns = cbxSubtractionAllowNegativeAnswers.Checked; bool allowWholeNum = cbxDivisionWholeNumberAnswers.Checked; double goal = 0.0; errorProviderProblemSettings.Clear (); if ( ValidateUserEntry () == false ) return; if (rdoAddOperation.Checked) operation = Operation.Addition; else if (rdoSubOperation.Checked) operation = Operation.Subtraction; else if (rdoMultOperation.Checked) operation = Operation.Multiplication; else if (rdoDivOperation.Checked) operation = Operation.Division; else operation = Operation.None; double.TryParse ( txtDefaultGoal.Text, out goal ); if ( txtDefaultGoal.Text == "" || goal <= 0 ) { txtDefaultGoal.Text = "0"; } else if ( goal > 100 ) { txtDefaultGoal.Text = "100"; } CtrlAdmin.structProblemSetDefaults psDefaults = new CtrlAdmin.structProblemSetDefaults(); psDefaults.numPrbs = txtDefaultNumberOfProblems.Text; psDefaults.numAttempts = ( int )nudDefaultNumberOfAttempts.Value; psDefaults.goal = txtDefaultGoal.Text; psDefaults.operation = operation; psDefaults.allowNO = cbxAdditionAllowNegative.Checked; psDefaults.allowNA = cbxSubtractionAllowNegativeAnswers.Checked; psDefaults.wholeNA = cbxDivisionWholeNumberAnswers.Checked; control.SaveProblemSetDefaults ( psDefaults ); control.ButtonVisualEffect ( pnlSave ); }
/// <summary> /// Loads the settings Form /// </summary> /// <param name="sender">The object that raised the event</param> /// <param name="e">The event arguments</param> /// <history> /// <Created 1 May 2014>Arun Gopinath</Created> /// <Modified 1 May 2014></Modified> /// </history> private void LoadEvent_ProblemSetDefaultForm ( object sender, EventArgs e ) { CtrlAdmin.structProblemSetDefaults psDefaults = new CtrlAdmin.structProblemSetDefaults (); psDefaults = control.GetProblemSetDefaults (); txtDefaultNumberOfProblems.Text = psDefaults.numPrbs; nudDefaultNumberOfAttempts.Value = psDefaults.numAttempts; txtDefaultGoal.Text = psDefaults.goal; ResetDefaultScreenOperationGroup (); SetDefaultScreenOperation ( psDefaults.operation ); cbxAdditionAllowNegative.Checked = psDefaults.allowNO; cbxSubtractionAllowNegativeAnswers.Checked = psDefaults.allowNA; cbxDivisionWholeNumberAnswers.Checked = psDefaults.wholeNA; control.DisableShortcutsForInputFields ( this ); errorProviderProblemSettings.Clear (); }