//──────────────────────────────────────── /// <summary> /// /// </summary> /// <param name="pcLst"></param> /// <param name="log_Reports"></param> protected void Execute6_Sub( ListBox pcLst, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); // //このイベントが起こったリストボックスの名前。 // string sName_Control; if (pcLst is CustomcontrolListbox) { CustomcontrolListbox cclst = (CustomcontrolListbox)pcLst; sName_Control = cclst.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Method.WriteDebug_ToConsole(sName_Control); } else { sName_Control = ""; } // // // //現在、選択している項目。 // // // DataRowView selectedDataRow = (DataRowView)pcLst.SelectedItem; if (null == selectedDataRow) { // 選択している行がなければ。 // エラー。 goto gt_Error_NoSelectedField; } // // // // 現在選択しているレコードの 指定フィールドの値を取得します。 // // // { //指定されているフィールド名。 string sName_Field; this.TrySelectAttribute(out sName_Field, Expression_Node_Function25Impl.PM_NAME_FIELD, EnumHitcount.One_Or_Zero, log_Reports); //そのフィールドの値。 Int_HumaninputImpl cellData = (Int_HumaninputImpl)selectedDataRow[sName_Field]; string sValue_Field = cellData.Text.Trim(); //.WriteLine(this.GetType().Name + "#: ◆ fieldValue=[" + fieldValue + "]"); //変数名。 Expression_Node_String ec_Name_ArgDestinationVariable; this.TrySelectAttribute(out ec_Name_ArgDestinationVariable, Expression_Node_Function25Impl.PM_NAME_VAR_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports); //指定した変数に、フィールド値を格納します。 this.Owner_MemoryApplication.MemoryVariables.SetStringValue( new XenonNameImpl( ec_Name_ArgDestinationVariable.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), ec_Name_ArgDestinationVariable.Cur_Configuration ), sValue_Field, true, log_Reports ); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NoSelectedField: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, pcLst.SelectedIndex.ToString(), log_Reports); //リストボックスの選択しているindex this.Owner_MemoryApplication.CreateErrorReport("Er:110010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// 項目の文字列。 /// </summary> /// <param name="e"></param> /// <param name="cctLst"></param> /// <param name="log_Reports"></param> /// <returns></returns> public override string P1_GetItemString( int nCurIx,//DrawItemEventArgs e,//e.Index CustomcontrolListbox cctLst, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "P1_GetItemLabel", log_Reports); // // string sDisplayText; // ↓2012-01-20 追加 if (nCurIx < cctLst.List_SText_Display.Count) { sDisplayText = cctLst.List_SText_Display[nCurIx]; if (null != sDisplayText) { goto gt_EndMethod; } } // // 項目の数だけ呼び出される。 // 処理はできるだけ軽く。 if (null == this.Expression_ItemLabel) { sDisplayText = "(" + Info_MiddleImpl.Name_Library + "#P1_GetItemString:リストボックスに<a-item-label>が指定されていません)"; goto gt_EndMethod; } // // dataRowViewが入っている。 DataRowView dataRowView = (DataRowView)cctLst.Items[nCurIx]; // // // ID値を取得し、キー値とする。 int nKey; Int_HumaninputImpl.TryParse(// ※仮。 dataRowView.Row["ID"], out nKey, EnumOperationIfErrorvalue.Error, -1, log_Reports ); if (!log_Reports.Successful) { // エラー sDisplayText = "(エラー発生中)"; goto gt_EndMethod; } if (log_Reports.Successful) { string sKey = nKey.ToString(); // ※仮。 // // value-variable-name="" 属性 if (null == this.Expression_ValueVariableName) { // // エラー。 sDisplayText = "(変数名取得失敗)"; goto gt_Error_NullValueVariableName; } else { // // 変数名取得。 StringBuilder sbHint = new StringBuilder(); sbHint.Append(Info_MiddleImpl.Name_Library); sbHint.Append(":"); sbHint.Append(this.GetType().Name); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl(sbHint.ToString(), null); string sVariableName = this.Expression_ValueVariableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); XenonNameImpl o_Name_Variable = new XenonNameImpl(sVariableName, parent_Configurationtree_Node); //ystem.Console.WriteLine(this.GetType().Name + "#P1_GetItemLabel: sVariableName=[" + sVariableName + "] sValue=[" + sValue + "]"); // // ループカウンター変数に、キー値を上書き。 this.Owner_MemoryApplication.MemoryVariables.SetStringValue( o_Name_Variable, sKey, true, log_Reports ); } // // 表示文字列。 sDisplayText = this.Expression_ItemLabel.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } else { sDisplayText = "(エラー発生中)"; goto gt_EndMethod; } if (!log_Reports.Successful) { sDisplayText = "(エラー発生中)"; goto gt_EndMethod; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullValueVariableName: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー926!", log_Method); StringBuilder t = new StringBuilder(); t.Append("<view>の<f-listbox-for-items>に、"); t.Append(Environment.NewLine); t.Append("value-variable-name=””属性がありませんでした。"); t.Append(Environment.NewLine); t.Append("コントロール名=["); t.Append(cctLst.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]"); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: // ↓2012-01-20 追加 while (cctLst.List_SText_Display.Count <= nCurIx) { cctLst.List_SText_Display.Add(null); } cctLst.List_SText_Display[nCurIx] = sDisplayText; log_Method.EndMethod(log_Reports); return(sDisplayText); }
//──────────────────────────────────────── #endregion #region イベントハンドラー //──────────────────────────────────────── public override string P2b_GetStyleName( int nCurIx, CustomcontrolListbox cctLst, Log_Reports pg_Logging ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "P2_GetStyleAttrNames", pg_Logging); // // string sResult; // 行をセットしたので、取り出されるのも行です。 // DataRowをセットしましたが、取り出されるのは DataRowViewになるようです。 DataRowView row = (DataRowView)cctLst.Items[nCurIx]; // スタイルのNAME値が入っている。 Value_Humaninput valueH = Utility_Row.GetFieldvalue( NamesFld.S_EXPL_SS, row.Row, false,//該当なしも可 pg_Logging, Info_LayoutImpl.Name_Library + ":" + this.GetType().Name + "#P2_:リストボックスのEXPL-SS" ); if (!pg_Logging.Successful) { // 既エラー。 sResult = ""; goto gt_EndMethod; } if (pg_Logging.Successful) { // 正常時 if (null == valueH) { sResult = ""; } else { sResult = ((Value_Humaninput)valueH).Text; } } else { sResult = ""; } goto gt_EndMethod; // // // // gt_EndMethod: pg_Method.EndMethod(pg_Logging); return(sResult); }