/// <summary> /// Configure a control with the configuration node path /// </summary> /// <param name="object_guid"></param> /// <param name="config_path"></param> public void ConfigureControl(String control_guid, params String[] config_path) { CtrlStruct cStr = getCtrlStruct(control_guid); JToken jConfig = cStr.config; foreach (String cfg_node in config_path) { jConfig = jConfig[cfg_node]; } object o = cStr.ctrl; set_properties(ref o, jConfig); }
/// <summary> /// Destroy current view with her controls /// </summary> public void Free() { FLAG_VISTA_ACTIVA = 2; recursively_remove_controls(mainControl()); while (ctrls.Keys.Count > 0) { CtrlStruct ctrlstr = ctrls.Values.ElementAt(0); RemoveControl(ctrlstr.control_name); } vars.Clear(); }
/// <summary> /// Remove all controls from controls struct with that guid /// </summary> /// <param name="control_guid"></param> public void RemoveControl(String control_guid) { if (ctrls.Keys.Contains(control_guid)) { // get first control with that guid CtrlStruct cstr = ctrls[control_guid]; // clear vars cstr.vars.Clear(); // remove it from parent control if (cstr.ctrl is Form) { ((Form)cstr.ctrl).Close(); } cstr.ctrl.Dispose(); // remove from controls struct ctrls.Remove(control_guid); } }
/// <summary> /// Remove all controls from controls struct with that guid /// </summary> /// <param name="control_guid"></param> public void RemoveControl(String control_guid) { if (ctrls.Keys.Contains(control_guid)) { // get first control with that guid CtrlStruct cstr = ctrls[control_guid]; // clear vars cstr.vars.Clear(); // remove it from parent control Control cparent = cstr.ctrl.Parent; if (cparent != null) { cparent.Controls.Remove(cstr.ctrl); } // remove from controls struct ctrls.Remove(control_guid); } }