public static void promptLastValueProperrtySetOneForm() { try { object nullObject = null; if (AAState.lastValueProperties == null) { MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_2a")); return; } object lstNames; object lstValues; AAState.lastValueProperties.GetAllProperties(out lstNames, out lstValues); LastValueEntry lstVal; DataTable pDt = new DataTable("LastValues"); DataColumn pDC = pDt.Columns.Add("Field", typeof(String)); pDC.ReadOnly = true; pDC.Caption = A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorCapt_2a"); pDC = pDt.Columns.Add("Value", typeof(String)); pDC.ReadOnly = false; pDC.Caption = A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorCapt_2b"); pDC = pDt.Columns.Add("Changed", typeof(String)); pDC.ReadOnly = false; pDC.Caption = A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorCapt_2c"); DataRow pDR; for (int i = 0; i < AAState.lastValueProperties.Count; i++) { pDR = pDt.NewRow(); string strVal = ((object[])lstNames)[i].ToString(); pDR["Field"] = strVal; pDR["Changed"] = "F"; lstVal = AAState.lastValueProperties.GetProperty(strVal) as LastValueEntry; if (lstVal != null) { if (lstVal.Value == null || lstVal.Value == DBNull.Value) { nullObject = "<null>"; } else { nullObject = lstVal.Value.ToString(); } pDR["Value"] = nullObject.ToString(); } pDt.Rows.Add(pDR); } LastValueForm lstValF = new LastValueForm(); lstValF.setDataTable(pDt); DialogResult dres = lstValF.ShowDialog(); if (dres == DialogResult.OK) { foreach (DataRow dr in lstValF.getDataTable().Rows) { if (dr[2].ToString() == "T") { lstVal = AAState.lastValueProperties.GetProperty(dr[0].ToString()) as LastValueEntry; if (lstVal != null) { lstVal.Value = dr[1].ToString(); AAState.lastValueProperties.SetProperty(dr[0].ToString(), lstVal); } } } } } catch (Exception ex) { MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain2") + ex.Message); } }
public static void promptLastValueProperrtySetOneForm() { try { object nullObject = null; if (AAState.lastValueProperties == null) { MessageBox.Show("The last value array has not been created, please activate the extension"); return; } object lstNames; object lstValues; AAState.lastValueProperties.GetAllProperties(out lstNames, out lstValues); LastValueEntry lstVal; DataTable pDt = new DataTable("LastValues"); DataColumn pDC = pDt.Columns.Add("Field", typeof(String)); pDC.ReadOnly = true; pDC.Caption = "Last Value Field"; pDC = pDt.Columns.Add("Value", typeof(String)); pDC.ReadOnly = false; pDC.Caption = "Current Value"; pDC = pDt.Columns.Add("Changed", typeof(String)); pDC.ReadOnly = false; pDC.Caption = "Change"; DataRow pDR; for (int i = 0; i < AAState.lastValueProperties.Count; i++) { pDR = pDt.NewRow(); string strVal = ((object[])lstNames)[i].ToString(); pDR["Field"] = strVal; pDR["Changed"] = "F"; lstVal = AAState.lastValueProperties.GetProperty(strVal) as LastValueEntry; if (lstVal != null) { if (lstVal.Value == null || lstVal.Value == DBNull.Value) { nullObject = "<null>"; } else { nullObject = lstVal.Value.ToString(); } pDR["Value"] = nullObject.ToString(); } pDt.Rows.Add(pDR); } LastValueForm lstValF = new LastValueForm(); lstValF.setDataTable(pDt); DialogResult dres = lstValF.ShowDialog(); if (dres == DialogResult.OK) { foreach (DataRow dr in lstValF.getDataTable().Rows) { if (dr[2].ToString() == "T") { lstVal = AAState.lastValueProperties.GetProperty(dr[0].ToString()) as LastValueEntry; if (lstVal != null) { lstVal.Value = dr[1].ToString(); AAState.lastValueProperties.SetProperty(dr[0].ToString(), lstVal); } } } } } catch (Exception ex) { MessageBox.Show("promptLastValueProperrtySet: " + ex.Message); } }