public static BindingList <TransitionRow> GetRowsFromTable(Table table) { BindingList <TransitionRow> list = new BindingList <TransitionRow>(); for (int row = 0; row < table.GetNumRows(); row++) { TransitionRow ct = new TransitionRow(); ct.Action = table.GetData(row, (int)TableColumns.Transitions.Action); ct.Condition = table.GetData(row, (int)TableColumns.Transitions.Condition); // stash the real goto data in a hidden column ct.GotoData_TreatAsDateStamp = table.GetData(row, (int)TableColumns.Transitions.Goto); Shadow targetShadow = Common.GetGotoTargetFromData(ct.GotoData_TreatAsDateStamp); if (targetShadow == null) { ct.Goto = ct.GotoData_TreatAsDateStamp; } else { ct.Goto = targetShadow.GetGotoName(); } ct.ActionDateStamp = table.GetData(row, (int)TableColumns.Transitions.ActionDateStamp); ct.ConditionDateStamp = table.GetData(row, (int)TableColumns.Transitions.ConditionDateStamp); ct.GotoDateStamp = table.GetData(row, (int)TableColumns.Transitions.GotoDateStamp); list.Add(ct); } return(list); }
public static BindingList<TransitionRow> GetRowsFromTable(Table table) { BindingList<TransitionRow> list = new BindingList<TransitionRow>(); for (int row = 0; row < table.GetNumRows(); row++) { TransitionRow ct = new TransitionRow(); ct.Action = table.GetData(row, (int)TableColumns.Transitions.Action); ct.Condition = table.GetData(row, (int)TableColumns.Transitions.Condition); // stash the real goto data in a hidden column ct.GotoData_TreatAsDateStamp = table.GetData(row, (int)TableColumns.Transitions.Goto); Shadow targetShadow = Common.GetGotoTargetFromData(ct.GotoData_TreatAsDateStamp); if (targetShadow == null) ct.Goto = ct.GotoData_TreatAsDateStamp; else ct.Goto = targetShadow.GetGotoName(); ct.ActionDateStamp = table.GetData(row, (int)TableColumns.Transitions.ActionDateStamp); ct.ConditionDateStamp = table.GetData(row, (int)TableColumns.Transitions.ConditionDateStamp); ct.GotoDateStamp = table.GetData(row, (int)TableColumns.Transitions.GotoDateStamp); list.Add(ct); } return list; }
internal static void LoadTransitionDataGridView(DataGridView gridView, Table table) { BindingList <TransitionRow> tList = TransitionRow.GetRowsFromTable(table); if (gridView.Columns.Count == 0) { gridView.AutoGenerateColumns = false; AddTextBoxColumn(gridView, TransitionRow.ConditionColumnName); AddTextBoxColumn(gridView, TransitionRow.ActionColumnName); AddTextBoxColumn(gridView, TransitionRow.GotoColumnName); AddTextBoxColumn(gridView, TransitionRow.ConditionDateStampColumnName); AddTextBoxColumn(gridView, TransitionRow.ActionDateStampColumnName); AddTextBoxColumn(gridView, TransitionRow.GotoDateStampColumnName); ApplyCommonDataGridViewSettings <TransitionRow>(gridView, false); HideDateStampColumns(gridView); gridView.Columns[CommandTransitionRow.GotoColumnName].ReadOnly = true; } gridView.DataSource = tList; }
internal static Table UnloadTransitionDataGridView(DataGridView gridView) { BindingList <TransitionRow> list = gridView.DataSource as BindingList <TransitionRow>; return(TransitionRow.GetTableFromRows(list)); }