public static List <KeyValuePair <string, string> > GetVariables() { List <KeyValuePair <string, string> > vars = new List <KeyValuePair <string, string> >(); if (_dgRowsSingelton != null) { foreach (DataGridViewRow row in _dgRowsSingelton) { if (!row.DataGridView.Enabled) { return(vars); } if (row.IsNewRow) { continue; } object name = row.Cells["VariableName"].Value; object value = row.Cells["VariableValue"].Value; if (!string.IsNullOrEmpty(row.Cells["VariableName"].ErrorText) || !string.IsNullOrEmpty(row.Cells["VariableValue"].ErrorText)) { EnvironmentFileHandler.AddNotification( "The variables datagrid has still invalid or missing values."); } if (name != null && value != null) { vars.Add(new KeyValuePair <string, string>(name.ToString(), value.ToString())); } } vars.Sort((x, y) => String.Compare(x.Key, y.Key, StringComparison.Ordinal)); } return(vars); }
public string GetValidatedValue() { Validate(); if (!IsValid) { EnvironmentFileHandler.AddNotification(string.Format("The {0} has still invalid or missing values.", SaveErrorFieldDesc)); return(""); //throw new InvalidExpressionException(string.Format("The {0} has still invalid or missing values.", // SaveErrorFieldDesc)); } return(_controlToValidate.Text.Trim()); }
internal Dictionary <string, object>[] GetRows() { ArrayList list = new ArrayList(); if (dataGrid_Solutions.Enabled) { foreach (DataGridViewRow dgRow in dataGrid_Solutions.Rows) { if (dgRow.IsNewRow) { continue; } Dictionary <string, object> row = new Dictionary <string, object>(); DataGridViewCellCollection cells = dgRow.Cells; if (!string.IsNullOrEmpty(cells["SolutionName"].ErrorText) || !string.IsNullOrEmpty(cells["SolutionType"].ErrorText) || !string.IsNullOrEmpty(cells["SolutionUrls"].ErrorText)) { EnvironmentFileHandler.AddNotification( string.Format("The {0} has still invalid or missing values.", Tag)); } row.Add("SolutionName", cells["SolutionName"].Value); if (dataGrid_Solutions.Columns["SolutionForce"].Visible) { row.Add("SolutionForce", cells["SolutionForce"].Value); } if (dataGrid_Solutions.Columns["SolutionOverwrite"].Visible) { row.Add("SolutionOverwrite", cells["SolutionOverwrite"].Value); } row.Add("SolutionUrls", cells["SolutionUrls"].Value != null ? cells["SolutionUrls"].Value.ToString().Trim() : string.Empty); row.Add("SolutionType", cells["SolutionType"].Value); list.Add(row); } } return(list.Cast <Dictionary <string, object> >().ToArray <Dictionary <string, object> >()); }