void ResetItems(Control.ControlCollection controls, bool resetFile) { foreach (Control c in controls) { if (c is UserControl) { if (c is SpinnerControlValue) { SpinnerControlValue svc = (SpinnerControlValue)c; svc.isReset = true; svc.Reset(); if (svc.ValueTag == "framespeed") { svc.CurrentValue = 8; } } if (c is ComboBoxControlValue) { ComboBoxControlValue cbcv = (ComboBoxControlValue)c; cbcv.Reset(); } if (c is CheckBoxValue) { CheckBoxValue cbv = (CheckBoxValue)c; cbv.isReset = true; cbv.Reset(); } } if (c.Controls.Count > 0) { ResetItems(c.Controls, resetFile); } } nameControl.Text = ""; if (resetFile) { ///TODO: Reset the animator and NPC Name stuff. Along with the title and any other loose variables. npcfile.Clear(); // undoResetFlag(this.Controls); // hasChanges = false; curFile = null; } }
void undoResetFlag(Control.ControlCollection controls) { foreach (Control c in controls) { if (c is UserControl) { if (c is SpinnerControlValue) { SpinnerControlValue svc = (SpinnerControlValue)c; svc.isReset = false; } else if (c is CheckBoxValue) { CheckBoxValue cbv = (CheckBoxValue)c; cbv.isReset = false; } } if (c.Controls.Count > 0) { undoResetFlag(c.Controls); } } }