Ejemplo n.º 1
0
 private void RefreshDataGridViewData(DataGridViewRowCollection rows, int propertyIndex, object defaultValue)
 {
     _isInternalRefreshOperation = true;
     if (listBox_stateNames.SelectedIndex < 0)
     {
         for (int i = 0; i < rows.Count; i++)
         {
             rows[i].Cells[0].Value = false;
             rows[i].Cells[2].Value = defaultValue.ToString();
         }
     }
     else
     {
         string currentState = listBox_stateNames.Text;
         for (int i = 0; i < rows.Count; i++)
         {
             DataGridViewRow    rowData        = rows[i];
             string             controlName    = rowData.Cells[1].Value.ToString();
             ViewControlElement controlElement = GetViewControlElement(controlName);
             object[]           values         = controlElement.GetValue(currentState);
             if (null == values)
             {
                 rows[i].Cells[0].Value = false;
                 rows[i].Cells[2].Value = defaultValue.ToString();
             }
             else
             {
                 object propertyValue = values[propertyIndex];
                 rows[i].Cells[0].Value = (null != propertyValue);
                 rows[i].Cells[2].Value = propertyValue?.ToString() ?? defaultValue.ToString();
             }
         }
     }
     _isInternalRefreshOperation = false;
 }
Ejemplo n.º 2
0
 private void AddDataToTable(ViewControlElement controlElement)
 {
     object[] values = controlElement.GetValue(listBox_stateNames.Text);
     if (null == values)
     {
         dataGridView_enabledSelect.Rows.Add(false, controlElement.Name, ViewControlElement.DefaultValue[0].ToString());
         dataGridView_visibleSelect.Rows.Add(false, controlElement.Name, ViewControlElement.DefaultValue[1].ToString());
     }
     else
     {
         AddSingleTableData(dataGridView_enabledSelect.Rows, controlElement.Name, values[0], ViewControlElement.DefaultValue[0]);
         AddSingleTableData(dataGridView_visibleSelect.Rows, controlElement.Name, values[1], ViewControlElement.DefaultValue[1]);
     }
 }