/// <summary> /// Called after a cell has been edited. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvTaskSequenceVariables_CellEndEdit(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = dgvTaskSequenceVariables.Rows[e.RowIndex]; var varName = (string)row.Cells[0].Value; var varValue = (string)row.Cells[1].Value; if (e.ColumnIndex == 0) { if (!string.IsNullOrEmpty(varName)) { // Can't set variables that start with _ if (varName.StartsWith("_")) { MessageBox.Show(Resources.UnableToCreateVariabledWithUnderscore, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); row.Cells[0].Value = null; row.Cells[1].Value = null; return; } if (_taskSequenceDictionary.ContainsKey(varName)) { MessageBox.Show(Resources.VariableNameAlreadyExists, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); row.Cells[0].Value = null; row.Cells[1].Value = null; return; } } } // Only update if the name is valid if (!string.IsNullOrEmpty(varName)) { if (!string.IsNullOrEmpty(varValue)) { _taskSequenceDictionary[varName] = varValue; TaskSequence.SetVariable(varName, varValue); } else { _taskSequenceDictionary[varName] = ""; TaskSequence.SetVariable(varName, ""); } //VariablesDictionaryViewUpdate(); } }