public void Add(IZeusInput input) { foreach (string varName in input.Keys) { InputItem item; try { item = new InputItem(varName, input[varName]); _hash[varName] = new InputItem(varName, input[varName]); } catch (Exception ex) { // This will happen if an unserializable type is in the input collection. _hash[varName] = ex.Message; } } }
public void Add(IZeusInput input) { foreach (string varName in input.Keys) { InputItem item; try { item = new InputItem(varName, input[varName]); _hash[varName] = new InputItem(varName, input[varName]); } catch (Exception ex) { // This will happen if an unserializable type is in the input collection. _hash[varName] = ex.Message; } } }
public string ReadXML(XmlTextReader xr) { string tagName; bool inStartElement; this._savedObjectName = xr.GetAttribute("name"); this._templateUniqueID = xr.GetAttribute("uid"); this._templatePath = xr.GetAttribute("path"); while (xr.Read()) { inStartElement = xr.IsStartElement(); tagName = xr.LocalName; if (inStartElement) { // a module start if (tagName == "item") { InputItem item = new InputItem(); item.ReadXML(xr); this.InputItems.Add(item); } } else { // if not in a sub object and this is an end object tag, break! if (tagName == "obj") { break; } } } xr.Read(); inStartElement = xr.IsStartElement(); tagName = xr.LocalName; return(tagName); }
public string ReadXML(XmlTextReader xr) { string tagName; bool inStartElement; this._savedObjectName = xr.GetAttribute("name"); this._templateUniqueID = xr.GetAttribute("uid"); this._templatePath = xr.GetAttribute("path"); while (xr.Read()) { inStartElement = xr.IsStartElement(); tagName = xr.LocalName; if (inStartElement) { // a module start if (tagName == "item") { InputItem item = new InputItem(); item.ReadXML(xr); this.InputItems.Add(item); } } else { // if not in a sub object and this is an end object tag, break! if (tagName == "obj") { break; } } } xr.Read(); inStartElement = xr.IsStartElement(); tagName = xr.LocalName; return tagName; }
private void buttonOK_Click(object sender, System.EventArgs e) { CancelEventArgs args = new CancelEventArgs(); this.textBoxName_Validating(this, args); if (!args.Cancel) { this.Module.Name = this.textBoxName.Text; if (this.textBoxDescription.Text.Length > 0) { this.Module.Description = this.textBoxDescription.Text; } this.Module.DefaultSettingsOverride = this.checkBox1.Checked; this.Module.UserSavedItems.Clear(); foreach (DataGridViewRow r in dataGridViewUserData.Rows) { if (r.Cells.Count >= 2) { string key = r.Cells[0].Value as string; string val = r.Cells[1].Value as string; if (!string.IsNullOrEmpty(key)) { InputItem item = new InputItem(); if (string.IsNullOrEmpty(val)) val = string.Empty; item.VariableName = key.Trim(); item.Data = val.Trim(); item.DataType = typeof(String); _module.UserSavedItems[key] = item; } } } ArrayList keys = new ArrayList(); ArrayList keysToDelete = new ArrayList(); foreach (DataGridViewRow r in dataGridViewCache.Rows) { if (r.Cells.Count >= 2) { string key = r.Cells[0].Value as string; if (!string.IsNullOrEmpty(key)) { keys.Add(key); } } } foreach (InputItem item in this._module.SavedItems) { if (!keys.Contains(item.VariableName)) { keysToDelete.Add(item.VariableName); } } foreach (string varname in keysToDelete) { this.Module.SavedItems.Remove(varname); } this.DialogResult = DialogResult.OK; this.Close(); } }
public void Remove(InputItem item) { _hash.Remove(item.VariableName); }
public void Add(InputItem item) { this._hash[item.VariableName] = item; }
public void Remove(InputItem item) { _hash.Remove(item.VariableName); }
public void Add(InputItem item) { this._hash[item.VariableName] = item; }