private void SaveUserVariables() { variablesCopy = new BindingVariableList <ScenarioVariable <string>, string>(); listsCopy = new BindingVariableList <ScenarioVariable <string[]>, string[]>(); tablesCopy = new BindingVariableList <ScenarioTable, DataTable>(); foreach (ScenarioVariable <string> var in variables) { variablesCopy.Add(new ScenarioVariable <string>( var.Name, var.Value.ToString(), var.TestStep)); } foreach (ScenarioVariable <string[]> var in lists) { ICollection vals = var.Value as ICollection; string[] copyList = new string[vals.Count]; vals.CopyTo(copyList, 0); listsCopy.Add(new ScenarioVariable <string[]>( var.Name, copyList, var.TestStep)); } foreach (ScenarioTable var in tables) { DataTable table = var.Value as DataTable; DataTable copyTable = table.Copy(); tablesCopy.Add(new ScenarioTable( var.Name, copyTable, var.TestStep)); } }
private void ReloadUserVariables <TVar, TValue>(BindingVariableList <TVar, TValue> list, BindingVariableList <TVar, TValue> savedList) where TVar : ScenarioVariable <TValue> { list.RaiseListChangedEvents = false; list.Clear(); foreach (var variable in savedList) { list.Add(variable); } list.RaiseListChangedEvents = true; list.ResetBindings(); }