public void updateDataSet(DS_ActionMaps dsa, string actionID) { foreach (ActionMapCls am in this) { DS_ActionMaps.T_ActionMapRow amr = dsa.T_ActionMap.NewT_ActionMapRow(); foreach (ActionCls ac in am) { int ilIndex = 0; while (ac.inputList.Count > ilIndex) { if (actionID == DS_ActionMap.ActionID(am.name, ac.key, ac.inputList[ilIndex].NodeIndex)) { DS_ActionMaps.T_ActionRow ar = dsa.T_Action.FindByID_Action(actionID); ar.Usr_Binding = ac.inputList[ilIndex].DevInput; ar.Usr_Modifier = ac.inputList[ilIndex].ActivationMode.Name; ar.Disabled = DeviceCls.IsBlendedInput(ac.inputList[ilIndex].Input); ar.AcceptChanges( ); return; } ilIndex++; } } // each Action } // each ActionMap }
/// <summary> /// Converts all maps into a DataSet /// </summary> /// <param name="dsa">The dataset to populate</param> public void ToDataSet(DS_ActionMaps dsa) { dsa.Clear( ); if (dsa.HasChanges( )) { dsa.T_ActionMap.AcceptChanges( ); } int AMcount = 1; foreach (ActionMapCls am in this) { DS_ActionMaps.T_ActionMapRow amr = dsa.T_ActionMap.NewT_ActionMapRow( ); string amShown = DS_ActionMap.ActionMapShown(SCUiText.Instance.Text(am.MapName), AMcount++); amr.ID_ActionMap = amShown; dsa.T_ActionMap.AddT_ActionMapRow(amr); foreach (ActionCls ac in am) { int ilIndex = 0; while (ac.InputList.Count > ilIndex) { DS_ActionMaps.T_ActionRow ar = dsa.T_Action.NewT_ActionRow( ); ar.ID_Action = DS_ActionMap.ActionID(am.MapName, ac.Key, ac.InputList[ilIndex].NodeIndex); // make a unique key ar.AddBind = (ilIndex > 0); // all but the first are addbinds ar.REF_ActionMap = amShown; ar.ActionName = ac.ActionName; ar.ActionText = SCUiText.Instance.Text(ac.ActionName); ar.Device = ac.Device; ar.Def_Binding = ac.DefBinding; ar.Def_Modifier = ac.DefActivationMode.Name; ar.Usr_Binding = ac.InputList[ilIndex].DevInput; ar.Usr_Modifier = ac.InputList[ilIndex].ActivationMode.Name; ar.Disabled = DeviceCls.IsDisabledInput(ac.InputList[ilIndex].Input); dsa.T_Action.AddT_ActionRow(ar); ilIndex++; } } // each Action } // each ActionMap // finally if (dsa.HasChanges( )) { dsa.AcceptChanges( ); } }
public FormTable( ) { InitializeComponent( ); DS_AMaps = new DS_ActionMaps( ); // init once for the lifetime of the App m_bSrc.DataSource = DS_AMaps; m_bSrc.DataMember = "T_Action"; DGV.AutoGenerateColumns = true; DGV.DataSource = m_bSrc; DGV.MultiSelect = false; DGV.Columns["ID_Action"].Visible = false; DGV.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); // handle Edits (Blended Col is only allowed to be edited by the user) btUpdateFromEdit.Enabled = chkEditBlend.Checked; DGV.Columns["Usr_Binding"].ReadOnly = true; DGV.Columns["Usr_Modifier"].ReadOnly = true; DGV.ReadOnly = !chkEditBlend.Checked; }