//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// ドラッグ&ドロップ アクション実行。 /// </summary> /// <param nFcName="sender"></param> /// <param nFcName="e"></param> public override void Execute4_OnDnD( object sender, GiveFeedbackEventArgs e ) { Log_Method pg_Method = new Log_MethodImpl(0); Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(pg_Method); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "Execute4_OnDnD", log_Reports_ThisMethod); // // // // Customcontrol cct = null; // // コントロール名。 // string sName_Usercontrol; if (sender is Customcontrol) { cct = (Customcontrol)sender; sName_Usercontrol = cct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports_ThisMethod); log_Reports_ThisMethod.Comment_EventCreationMe = "[" + sName_Usercontrol + "]コントロールでドラッグ&ドロップされました。"; // ステータスバーに、コントロール名を表示。 //cct.ControlCommon.MoControlMediator.AddStatus_ActionFcName(sName_Usercontrol, d_Logging_Dammy); } else { sName_Usercontrol = ""; log_Reports_ThisMethod.Comment_EventCreationMe = "ドラッグ&ドロップされました。"; } // // ストップウォッチ。 // if (log_Reports_ThisMethod.CanStopwatch) { pg_Method.Log_Stopwatch.Message = Utility_Format.Format( sName_Usercontrol, this.ConfigurationtreeToExpression_Event.Name ); pg_Method.Log_Stopwatch.Begin(); } // // 登録アクション作成・実行ループ。 // // 未作成時「作成」 if (!this.ConfigurationtreeToExpression_Event.IsTranslated_ConfigurationtreeToExpression) { this.ConfigurationtreeToExpression_Event.Translate(cct.ControlCommon.Owner_MemoryApplication, log_Reports_ThisMethod); } // 実行。 //EnumEventhandler err_Eh; if (log_Reports_ThisMethod.Successful) { foreach (Expression_Node_Function expr_Func in this.List_Item) { expr_Func.Execute4_OnDnD(sender, e); } } goto gt_EndMethod; // gt_EndMethod: pg_Method.EndMethod(log_Reports_ThisMethod); log_Reports_ThisMethod.EndLogging(pg_Method); }
//──────────────────────────────────────── protected override void Test_ChildNodes( XmlElement cur_X, Configurationtree_Node cur_Cf, Log_Reports log_Reports) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Test_ChildNodes", log_Reports); // // name属性は必須。 // string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute); if ("" == sName_Fnc) { goto gt_Error_UndefinedFncNameAttr; } // // // // 「Sf:cell;」では、子要素<fnc name=”Sf:where;”>が必須。 // // // int nAwhrCount = 0;//where要素の数。 { if (NamesFnc.S_CELL == sName_Fnc) { cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak) { string sName_Attr; bool bHit = s_Child.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Attr, false, log_Reports); if (bHit) { if (NamesFnc.S_WHERE == sName_Attr) { nAwhrCount++; } } }); if (0 == nAwhrCount) { goto gt_Error_ZeroAwhr; } else if (1 < nAwhrCount) { goto gt_Error_SomeAwhr; } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedFncNameAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー411!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<fnc>要素に、name属性が指定されていませんでした。"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_ZeroAwhr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー377!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("func系要素の下に、<a-where>要素がありませんでした。"); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_SomeAwhr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー319!", log_Method); StringBuilder s = new StringBuilder(); s.Append("<a-where>要素が["); s.Append(nAwhrCount); s.Append("]つありました。<a-where>要素は、<f-cell>要素の中に1つまでしか書いてはいけません。"); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void Translate( Configurationtree_Node cur_Conf,//Sv_3FListboxValidation UsercontrolListbox uctLst, MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(34)" + cur_Conf.Name); } // // // バリデーター設定要素 Configurationtree_Node cf_ValidatorConfig; { List <Configurationtree_Node> cfList_ValidatorConfig = uctLst.ControlCommon.Configurationtree_Control.GetChildrenByNodename(NamesNode.S_CODEFILE_VALIDATORS, false, log_Reports); if (1 < cfList_ValidatorConfig.Count) { throw new Exception("バリデーター設定要素が2つ以上ありました。"); } else if (0 < cfList_ValidatorConfig.Count) { cf_ValidatorConfig = cfList_ValidatorConfig[0]; } else { cf_ValidatorConfig = null; } } // // // // 自 // // // Expressionv_3FListboxValidationImpl cur_Exprv = new Expressionv_3FListboxValidationImpl(null, cf_ValidatorConfig, memoryApplication); // // // // 子 // // // List <Configurationtree_Node> cfList_Fnc = cur_Conf.GetChildrenByNodename(NamesNode.S_FNC, false, log_Reports); // #デバッグ中 //d_InMethod.WriteDebug_ToConsole(1, " <a-display>数=[" + sv_Cur.Sv_ADisplayList.Count + "]"); //d_InMethod.WriteDebug_ToConsole(1, " <fnc name=”a-record-set-save-to”>数=[" + sv_Cur.Sv_ASelectRecordList.Count + "]"); foreach (Configurationtree_Node child_Cf in cfList_Fnc) { string sName_Fnc; child_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, true, log_Reports); if (NamesFnc.S_VLD_SELECT_RECORD == sName_Fnc) { ConfigurationtreeToExpression_V53_ASelectRecordImpl_ to = new ConfigurationtreeToExpression_V53_ASelectRecordImpl_(); to.Translate( child_Cf, cur_Exprv, memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesFnc.S_VLD_DISPLAY == sName_Fnc) { // <a-display>要素 ConfigurationtreeToExpression_V53_ADisplayImpl_ to = new ConfigurationtreeToExpression_V53_ADisplayImpl_(); to.Translate( child_Cf, cur_Exprv, uctLst, memoryApplication, pg_ParsingLog, log_Reports ); } else { log_Method.WriteError_ToConsole("未実装です。"); throw new Exception("未実装です。"); } } goto gt_EndMethod; // // // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Conf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public override void Translate( Configurationtree_Node cur_Cf, //<lookup-id> Expression_Node_String parent_Ec, //< Sf:text-template;> MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE", log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(9)" + cur_Cf.Name); } // // // // // // 自 // // // Expression_Node_String cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf); // // // // 親へ連結 (value属性) // // // { // // 自要素の value="" 属性を、親へ連結 // PmName pmName = PmNames.S_VALUE; string sValue; bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports); if (bHit) { cur_Ec.AppendTextNode( sValue, cur_Cf, log_Reports ); // // // // 子 // // // this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec,//自 memoryApplication, pg_ParsingLog, log_Reports ); // // // // 親へ連結 ※属性連結 // // // parent_Ec.SetAttribute(PmNames.S_LOOKUP_ID.Name_Pm, cur_Ec, log_Reports); goto gt_EndMethod; } else { } } // // // // 子 // // // { //<a-default>の子要素を確認し、親<f-switch>のdefault属性に追加します。 this.ParseChild_InConfigurationtreeToExpression( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } // // // // 親へ連結 // // // parent_Ec.SetAttribute(PmNames.S_LOOKUP_ID.Name_Pm, cur_Ec, log_Reports); // // // // 親へ連結 debug // // // if (log_Method.CanDebug(1)) { string parent_SName_Fnc; parent_Ec.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.WriteDebug_ToConsole(" ☆☆☆☆☆☆☆☆ 親<[" + parent_Ec.Cur_Configuration.Name + "] name=”[" + parent_SName_Fnc + "]” >"); string sName_MyFnc; cur_Ec.TrySelectAttribute(out sName_MyFnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.WriteDebug_ToConsole(" ☆☆☆☆☆☆☆☆ 自<[" + cur_Ec.Cur_Configuration.Name + "] name=”[" + sName_MyFnc + "]” >"); } goto gt_EndMethod; // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── protected override void Parse_SAttribute( XmlElement cur_X, Configurationtree_Node cur_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Parse_SAttr", log_Reports); // // // // name属性は必須。 // string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute); if ("" == sName_Fnc) { goto gt_Error_UndefinedFncNameAttr; } XmlAttribute err_XAttr = null; if (NamesFnc.S_CELL == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ② // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } } else if (NamesFnc.S_SWITCH == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ③ // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } } else if (NamesFnc.S_CASE == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ④ // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } } else if (NamesFnc.S_VALUE_CONTROL == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { // ⑤ // name,description PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } } // value属性の指定がなければ、このコントロールの名前を入れておく。 if (!cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE.Name_Pm)) { Configurationtree_Node owner_Configurationtree_Control; if (!(cur_Cf.Parent is Configurationtree_Node)) { //todo:エラーか? owner_Configurationtree_Control = null; goto gt_Error_UndefinedClass; } else { Configurationtree_Node parent_Cf = (Configurationtree_Node)cur_Cf.Parent; if (NamesNode.S_CONTROL1 == parent_Cf.Name) { owner_Configurationtree_Control = parent_Cf; } else { Configuration_Node parent2 = parent_Cf.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); if (log_Reports.Successful) { owner_Configurationtree_Control = (Configurationtree_Node)parent2; } else { owner_Configurationtree_Control = null; } } } if (null != owner_Configurationtree_Control) { if (owner_Configurationtree_Control.Dictionary_Attribute.ContainsKey(PmNames.S_NAME.Name_Pm)) { string sFcName; owner_Configurationtree_Control.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sFcName, true, log_Reports); cur_Cf.Dictionary_Attribute.Add(PmNames.S_VALUE.Name_Pm, sFcName, cur_Cf, true, log_Reports); } } } } else if (NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc) { foreach (XmlAttribute xAttr in cur_X.Attributes) { string xName_AttrTrim = xAttr.Name.Trim(); if ( PmNames.S_REQUIRED.Name_Attribute == xAttr.Name || // 特にS→Eにパースは無い PmNames.S_FROM.Name_Attribute == xAttr.Name || // Xn_L07_SToE:SToE_F_5FElem/Xn_L07_SToE:SToE_F_A6FromImpl PmNames.S_STORAGE.Name_Attribute == xAttr.Name || // 特にS→Eにパースは無い PmNames.S_FIELD.Name_Attribute == xAttr.Name // 特にS→Eにパースは無い ) { // // 属性=”” cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports); } else { // // エラー。 err_XAttr = xAttr; goto gt_Error_UndefinedAttr; } }//foreach } else { foreach (XmlNode xAttr in cur_X.Attributes) { // とりあえず、どんな属性名でも受け入れる。 if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>の属性 " + xAttr.Name + "=”" + xAttr.Value + "”"); } // // value="" // // ⑥ PmName pmName = PmNames.FromSAttribute(xAttr.Name); if (null != pmName) { cur_Cf.Dictionary_Attribute.Add(pmName.Name_Pm, xAttr.Value, cur_Cf, true, log_Reports); } else { cur_Cf.Dictionary_Attribute.Add(xAttr.Name, xAttr.Value, cur_Cf, true, log_Reports); } // // 子<arg1>は、ここでは処理しない。 // } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー336!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("["); s.Append(cur_X.Name); s.Append("]要素を探索中に、未対応の属性が記述されていました。"); s.Newline(); s.Append("xAttr.Name=["); s.Append(err_XAttr.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedFncNameAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー413!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<fnc>要素に、name属性が指定されていませんでした。"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedClass: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー341!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("何らかのエラー。"); s.Newline(); // ヒント s.Append(r.Message_Configuration(cur_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
public void TryGetInt( out int out_NValue, string sName, bool bRequired, int nAlt, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "TryGetInt", log_Reports); // if (!this.Dictionary_Field.ContainsKey(sName)) { //該当なし。 if (bRequired) { out_NValue = -1; goto gt_Error_NotFound; } else { out_NValue = nAlt; goto gt_EndMethod; } } FieldUserformtable fo_Field = this.Dictionary_Field[sName]; if (EnumTypedb.Int != fo_Field.EnumTypedb) { //型が異なる。 if (bRequired) { out_NValue = -1; goto gt_Error_Type; } else { out_NValue = nAlt; goto gt_EndMethod; } } out_NValue = (int)fo_Field.Data; goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFound: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports);//フィールド名 memoryApplication.CreateErrorReport("Er:6001;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Type: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports); //フィールド名 tmpl.SetParameter(2, fo_Field.EnumTypedb.ToString(), log_Reports); //フィールドの型名 memoryApplication.CreateErrorReport("Er:6002;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 設定されている内容を空っぽにします。 /// /// todo:イベントハンドラーを外してから、フォームを外すこと。リストボックスが誤挙動を起こしている。 /// </summary> public void ClearProject( Control.ControlCollection formControls, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "ClearProject", log_Reports); // // // // クリアー: form1の、コントロール: // this.MemoryForms.ClearForms( formControls, log_Reports ); // // クリアー: バックアップ情報を空っぽにします。 // this.MemoryBackup.Clear(this); // // クリアー: 関数を空っぽにします。 // this.MemoryFunctions.Clear(this); // // クリアー: 変数を空っぽにします。 // this.MemoryVariables.Clear(this); // // クリアー: テーブルを空っぽにします。 // this.MemoryTables.Clear(this); // // クリアー: リローディング設定ファイルを空っぽにします。 // this.MemoryTogethers.Clear(this);//.Cf_RfrCnf.List_Child.Clear(log_Reports); // // クリアー: スクリプトファイル一覧を空っぽにします。 // this.MemoryCodefiles.Clear(this); // // クリアー: バリデーター一覧を空っぽにします。 // this.MemoryValidators.Clear(this); // // // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// UsercontrolPerformerImpl#Perform_FcImpl で使用。 /// UsercontrolPerformerImpl#Perform で使用。 /// /// cf_Eventは、ucFc.ControlCommon.Configurationtree_Control.SDic_Event から取っている。 /// </summary> /// <param name="sender"></param> /// <param name="event_Conf"></param> /// <param name="moWorkbench"></param> /// <param name="log_Reports"></param> public void Execute2_Event( object sender, Configurationtree_Node event_Conf, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute2_Event", log_Reports); Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl("<" + log_Method.Fullname + ":>", null); if (log_Reports.CanStopwatch) { // コメント作成 { StringBuilder sb = new StringBuilder(); string sName_Control; { Configuration_Node owner_Configurationtree_Control = event_Conf.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Control, false, log_Reports); } string sEventName; { event_Conf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, false, log_Reports); } int nActionCount; { nActionCount = event_Conf.List_Child.Count; } sb.Append(Info_Functions.Name_Library); sb.Append(":"); sb.Append(this.GetType().Name); sb.Append("#ToString: イベント計測 "); sb.Append(" FC["); sb.Append(sName_Control); sb.Append("].EV["); sb.Append(sEventName); sb.Append("]"); if (0 < nActionCount) { sb.Append("アクション数=["); sb.Append(nActionCount); sb.Append("]"); } log_Method.Log_Stopwatch.Message = sb.ToString(); log_Method.Log_Stopwatch.Begin(); } } // ステータスバーに表示する文字列。 { if (sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)sender; if (null == ccFc.ControlCommon.Owner_MemoryApplication) { log_Method.WriteDebug_ToConsole("null==ccFc.ControlCommon.Owner_MemoryApplication がヌルでした。"); } else { ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolNameBegin(log_Reports); string sName_Usercontrol = sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolName(sName_Usercontrol, log_Reports); } } } event_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Action, ref bool bBreak) { Executer3_FunctionImpl exe2 = new Executer3_FunctionImpl(); // イベントハンドラーの作成 Expression_Node_Function expr_Func = exe2.ConfigurationtreeToFunction( s_Action, owner_MemoryApplication, log_Reports ); // システム定義関数の実行 exe2.Execute3_Function( expr_Func, sender, owner_MemoryApplication, log_Reports ); // 他の待機スレッドに、実行順番を譲る。 //TODO: System.Threading.Thread.Sleep(0); //if (Log_ReportsImpl.BDebugmode_Static) //{ // //.WriteLine(this.GetType().Name + "#:\n│\n│\n│\n│"); //} }); log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// <view>要素を読取り、s_Dataを作成。 /// </summary> /// <param name="x_View"></param> /// <param name="s_Parent"></param> /// <param name="log_Reports"></param> public override void XmlToConfigurationtree( XmlElement cur_X, Configurationtree_Node parent_Cf,//<control> MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports); // // // // // // 自 // // // Configurationtree_Node cur_Sf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports); // // // // 属性 // // // if (log_Reports.Successful) { this.Parse_SAttribute(cur_X, cur_Sf, memoryApplication, log_Reports); } // // // // 子 // // // if (log_Reports.Successful) { this.Parse_ChildNodes(cur_X, cur_Sf, memoryApplication, log_Reports); } // // // // 親へ連結 // // // if (log_Reports.Successful) { parent_Cf.List_Child.Add(cur_Sf, log_Reports); } // // // // goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// ユーザー定義プログラムの実行。 /// </summary> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns></returns> public override string Execute4_OnExpressionString( EnumHitcount hits, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute4_OnExpressionString", log_Reports); // // Expression_Node_String err_Ev11; bool bAllFldsIsEmpty = true; Expression_Node_String ec_RecordSetLoadFrom;//ソース情報利用 bool bHit = this.TrySelectAttribute(out ec_RecordSetLoadFrom, NamesNode.S_RECORD_SET_LOAD_FROM, EnumHitcount.One, log_Reports); // // 一時記憶に記憶されているレコードセットのコピー内容。 RecordSet recordSet; if (log_Reports.Successful) { string sRecordSetLoadFrom = ec_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // #デバッグ中 System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute: ★★ record-set-load-from=[" + sRecordSetLoadFrom + "]"); recordSet = this.Owner_MemoryApplication.MemoryRecordset.RecordsetStorage.Get(ec_RecordSetLoadFrom, this.Owner_MemoryApplication, log_Reports); } else { recordSet = null; } Value_Humaninput err_OValue; string err_SFldName; Exception err_Excp; string err_SCsv; List <string> err_SList; if (log_Reports.Successful) { // // 子<f-●●>要素を実行し、文字列連結。 // 「SK10,LV10,OP10,COND10,COND10x,COND10y,COND10z,PRI10,RATE10,PER10」といった文字列が取得できることを期待。 StringBuilder sb_Csv = new StringBuilder(); { List <Expression_Node_String> ecList_Child = this.List_Expression_Child.SelectList( EnumHitcount.Unconstraint, log_Reports ); foreach (Expression_Node_String ec_11 in ecList_Child) { if (ec_11 is Expressionv_Elem99) { Expressionv_Elem99 ev_elem = (Expressionv_Elem99)ec_11; ev_elem.SetDataRow(this.DataRow); sb_Csv.Append(ev_elem.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); } else if (ec_11 is Expression_Node_StringImpl) { sb_Csv.Append(ec_11.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); } else { err_Ev11 = ec_11; bAllFldsIsEmpty = false; goto gt_Error_UndefinedElementClass; } } } // // コンマ区切り文字列を、リスト化。 List <string> sList; { CsvTo_ListImpl csvTo = new CsvTo_ListImpl(); sList = csvTo.Read(sb_Csv.ToString()); } // // 全部真なら真、1つでも偽なら偽。 foreach (string sFldName in sList) { // bug: argumentException Value_Humaninput oValue; try { // レコードセットの1件目だけをとりあえず確認。TODO: oValue = recordSet.List_Field[0][sFldName.ToUpper()]; //oValue = (OValue)dataRow[fldName]; } catch (KeyNotFoundException ex) { err_Excp = ex; err_SFldName = sFldName; err_SCsv = sb_Csv.ToString(); err_SList = sList; goto gt_Error_UndefinedFld; } // #デバッグ中 System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute: oValue.Text=[" + oValue.Text + "]"); if (oValue is Int_HumaninputImpl) { Int_HumaninputImpl oInt = (Int_HumaninputImpl)oValue; if ("" != oInt.Text) { bAllFldsIsEmpty = false; } } else if (oValue is String_HumaninputImpl) { String_HumaninputImpl oString = (String_HumaninputImpl)oValue; if ("" != oString.Text) { bAllFldsIsEmpty = false; } } else if (oValue is Bool_HumaninputImpl) { Bool_HumaninputImpl oBool = (Bool_HumaninputImpl)oValue; if ("" != oBool.Text) { bAllFldsIsEmpty = false; } // // TODO: false/trueタイプ、0/1タイプにも対応したい。 // } else { // // エラー。 err_OValue = oValue; goto gt_Error_UndefinedType; } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedType: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_OValue.GetType().Name, log_Reports); //値の型名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6032;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedElementClass: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_Ev11.GetType().Name, log_Reports); //クラス名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6033;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedFld: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_SFldName.ToUpper(), log_Reports); //フィールド名大文字化 tmpl.SetParameter(2, err_SCsv, log_Reports); //指定されたフィールド名の文字列 StringBuilder s1 = new StringBuilder(); foreach (string str in err_SList) { s1.Append("["); s1.Append(str); s1.Append("]"); s1.Append(Environment.NewLine); } tmpl.SetParameter(3, s1.ToString(), log_Reports);//指定されたフィールド名の文字列 StringBuilder s2 = new StringBuilder(); // あるフィールド名の一覧 foreach (DataColumn dataColumn in this.DataRow.Table.Columns) { s2.Append("["); s2.Append(dataColumn.ColumnName); s2.Append("]"); s2.Append(Environment.NewLine); } tmpl.SetParameter(4, s1.ToString(), log_Reports); //指定されたフィールド名の文字列 tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト tmpl.SetParameter(6, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ this.Owner_MemoryApplication.CreateErrorReport("Er:6034;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(bAllFldsIsEmpty.ToString()); }
//──────────────────────────────────────── /// <summary> /// レイアウト_レコードを元に、コントロールのスタイルを設定します。 /// </summary> /// <param nFcName="fo_Record"></param> /// <param nFcName="log_Reports"></param> public void SetupStyle( RecordUserformconfig fo_Record, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "SetupStyle", log_Reports); // // 自動入力ここから this.ControlCommon.BAutomaticinputting = true; { string sText; fo_Record.TryGetString(out sText, NamesFld.S_TEXT, false, "", this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolText = sText; bool bEnabled; fo_Record.TryGetBool(out bEnabled, NamesFld.S_ENABLED, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolEnabled = bEnabled; bool bVisible; fo_Record.TryGetBool(out bVisible, NamesFld.S_VISIBLE, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolVisible = bVisible; // フォントの設定 { // フォント・サイズの設定 float nFontSizePt = Utility_Usercontrol.ParseFontSize(fo_Record, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.Font = new System.Drawing.Font("MS UI Gothic", nFontSizePt, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); } // 【特殊】ウィンドウは、X,Y設定を無視する。 //this.ccWindow.Location = new System.Drawing.Point(sl_record.AbsXLt, sl_record.AbsYLt); int nWidth; fo_Record.TryGetInt(out nWidth, NamesFld.S_WIDTH, false, 1, this.ControlCommon.Owner_MemoryApplication, log_Reports); int nHeight; fo_Record.TryGetInt(out nHeight, NamesFld.S_HEIGHT, false, 1, this.ControlCommon.Owner_MemoryApplication, log_Reports); // 【特殊】ユーザーコントロールではなく、持っているウィンドウに対して変更。 this.customcontrolWindow1.Size = new System.Drawing.Size(nWidth, nHeight); } // 背景色の設定 string sBackColor; fo_Record.TryGetString(out sBackColor, NamesFld.S_BACK_COLOR, false, "", this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolBackcolor = sBackColor; this.ControlCommon.BAutomaticinputting = false; // 自動入力ここまで goto gt_EndMethod; // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); if (log_Reports.CanStopwatch) { string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // if (this.EnumEventhandler == EnumEventhandler.O_Kea) { Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null); Keys keys = this.Functionparameterset.KeyEventArgs.KeyCode; // // Form1のKeyPreview属性を true にしておく必要があります。 // switch (keys) { case Keys.F8: // // 「ツール設定ウィンドウ」を開きます。 // //OWrittenPlace oWrittenPlace = new OWrittenPlaceImpl(this.OWrittenPlace.WrittenPlace + "!ハードコーディング_NAction21#(10)"); Expression_Node_Function expr_Func = Collection_Function.NewFunction2( Expression_Node_Function11Impl.NAME_FUNCTION, this, this.Cur_Configuration, this.Owner_MemoryApplication, log_Reports); Configuration_Node cf_Event; { cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports); } expr_Func.Execute4_OnLr( this.Functionparameterset.Sender, log_Reports ); //essageBox.Show("[F8]キーを押しました。", "△情報103!"); break; } } // // log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── protected void Execute6_Sub( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string sName_Fnc; this.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sName_Fnc + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // 変数は、登録されている名前の変数は存在し、登録されていない名前の変数は(自動作成されたもの以外は)存在しない。 // // 元となるテーブルを見ながら、変数オブジェクトの内容を調べていく。 // // Configurationtree_Node cur_Cf = new Configurationtree_NodeImpl(log_Method.Fullname, null); // 変数ログを吐く。 { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); sb.Append(","); sb.Append(NamesFld.S_ID); sb.Append(","); sb.Append(NamesFld.S_EXPL); sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT); //NO sb.Append(","); sb.Append(NamesTypedb.S_INT); //ID sb.Append(","); sb.Append(NamesTypedb.S_STRING); //Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,"); //NO sb.Append("使わない,"); //ID sb.Append("解説,"); //Expl sb.Append("変数名,"); //NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,"); //FOLDER sb.Append("初期値,"); //VALUE sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); int nAuto = 0; this.Owner_MemoryApplication.MemoryVariables.EachVariable(delegate(string sKey, Expression_Node_String ec_String, ref bool bBreak) { if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("[" + sKey + "]=[" + ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]"); } sb.Append(nAuto);//NO sb.Append(","); //ID 使わない sb.Append(","); //Expl 消えてしまう sb.Append(","); sb.Append(sKey);//NAME sb.Append(","); //FOLDER TODO:逆算が必要 sb.Append(","); sb.Append(ec_String.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); nAuto++; }); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole(sb.ToString()); } //ログ出力 { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_LOG_VARIABLES; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } //変数CSVを吐き出したい。(登録されている順序を保って) { // 変数ファイルの読取り Table_Humaninput o_Table_Variables; this.Owner_MemoryApplication.MemoryVariables.TryGetTable_Variables( out o_Table_Variables, Application.StartupPath, log_Reports ); if (null != o_Table_Variables) { StringBuilder sb = new StringBuilder(); //1行目 sb.Append(NamesFld.S_NO); sb.Append(","); sb.Append(NamesFld.S_ID); sb.Append(","); sb.Append(NamesFld.S_EXPL); sb.Append(","); sb.Append(NamesFld.S_NAME); sb.Append(","); sb.Append(NamesFld.S_FOLDER); sb.Append(","); sb.Append(NamesFld.S_VALUE); sb.Append(","); sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); //2行目 sb.Append(NamesTypedb.S_INT); //NO sb.Append(","); sb.Append(NamesTypedb.S_INT); //ID sb.Append(","); sb.Append(NamesTypedb.S_STRING); //Expl sb.Append(","); sb.Append(NamesTypedb.S_STRING); //NAME sb.Append(","); sb.Append(NamesTypedb.S_STRING); //FOLDER sb.Append(","); sb.Append(NamesTypedb.S_STRING); //VALUE sb.Append(","); sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); //3行目 sb.Append("-1,"); //NO sb.Append("使わない,"); //ID sb.Append("解説,"); //Expl sb.Append("変数名,"); //NAME sb.Append("(ファイルパス変数のみ指定有効)フォルダーパス,"); //FOLDER sb.Append("初期値,"); //VALUE sb.Append(NamesFld.S_END); //END sb.Append(Environment.NewLine); int nAuto = 0; foreach (DataRow row in o_Table_Variables.DataTable.Rows) { if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NO)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_NO], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } // IDは空欄が正しいが、int型なので空欄にできないので 0 を入れる。 if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_ID)) { int nValue; Int_HumaninputImpl.TryParse(row[NamesFld.S_ID], out nValue, EnumOperationIfErrorvalue.Spaces_To_Alt_Value, 0, log_Reports); sb.Append(nValue); sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_EXPL)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_EXPL], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); } string sName_Var = ""; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_NAME)) { string sValue; String_HumaninputImpl.TryParse(row[NamesFld.S_NAME], out sValue, "", "", log_Method, log_Reports); sb.Append(sValue); sb.Append(","); sName_Var = sValue; } // 現在の変数の内容 string sValue_Var = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); //現在の変数の内容を検索 if (NamesVar.Test_Filepath(sName_Var)) { Expression_Node_Filepath ec_Fpath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sName_Var, null, cur_Cf), true, log_Reports); // 絶対パスとは限らない。フォルダーを指していることもある。 string sFpath = ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //フォルダー列値を取得。 string sNamevar_Folder_Src; if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_FOLDER)) { String_HumaninputImpl.TryParse(row[NamesFld.S_FOLDER], out sNamevar_Folder_Src, "", "", log_Method, log_Reports); //フォルダーパス Expression_Node_Filepath ec_Folder = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(sNamevar_Folder_Src, null, cur_Cf), false, log_Reports); if (null != ec_Folder) { // FOLDER列に入力があれば。 string sFpath_Folder = ec_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (sValue_Var.StartsWith(sFpath_Folder)) { // FOLDER列値をそのままキープ。 sb.Append(sNamevar_Folder_Src); // 値のフォルダー部分を削る。 sValue_Var = sValue_Var.Substring(sFpath_Folder.Length); // 先頭が ディレクトリー区切り文字なら削る。 if (sValue_Var.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { sValue_Var = sValue_Var.Substring(System.IO.Path.DirectorySeparatorChar.ToString().Length); } } else { // FOLDER列値はそのまま使えない。 } } sb.Append(","); } if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { //string sValue; //String_HumaninputImpl.TryParse(row[NamesFld.S_VALUE], out sValue, "", "", log_Method, log_Reports); //sb.Append(sValue); //sb.Append(","); // 現在の変数の値(の削った残り)を入れる。 sb.Append(sValue_Var); sb.Append(","); } } else// if (NamesVar.Test_String(sName_Var)) { // FOLDER列値は無し。 sb.Append(","); if (o_Table_Variables.DataTable.Columns.Contains(NamesFld.S_VALUE)) { // 現在の変数の値を入れる。 sb.Append(sValue_Var); sb.Append(","); } } sb.Append(NamesFld.S_END); sb.Append(Environment.NewLine); nAuto++; } //ファイル書出し { Expression_Node_Filepath ec_Fpath_Logs = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(new Expression_Leaf_StringImpl(NamesVar.S_SP_LOGS, null, cur_Cf), true, log_Reports); string sFpatha_LogVariables = ec_Fpath_Logs.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_SAVE_VARIABLES; if (log_Reports.Successful) { CsvWriterImpl writer = new CsvWriterImpl(); writer.Write( sb.ToString(), sFpatha_LogVariables, true ); } } } } // // メッセージボックスの表示。 { StringBuilder sb = new StringBuilder(); sb.Append(this.GetType().Name); sb.Append("#Execute6_Sub:"); sb.Append(Environment.NewLine); string sArgMessage; this.TrySelectAttribute(out sArgMessage, Expression_Node_Function45Impl.PM_MESSAGE, EnumHitcount.One_Or_Zero, log_Reports); sb.Append(sArgMessage); MessageBox.Show(sb.ToString(), "変数をCSVファイルに書き出したい。"); } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// todo: /// </summary> /// <param nFcName="log_Reports"></param> public override void Execute4_OnLr( object sender, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "Execute4_OnLr", log_Reports); // // Customcontrol cct = null; // // コントロール名。 // string sName_Usercontrol; if (sender is Customcontrol) { cct = (Customcontrol)sender; sName_Usercontrol = cct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe = "[" + sName_Usercontrol + "]コントロールでWrRhnアクションが実行されました。"; // ステータスバーに、コントロール名を表示。 //cct.ControlCommon.MoControlMediator.AddStatus_ActionFcName(sName_Usercontrol, log_Reports); } else { sName_Usercontrol = ""; log_Reports.Comment_EventCreationMe = "WrRhnアクションが実行されました。"; } // // ストップウォッチ。 // if (log_Reports.CanStopwatch) { pg_Method.Log_Stopwatch.Message = Utility_Format.Format( sName_Usercontrol, this.ConfigurationtreeToExpression_Event.Name ); pg_Method.Log_Stopwatch.Begin(); } // // 「登録アクション設定」を元に、「アクション」を作成し、実行順に実行。 // if (!this.ConfigurationtreeToExpression_Event.IsTranslated_ConfigurationtreeToExpression) { this.ConfigurationtreeToExpression_Event.Translate(cct.ControlCommon.Owner_MemoryApplication, log_Reports); } //EnumEventhandler err_Eh; if (log_Reports.Successful) { foreach (Expression_Node_Function expr_Func in this.List_Item) { // // 登録アクション作成・実行ループ。 // expr_Func.Execute4_OnLr( sender, log_Reports ); } } goto gt_EndMethod; // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// アクション実行。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); // // if (this.EnumEventhandler == EnumEventhandler.O_Lr) { if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports ); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + this.GetType().Name + "]を実行。"; } else { log_Reports.Comment_EventCreationMe += "/追記:[" + this.GetType().Name + "]を実行。"; } // // // // this.Execute6_Sub( log_Reports ); } else if (this.EnumEventhandler == EnumEventhandler.O_Ea) { if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports ); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + this.GetType().Name + "]を実行。"; } else { log_Reports.Comment_EventCreationMe += "/追記:[" + this.GetType().Name + "]を実行。"; } this.Execute6_Sub( log_Reports ); } // // log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// 実行。 /// </summary> /// <param name="sender"></param> /// <param name="eventMonitor"></param> /// <param name="log_Reports"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "「E■[" + sFncName0 + "]アクション」実行(A)"; log_Method.Log_Stopwatch.Begin(); } if (this.EnumEventhandler == EnumEventhandler.O_Lr) { string sName_Usercontrol; if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender; sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { sName_Usercontrol = "(▲不明101!)"; log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。"; } // // // // List <Usercontrol> ucFcList; if (log_Reports.Successful) { // 正常時 // テーブルデータをコントロールにセットします。 // // 指定のコントロール(無指定の場合、自コントロール)を // まず取得。 // Expression_Node_String ec_ArgListboxName; this.TrySelectAttribute(out ec_ArgListboxName, Expression_Node_Function20Impl.PM_NAME_CONTROL_LISTBOX, EnumHitcount.One_Or_Zero, log_Reports); ucFcList = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_ArgListboxName, true, log_Reports); } else { ucFcList = new List <Usercontrol>(); } // リストボックスにテーブルのデータソースを関連付けます。 if (log_Reports.Successful) { // 正常時 // リストボックス コントロール。 Usercontrol fcUc = ucFcList[0]; Expression_Node_String ec_TableName = null; string sTableName; this.TrySelectAttribute(out sTableName, Expression_Node_Function20Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); if ("" != sTableName)//this.E_SysArgDic.ContainsKey(E_SysFnc20Impl.S_ARG_TABLE_NAME) { //テーブル名を指定(アクション用引数) this.TrySelectAttribute(out ec_TableName, Expression_Node_Function20Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <arg3 tableName=”[" + ec_TableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]”>属性でした。"); } } else { // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <arg3 tableName=”☆”>属性が未指定でした。"); } Configuration_Node owner_Configurationtree_Control; { owner_Configurationtree_Control = this.Cur_Configuration.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); } // // 次を期待。 // <data target=”list-box”> // <arg5 name=”tableName” value=”☆”> // List <Configurationtree_Node> cfList_Data = ((Configurationtree_Node)owner_Configurationtree_Control).GetChildrenByNodename( NamesNode.S_DATA, false, log_Reports); foreach (Configurationtree_Node cf_Data in cfList_Data) { string sAccess; cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_ACCESS, out sAccess, false, log_Reports); List <string> sList_Access = new CsvTo_ListImpl().Read(sAccess); if (sList_Access.Contains(ValuesAttr.S_FROM)) { // <data access=”from”> string sDataMemory; cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_MEMORY, out sDataMemory, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } if (ValuesAttr.S_RECORDS == sDataMemory) { cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_TABLE, out sTableName, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } ec_TableName = new Expression_Leaf_StringImpl(sTableName, this, cf_Data); // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <data tableName=”[" + sTableName + "]”>属性でした。"); } } else { //#連続エラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sDataMemory, log_Reports);//属性memoryの値 this.Owner_MemoryApplication.CreateErrorReport("Er:110007;", tmpl, log_Reports); } } } } if (null == ec_TableName) { // エラー処理? if (log_Method.CanError()) { log_Method.WriteError_ToConsole(" 直接指定されなかったので、既に<data>にtableName属性があると期待しましたが、ありませんでした。"); } sTableName = ""; //string sTableName = ""; ec_TableName = new Expression_Leaf_StringImpl(sTableName, this, owner_Configurationtree_Control); // owner_Cf_Fc.S_DataSource } } //↓この中で時間かかってる。 Utility_Listbox.BindTableToDatasource( fcUc,// リストボックス・コントロール ec_TableName, this.Owner_MemoryApplication, log_Reports ); //↑この中で時間かかってる。 } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(""); }
public void TryGetFilepath_Configurationtree(out Configurationtree_NodeFilepath out_Value, string sName, bool bRequired, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "TryGetFilepath_Configurationtree", log_Reports); // if (!this.Dictionary_Field.ContainsKey(sName)) { //該当なし。 if (bRequired) { out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。 goto gt_Error_NotFound; } else { out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。 goto gt_EndMethod; } } FieldUserformtable fo_Field = this.Dictionary_Field[sName]; if (EnumTypedb.ConfFilepath != fo_Field.EnumTypedb) { //型が異なる。 if (bRequired) { out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。 goto gt_Error_Type; } else { out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。 goto gt_EndMethod; } } out_Value = (Configurationtree_NodeFilepath)fo_Field.Data; goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFound: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports);//フィールド名 memoryApplication.CreateErrorReport("Er:6007;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Type: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports); //フィールド名 tmpl.SetParameter(2, fo_Field.EnumTypedb.ToString(), log_Reports); //フィールドの型名 memoryApplication.CreateErrorReport("Er:6008;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 『ツール設定ファイル』へ書き出します。 /// </summary> /// <param name="toolConfigXmlFileAbsPath"></param> /// <param name="applicationName"></param> /// <param name="inputs"></param> /// <param name="runningHintName"></param> public void Write( string sFpatha_Config_Tool, string sName_Application, Dictionary_AatoolxmlEditor dic_AatoolxmlEditor, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "Write", log_Reports); XmlDocument xDoc = new XmlDocument(); // UTF-8 エンコーディングで書くものとします。 XmlProcessingInstruction xPi = xDoc.CreateProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); xDoc.AppendChild(xPi); // 説明文の記述 { StringBuilder sbText1 = new StringBuilder(); sbText1.Append("このファイルは、UTF-8(BOM無し) エンコーディングで記述してください。"); xDoc.AppendChild(xDoc.CreateComment(sbText1.ToString())); } Exception err_Excp; try { // ルート要素を作成 System.Xml.XmlElement xRoot = xDoc.CreateElement(NamesNode.S_CODEFILE_TOOL); // // これは書出しなので、スクリプトファイルのバージョンチェックを省略。 // xRoot.SetAttribute("application", sName_Application); xDoc.AppendChild(xRoot); // 説明文の記述 { StringBuilder sb1 = new StringBuilder(); sb1.Append("このファイルは、恐らく『"); sb1.Append(sName_Application); sb1.Append("』によって読書きされるかと思います。"); xRoot.AppendChild(xDoc.CreateComment(sb1.ToString())); } // エディター要素: foreach (MemoryAatoolxml_Editor aatool_Editor in dic_AatoolxmlEditor.Dictionary_Item.Values) { XmlElement xEditor = xDoc.CreateElement(NamesNode.S_EDITOR); // input要素: aatool_Editor.Dictionary_Fsetvar_Configurationtree.List_Child.ForEach(delegate(Configurationtree_Node s_Fsetvar, ref bool bBreak) { XmlElement x_Input = xDoc.CreateElement(NamesNode.S_F_SET_VAR); //name-var属性 string sNamevar; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_VAR, out sNamevar, true, log_Reports); //folder属性 string sFolder; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, true, log_Reports); //value属性 string sValue; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue, true, log_Reports); //description属性 string sDescription; s_Fsetvar.Dictionary_Attribute.TryGetValue(PmNames.S_DESCRIPTION, out sDescription, true, log_Reports); x_Input.SetAttribute(PmNames.S_NAME.Name_Attribute, sNamevar); x_Input.SetAttribute(PmNames.S_FOLDER.Name_Attribute, sFolder); x_Input.SetAttribute(PmNames.S_VALUE.Name_Attribute, sValue); x_Input.SetAttribute(PmNames.S_DESCRIPTION.Name_Attribute, sDescription); xEditor.AppendChild(x_Input); }); xRoot.AppendChild(xEditor); } // .xmlファイルの中身全文を保存。 xDoc.Save(sFpatha_Config_Tool); } catch (Exception ex) { // エラー err_Excp = ex; goto gt_Error_Exception; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー351!", log_Method); StringBuilder s = new StringBuilder(); s.Append("『ツール設定ファイル』への書き出しに失敗しました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_SException(err_Excp)); r.Message = r.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── /// <summary> /// スタイルシート・テーブルは、最低限「NAME」「STYLE」の2つで構成されたテーブルです。 /// </summary> /// <param name="oStyleSheetTable"></param> /// <returns></returns> public MemoryStyles Translate( Table_Humaninput xenonTable_Stylesheet, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "MToO", log_Reports); // // // // if (null == xenonTable_Stylesheet) { goto gt_Error_NullTable; } MemoryStyles oStyleAttrList = new MemoryStylesImpl(); int nIndex = 0; foreach (DataRow dataRow in xenonTable_Stylesheet.DataTable.Rows) { string sId; if (log_Reports.Successful) { // 正常時 Value_Humaninput valueH; if (log_Reports.Successful) { // 正常時 valueH = Utility_Row.GetFieldvalue( "NAME", dataRow, true, log_Reports, "スタイルシートテーブル(NAME検索時)" ); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } else { valueH = null; } if (log_Reports.Successful) { // 正常時 sId = ((Value_Humaninput)valueH).Text;//"スタイルシートテーブルパーサーのID" } else { sId = ""; } } else { sId = ""; } string sStyle; if (log_Reports.Successful) { // 正常時 Value_Humaninput valueH = Utility_Row.GetFieldvalue( "STYLE", dataRow, true, log_Reports, "スタイルシートテーブル(STYLE検索時)" ); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } sStyle = ((Value_Humaninput)valueH).Text;//"スタイルシートテーブルパーサーのSTYLE" } else { sStyle = ""; } RecordXenonStyle item = new RecordXenonStyleImpl(); item.Id = sId; item.Style = sStyle; oStyleAttrList.Dictionary_RecordStyle.Add(sId, item); nIndex++; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullTable: { oStyleAttrList = null; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー99999!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("テーブルがヌルでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); return(oStyleAttrList); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void Perform() { Log_Method log_Method = new Log_MethodImpl(0); Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method); log_Method.BeginMethod(Info_PartsnumPut.Name_Library, this, "Perform", log_Reports_ThisMethod); this.In_UsercontrolCanvas.ClearNumSps(true); log_Method.WriteDebug_ToConsole("Performを実行しました。"); // // テーブル読取 // //Dictionary<string, int> dictionary_NameField = new Dictionary<string, int>(); //欲しい列が何番目にあるかを調べます。 int row = 0; // 「NO」、「DISPLAY」、「LAYER」「X」「Y」「FONT_SIZE」「COLOR_BG」(「END」)の8フィールドがある。 int indexColumn_Display = -1; int indexColumn_Text = -1; int indexColumn_Layer = -1; int indexColumn_X = -1; int indexColumn_XLt = -1; int indexColumn_Y = -1; int indexColumn_YLt = -1; int indexColumn_FontSize = -1; int indexColumn_FontSizePt = -1; int indexColumn_ColorBg = -1; int indexColumn_BackColor = -1; //this.in_Table_Humaninput.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2) //{ //},log_Reports_ThisMethod); // 列のindex。該当がなければ-1。 indexColumn_Display = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("DISPLAY"); indexColumn_Text = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("TEXT"); indexColumn_Layer = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("LAYER"); indexColumn_X = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("X"); indexColumn_XLt = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("X_LT"); indexColumn_Y = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("Y"); indexColumn_YLt = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("Y_LT"); indexColumn_FontSize = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("FONT_SIZE"); indexColumn_FontSizePt = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("FONT_SIZE_PT"); indexColumn_ColorBg = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("COLOR_BG"); indexColumn_BackColor = this.in_Table_Humaninput.RecordFielddefinition.ColumnIndexOf_Trimupper("BACK_COLOR"); this.in_Table_Humaninput.ForEach_Datapart(delegate(Record_Humaninput recordH, ref bool isBreak1, Log_Reports log_Reports1) { //log_Method.WriteDebug_ToConsole("row=[" + row + "] recordH.ToString_DebugDump()=[" + recordH.ToString_DebugDump() + "]"); //if (row == 0) //{ // // 上1行は「列名」。 // //log_Method.WriteDebug_ToConsole("indexColumn_BackColor=[" + indexColumn_BackColor + "] recordH.ToString_DebugDump()=[" + recordH.ToString_DebugDump()+ "]"); // goto gt_LastLoop; //} //else if (row < 3) //{ // // 上3行(row=0,1,2)は「列名」「型」「解説」として無視。 // goto gt_LastLoop; //} // 左端に EOF が入っていれば終了。 if ("EOF" == recordH.ValueAt(0).Text.Trim()) { isBreak1 = true; goto gt_LastLoop; } Memory4bSpritePartsnumberImpl memSpriteNum = new Memory4bSpritePartsnumberImpl(); memSpriteNum.Delegate_OnChangeSprite_Partsnumber = this.In_UsercontrolCanvas.UsercontrolCanvas_OnChangeSpritePartsnumber; //表示テキスト { if (0 <= indexColumn_Text) { memSpriteNum.Text = recordH.ValueAt(indexColumn_Text).Text; } else if (0 <= indexColumn_Display) { //旧仕様 memSpriteNum.Text = recordH.ValueAt(indexColumn_Display).Text; } } //レイヤー if (0 <= indexColumn_Layer) { int nLayer = 0; int.TryParse(recordH.ValueAt(indexColumn_Layer).Text, out nLayer); memSpriteNum.Number_Layer = nLayer; } //座標 { //左辺x int x = 0; { if (0 <= indexColumn_XLt) { int.TryParse(recordH.ValueAt(indexColumn_XLt).Text, out x); } else if (0 <= indexColumn_X) { int.TryParse(recordH.ValueAt(indexColumn_X).Text, out x); } } //上辺y int y = 0; { if (0 <= indexColumn_YLt) { int.TryParse(recordH.ValueAt(indexColumn_YLt).Text, out y); } else if (0 <= indexColumn_Y) { int.TryParse(recordH.ValueAt(indexColumn_Y).Text, out y); } } memSpriteNum.LocationOnBackgroundActual = new PointF(x, y); } //フォントサイズ(1以上の数字なら有効) { int fontsize = -1; if (0 <= indexColumn_FontSizePt) { if (int.TryParse(recordH.ValueAt(indexColumn_FontSizePt).Text, out fontsize)) { fontsize = -1; } } else if (0 <= indexColumn_FontSize) { //旧仕様 if (int.TryParse(recordH.ValueAt(indexColumn_FontSize).Text, out fontsize)) { fontsize = -1; } } if (1 <= fontsize) { memSpriteNum.Font = new System.Drawing.Font("MS ゴシック", (float)fontsize); } } //背景色 { string name_Color = ""; if (0 <= indexColumn_BackColor) { name_Color = recordH.ValueAt(indexColumn_BackColor).Text; } else if (0 <= indexColumn_ColorBg) { //旧仕様 name_Color = recordH.ValueAt(indexColumn_ColorBg).Text; } switch (name_Color) { case "Green": memSpriteNum.BrushBackground = Brushes.Green; break; default: memSpriteNum.BrushBackground = Brushes.Blue; break; } } this.In_UsercontrolCanvas.AddNumSp(memSpriteNum, true); // gt_LastLoop://continueを使わない。 row++; }, log_Reports_ThisMethod); this.In_UsercontrolCanvas.After_AddSpriteList(); // フォームを再描画。 this.In_UsercontrolCanvas.Refresh(); // goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports_ThisMethod); return; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void CreateErrorReport( string errorSymbol, Builder_TexttemplateP1p texttemplateBuilder_ParameterSetted, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "CreateErrorReport", log_Reports); // int errorNumber; { string tempErrorSymbol = errorSymbol; if (tempErrorSymbol.StartsWith("Er:")) { tempErrorSymbol = tempErrorSymbol.Substring(3); if (tempErrorSymbol.EndsWith(";")) { tempErrorSymbol = tempErrorSymbol.Substring(0, tempErrorSymbol.Length - 1); if (int.TryParse(tempErrorSymbol, out errorNumber)) { } else { goto gt_Error_Symbol; } } else { goto gt_Error_Symbol; } } else { goto gt_Error_Symbol; } } if (log_Reports.CanCreateReport) { string strTypedata = ValuesTypeData.S_TABLE_ERRORMESSAGES; Configurationtree_Node cur_Ct = new Configurationtree_NodeImpl(log_Method.Fullname, null); List <Table_Humaninput> tables = this.MemoryTables.GetTable_HumaninputByTypedata( new Expression_Leaf_StringImpl(strTypedata, null, cur_Ct), true, log_Reports); bool hit = false; foreach (Table_Humaninput table in tables) { foreach (DataRow dataRow in table.DataTable.Rows) { Int_HumaninputImpl xenonValue_Int = (Int_HumaninputImpl)dataRow["ID"]; int valueInt; xenonValue_Int.TryGet(out valueInt); if (valueInt == errorNumber) { //ヒット hit = true; Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:" + errorNumber + ";", log_Method); String_HumaninputImpl xenonValue_String = (String_HumaninputImpl)dataRow["MESSAGE"]; string valueStr; xenonValue_String.TryGet(out valueStr); texttemplateBuilder_ParameterSetted.Text = valueStr; r.Message = texttemplateBuilder_ParameterSetted.Compile(log_Reports).Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); //log_Method.WriteDebug_ToConsole(texttemplateBuilder_ParameterSetted.Compile(log_Reports).Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); goto gt_EndLoop1; } } } gt_EndLoop1: if (!hit) { //エラーメッセージの登録がない。 Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("Er:0;", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("エラーメッセージテーブルに、エラーメッセージの登録がありませんでした。\n%1%=[%2%]\nテーブル数=[%3%]"); Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(s.ToString()); tmpl.SetParameter(1, NamesFld.S_TYPE_DATA, log_Reports); tmpl.SetParameter(2, strTypedata, log_Reports); tmpl.SetParameter(3, tables.Count.ToString(), log_Reports); r.Message = tmpl.Compile(log_Reports).Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } log_Reports.EndCreateReport(); } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_Symbol: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー204!", log_Method); StringBuilder s = new StringBuilder(); s.Append("エラーシンボルがおかしい。[" + errorSymbol + "]。プログラムのミス?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected override void Parse_ChildNodes( XmlElement cur_X, Configurationtree_Node cur_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "Parse_ChildNodes", log_Reports); // // XmlElement err_XAEelem66 = null; // <a-empty-field>要素のリスト XmlNodeList child_XNl = cur_X.ChildNodes; foreach (XmlNode child_XNode in child_XNl) { if (XmlNodeType.Element == child_XNode.NodeType) { XmlElement xChild = (XmlElement)child_XNode; err_XAEelem66 = xChild; string sName_Fnc = xChild.GetAttribute(PmNames.S_NAME.Name_Attribute); if (NamesFnc.S_VLD_EMPTY_FIELD == sName_Fnc) { // // <a-empty-field>要素 XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByFncName(sName_Fnc, log_Reports); to.XmlToConfigurationtree( xChild, cur_Cf, memoryApplication, log_Reports ); } else { // // エラー。 goto gt_Error_UndefinedChild13; } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedChild13: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー411!", log_Method); StringBuilder t = new StringBuilder(); t.Append("<f-all-true>要素に、<a-emtpy-field>要素以外の要素"); t.Append(Environment.NewLine); t.Append("["); t.Append(err_XAEelem66.Name); t.Append("]が含まれていました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// TODO:「,」「"」に対応したい。 /// /// /// 縦、横がひっくり返っていて、 /// 型定義レコードがないCSVテーブルの読取。 /// </summary> /// <param name="csvText"></param> /// <returns>列名情報も含むテーブル。</returns> public Table_Humaninput Read( string string_Csv, Request_ReadsTable forTable_Request, Format_Table_Humaninput forTable_Format, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Read", log_Reports); // // // // CsvLineParserImpl csvParser = new CsvLineParserImpl(); Table_Humaninput xenonTable = new Table_HumaninputImpl( forTable_Request.Name_PutToTable, forTable_Request.Expression_Filepath, forTable_Request.Expression_Filepath.Cur_Configuration); xenonTable.Tableunit = forTable_Request.Tableunit; xenonTable.Typedata = forTable_Request.Typedata; xenonTable.IsDatebackupActivated = forTable_Request.IsDatebackupActivated; xenonTable.Format_Table_Humaninput = forTable_Format; // // 一旦、テーブルを全て読み込みます。 // List <List <string> > lines = new List <List <string> >(); { // CSVテキストを読み込み、型とデータのバッファーを作成します。 System.IO.StringReader reader = new System.IO.StringReader(string_Csv); string[] sFields; while (-1 < reader.Peek()) { string sLine = reader.ReadLine(); List <string> tokens = new List <string>(); sFields = csvParser.UnescapeLineToFieldList(sLine, this.charSeparator).ToArray(); int nColumnIndex = 0; foreach (string sToken in sFields) { if (nColumnIndex == 0 && ToCsv_Table_Humaninput_RowColRegularImpl.S_END == sToken.Trim().ToUpper()) { // 1列目にENDがある場合、その手前までの列が有効データです。 // END以降の行は無視します。 goto row_end; } tokens.Add(sToken); nColumnIndex++; } lines.Add(tokens); } row_end: // ストリームを閉じます。 reader.Close(); } // // 型定義部 // // (※NO,ID,EXPL,NAME など、フィールドの定義を持つテーブル) // RecordFielddefinition recordFielddefinition = new RecordFielddefinitionImpl(); // // データ・テーブル部 // List <List <string> > rows = new List <List <string> >(); // // まず、0列目、1列目のデータを読み取ります。 // int nRowIndex = 0; foreach (List <string> tokens in lines) { Fielddefinition fieldDefinition = null; int nColumnIndex = 0; foreach (string sToken in tokens) { if (0 == nColumnIndex) { // // 0列目は、フィールド名です。 // string sFieldName = sToken;//.Trim().ToUpper(); // テーブルのフィールドを追加します。フィールドの型は、intに固定です。 fieldDefinition = new FielddefinitionImpl(sFieldName, EnumTypeFielddefinition.Int); recordFielddefinition.Add(fieldDefinition); } else if (1 == nColumnIndex) { // // 1列目は、フィールドのコメントとします。 // nColumnIndex = 1; { fieldDefinition.Comment = sToken; } } else { // // 2列目から右側は、データ・テーブル部。 // if (0 == nRowIndex) { // // 先頭行 // // // 「EOF」というトークンが出てくるまで。 // if (ToCsv_Table_Humaninput_RowColRegularImpl.S_EOF == sToken.Trim().ToUpper()) { goto column_end; } List <string> record = new List <string>(); // 1番目のフィールド_データを追加。 record.Add(sToken); rows.Add(record); } else { // // 2番目以降のフィールド_データを追加。 // // // 先頭の2つのレコード分、切り詰めます。 // int nDataIndex = nColumnIndex - 2; if (nDataIndex < rows.Count) { List <string> record = rows[nDataIndex]; record.Add(sToken); } else { // 無視 } } } nColumnIndex++; }//c column_end: nRowIndex++; } //essageBox.Show("CSV読取終わり1 rows.Count=[" + rows.Count + "]", "TableCsvLibデバッグ"); // テーブル作成。テーブルのフィールド型定義と、データ本体をセットします。 xenonTable.CreateTable(recordFielddefinition, log_Reports); if (log_Reports.Successful) { xenonTable.AddRecordList(rows, recordFielddefinition, log_Reports); //essageBox.Show("CSV読取後のテーブル作成終わり", "TableCsvLibデバッグ"); } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(xenonTable); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// スタイルシート設定ファイルを読み込んでおきます。 /// </summary> /// <param name="moMre"></param> /// <param name="log_Reports"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // if (this.EnumEventhandler == EnumEventhandler.O_Lr) { if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。"; } // // // // string sStartupPath = Application.StartupPath; if (log_Reports.Successful) { // 正常時 Expression_Node_String ec_ArgTableNameStylesheet; this.TrySelectAttribute(out ec_ArgTableNameStylesheet, Expression_Node_Function19Impl.PM_NAME_TABLE_STYLESHEET, EnumHitcount.One_Or_Zero, log_Reports); // スタイルシート・テーブル Table_Humaninput o_Table_Stylesheet = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( ec_ArgTableNameStylesheet, true, log_Reports ); this.Owner_MemoryApplication.MemoryStyles.Clear(o_Table_Stylesheet, log_Reports); } else { // 異常時 this.Owner_MemoryApplication.MemoryStyles.Clear(log_Reports); } } // // log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── protected override Configurationtree_Node CreateMyself( XmlElement cur_X, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "CreateMyself", log_Reports); if (log_Method.CanDebug(1)) { } // // Configurationtree_Node cur_Cf = null; // // name属性は必須。 // string sName_Fnc = cur_X.GetAttribute(PmNames.S_NAME.Name_Attribute); if ("" == sName_Fnc) { goto gt_Error_UndefinedFncNameAttr; } // // if ( NamesFnc.S_CELL == sName_Fnc || //Sf:cell; NamesFnc.S_WHERE == sName_Fnc || //Sf:where; NamesFnc.S_REC_COND == sName_Fnc || //Sf:rec-cond; NamesFnc.S_VALUE_CONTROL == sName_Fnc || NamesFnc.S_CASE == sName_Fnc || //Sf:case;” NamesFnc.S_LISTBOX_LABELS == sName_Fnc || //Sf:list-box-labels; NamesFnc.S_SWITCH == sName_Fnc || //Sf:switch; NamesFnc.S_ITEM_LABEL2 == sName_Fnc || //Sf:item-label; NamesFnc.S_ITEM_VALUE == sName_Fnc || //Sf:item-value; NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc || //Sf:item-gray-out; NamesFnc.S_TEXT_TEMPLATE == sName_Fnc || //Sf:text-template; NamesFnc.S_EMPTY_FIELD == sName_Fnc || NamesFnc.S_ALL_TRUE == sName_Fnc ) { cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf); } else if (NamesNode.S_DATA == cur_X.Name) { // 【追加】 cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_DATA, parent_Cf); } else if (NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc) { // ノード名は fnc では。 cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_A_RECORD_SET_SAVE_TO, parent_Cf); } else { // <fnc name=”Sa:入力値の確定;”> // などがここにくる。 cur_Cf = new Configurationtree_NodeImpl(NamesNode.S_FNC, parent_Cf); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedFncNameAttr: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー412!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<fnc>要素に、name属性が指定されていませんでした。"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(cur_Cf); }
//──────────────────────────────────────── private void Usercontrol_Canvas_DragDrop(object sender, DragEventArgs e) { Log_Method log_Method = new Log_MethodImpl(); Log_Reports log_Reports = new Log_ReportsImpl(log_Method); log_Method.BeginMethod(Info_SpeedCoder.Name_Library, this, "Usercontrol_Canvas_DragDrop", log_Reports); Point locationMouse = this.PointToClient(new Point(e.X, e.Y)); bool isDropped = false; if (e.Data.GetDataPresent(DataFormats.FileDrop)) { // ファイルドロップ TextdropareaImpl droppedArea = null; string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop, false); if (this.Textdroparea1.Bounds.Contains(locationMouse.X, locationMouse.Y)) { droppedArea = this.Textdroparea1; } if (this.Textdroparea2.Bounds.Contains(locationMouse.X, locationMouse.Y)) { droppedArea = this.Textdroparea2; } if (null != droppedArea) { droppedArea.IsDropped = true; droppedArea.Clear(); //log_Method.WriteDebug_ToConsole("ファイルをドロップした。 fileNames.length=[" + fileNames.Length + "]"); foreach (string fileName in fileNames) { droppedArea.ListFilepath.Add(fileName); //log_Method.WriteDebug_ToConsole("fileName=[" + fileName + "]"); } isDropped = true; } else { //log_Method.WriteDebug_ToConsole("ファイルをドロップしたが、枠には入っていない。 fileNames.length=[" + fileNames.Length + "]"); } } else if (e.Data.GetDataPresent(DataFormats.StringFormat)) { // 文字列として読み取れる形式のデータがドロップされた場合、 // テキストボックスに、その文字列データを表示します。 string droppedText = (string)e.Data.GetData(typeof(string)); TextdropareaImpl droppedArea = null; if (this.Textdroparea1.Bounds.Contains(locationMouse.X, locationMouse.Y)) { droppedArea = this.Textdroparea1; } if (this.Textdroparea2.Bounds.Contains(locationMouse.X, locationMouse.Y)) { droppedArea = this.Textdroparea2; } if (null != droppedArea) { droppedArea.IsDropped = true; droppedArea.Clear(); droppedArea.DroppedText = droppedText; isDropped = true; } } else { //log_Method.WriteDebug_ToConsole("ファイル以外のものをドロップした。"); } if (isDropped) { //log_Method.WriteDebug_ToConsole("ドロップがあったとき。"); SpeedCodingImpl speedCoding = new SpeedCodingImpl(); bool isError; string result = speedCoding.Perform(out isError, this.Textdroparea1, this.Textdroparea2, log_Reports); this.textBox1.Text = result; if (isError) { this.textBox1.ForeColor = Color.Red; } else { this.textBox1.ForeColor = SystemColors.ControlText; } this.Refresh(); } //log_Method.WriteDebug_ToConsole("locationMouse.X=[" + locationMouse.X + "] .Y=[" + locationMouse.Y + "]"); //log_Method.WriteDebug_ToConsole("this.Textdroparea1.Bounds=[" + this.Textdroparea1.Bounds.X + "][" + this.Textdroparea1.Bounds.Y + "][" + this.Textdroparea1.Bounds.Width + "][" + this.Textdroparea1.Bounds.Height + "]"); //log_Method.WriteDebug_ToConsole("this.Textdroparea2.Bounds=[" + this.Textdroparea2.Bounds.X + "][" + this.Textdroparea2.Bounds.Y + "][" + this.Textdroparea2.Bounds.Width + "][" + this.Textdroparea2.Bounds.Height + "]"); log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 親要素に、この要素を追加。 /// </summary> protected override void LinkToParent( Configurationtree_Node cur_Cf, Configurationtree_Node parent_Cf, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "LinkToParent", log_Reports); // // name属性は必須。 // string sName_Fnc; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; //goto gt_Error_UndefinedFncNameAttr; } string parent_SName_Fnc; { // // ※注意 <data >も、<fnc >扱い。name属性を持っていない。 // bool bRequired = false; parent_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out parent_SName_Fnc, bRequired, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; //goto gt_Error_UndefinedFncNameAttr; } } if (NamesFnc.S_WHERE == sName_Fnc) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); // デバッグ出力 if (log_Method.CanDebug(1)) { Log_TextIndented s = new Log_TextIndentedImpl(); parent_Cf.ToText_Locationbreadcrumbs(s); //log_Method.WriteDebug_ToConsole( "<fnc name=”[" + sFncName + "]”>要素 親要素「S■[" + s_Parent.Name_Node + "]」の子リストに、自分を追加。 子要素の数は[" + s_Cur.CountChildNodes + "]でした。"); log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>要素 親要素「S■[" + parent_Cf.Name + "]」の『属性[" + cur_Cf.Name + "]』に、自分「S■[" + cur_Cf.Name + "]」を追加。 子要素の数は[" + cur_Cf.List_Child.Count + "]でした。 Place=[" + s.ToString() + "]"); } } else if (NamesFnc.S_CASE == sName_Fnc) { // // 親要素は Sf:switch; である必要があります。 // if (NamesFnc.S_SWITCH != parent_SName_Fnc) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー308!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("Sf:case;系要素の親は f-switch を期待します。"); s.Newline(); s.Newline(); s.Append("親ノード名=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } // 要素の(OAelemListではなく)OAcaseListに、この Sf:case; 要素を追加。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_ITEM_LABEL2 == sName_Fnc ) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_ITEM_VALUE == sName_Fnc ) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_ITEM_GRAY_OUT == sName_Fnc ) { // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_RECORD_SET_SAVE_TO2 == sName_Fnc ) { // // 暫定で、親要素は<f-all-true>である必要があります。 // if (NamesFnc.S_ALL_TRUE != parent_SName_Fnc) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー404!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<a-empty-field>系要素の親は <f-all-true> であることを期待します。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } if (!(NamesFnc.S_ALL_TRUE == parent_SName_Fnc)) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー403!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("内部プログラムのミス。"); s.Newline(); s.Append("<a-empty-field>系要素の親が、OFAllTrueImplクラスでありませんでした。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); s.Append("oFnode.GetType().Name=["); s.Append(parent_Cf.GetType().Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } // 親要素の(OAelemListではなく)OArecordSetSaveToListに、この<fnc name=”Sf:a-record-set-save-to;”>要素を追加。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else if ( NamesFnc.S_EMPTY_FIELD == sName_Fnc ) { // // 親要素は<f-all-true>である必要があります。 // if (NamesFnc.S_ALL_TRUE != parent_SName_Fnc) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー405!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("<a-empty-field>系要素の親は <f-all-true> であることを期待します。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } if (!(NamesFnc.S_ALL_TRUE == parent_SName_Fnc)) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー406!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("内部プログラムのミス。"); s.Newline(); s.Append("<a-empty-field>系要素の親が、OFAllTrueImplクラスでありませんでした。"); s.Newline(); s.Newline(); s.Append("oFnode.NodeName=["); s.Append(parent_Cf.Name); s.Append("]"); s.Newline(); s.Newline(); s.Append("oFnode.GetType().Name=["); s.Append(parent_Cf.GetType().Name); s.Append("]"); s.Newline(); s.Newline(); // ヒント s.Append(r.Message_Configuration(parent_Cf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; } // // <f-all-true> // // 親要素の(OAelemListではなく)OAemptyFldListに、この<a-empty-field>要素を追加。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); } else { // 親要素「S■??」に、この「S■fnc」要素を追加。 // 同名要素が複数個並ぶので、属性ではなく子要素として追加する。 // // // // 親へ連結。 // // // parent_Cf.List_Child.Add( cur_Cf, log_Reports ); if (log_Method.CanDebug(1)) { log_Method.WriteDebug_ToConsole("<fnc name=”[" + sName_Fnc + "]”>要素 親要素「S■[" + parent_Cf.Name + "]」の子リストに、自分を追加。 子要素の数は[" + cur_Cf.List_Child.Count + "]でした。"); } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── protected void Execute6_Sub( 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 sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // // // 指定された引数から、または、 // この<action>要素を含んでいる control要素から、コントロールの名前を取得。 List <Usercontrol> list_FcUc = new List <Usercontrol>(); if (log_Reports.Successful) { // 正常時 Expression_Node_String ec_FcName_Prm; this.TrySelectAttribute(out ec_FcName_Prm, Expression_Node_Function36Impl.PM_CONTROL_NAME, EnumHitcount.One_Or_Zero, log_Reports); string sFcName_Prm = ec_FcName_Prm.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_FcName = new List <Expression_Node_String>(); if ("" == sFcName_Prm) { // // fcName未設定時は、この<action>要素を含んでいるcontrol要素から // コントロールの名前を取得。 // Configuration_Node cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports); if (null != cf_Event) { Configuration_Node owner_Configurationtree_Control = cf_Event.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); if (null != owner_Configurationtree_Control) { string sName; bool bHit = ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, false, log_Reports); if (bHit) { Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, this.Cur_Configuration); ec_Str.AppendTextNode( sName, this.Cur_Configuration, log_Reports ); // 上書き ec_FcName_Prm = ec_Str; ecList_FcName.Add(ec_FcName_Prm); } else { } } else { //nFcName_prm = null; } } else { //nFcName_prm = null; } } else { // // fcName 指定時。 // カンマ区切りか確認。 CsvTo_ListImpl csvTo = new CsvTo_ListImpl(); List <string> sList_FcName_Prm = csvTo.Read(sFcName_Prm); foreach (string sFcName2 in sList_FcName_Prm) { // コントロール名。 Expression_Node_StringImpl ec_FcName4 = new Expression_Node_StringImpl(this, this.Cur_Configuration); ec_FcName4.AppendTextNode( sFcName2, this.Cur_Configuration, log_Reports ); ecList_FcName.Add(ec_FcName4); } } foreach (Expression_Node_String ec_FcName5 in ecList_FcName) { // // 指定のコントロール // List <Usercontrol> list_FcUc2 = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_FcName5, true, log_Reports ); if (0 < list_FcUc2.Count) { Usercontrol fcUc = list_FcUc2[0]; list_FcUc.Add(fcUc); } } } else { } foreach (Usercontrol fcUc in list_FcUc) { if (log_Reports.Successful) { //// //// 妥当性判定を行います。 //// //if (log_Reports.Successful) //{ // fcUc.JudgeValidity( // log_Reports // ); // //.WriteLine(this.GetType().Name + "#: ◆ 妥当性判定を行った。"); //} if (fcUc.ControlCommon.BAutomaticinputting) { // コンピューターにより自動入力されたとき。 } else { // 手入力による更新。 { ToMemory_Performer toM = new ExpressionDataTargetUpdaterImpl(); toM.ToMemory( "",// 空文字列 fcUc.ControlCommon.Expression_Control, fcUc.ControlCommon.Owner_MemoryApplication, log_Reports ); } } } } log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// レイアウト_レコードを元に、コントロールのスタイルを設定します。 /// </summary> /// <param nFcName="fo_Record"></param> /// <param nFcName="log_Reports"></param> public void SetupStyle( RecordUserformconfig fo_Record, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "SetupStyle", log_Reports); // // // 自動入力ここから this.ControlCommon.BAutomaticinputting = true; // リストボックスの Text プロパティーは無視。 bool bEnabled; fo_Record.TryGetBool(out bEnabled, NamesFld.S_ENABLED, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolEnabled = bEnabled; bool bVisible; fo_Record.TryGetBool(out bVisible, NamesFld.S_VISIBLE, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolVisible = bVisible; // 【特殊】チェックボックスの値の型 string sChkValueType; { fo_Record.TryGetString(out sChkValueType, NamesFld.S_CHK_VALUE_TYPE, false, "", this.ControlCommon.Owner_MemoryApplication, log_Reports); this.sUsercontrolChkvaluetype = sChkValueType.Trim(); if (ValuesAttr.S_EMPTY == this.sUsercontrolChkvaluetype) { this.EnumCheckboxValuetype = EnumCheckboxValuetype.Bool; } else if (ValuesAttr.S_ZERO_ONE == this.sUsercontrolChkvaluetype) { this.EnumCheckboxValuetype = EnumCheckboxValuetype.Zero_One; } else if (ValuesAttr.S_BOOL == this.sUsercontrolChkvaluetype) { this.EnumCheckboxValuetype = EnumCheckboxValuetype.Bool; } else { //エラー goto gt_Error_NotSupportedValue; } } // フォントの設定 { // フォント・サイズの設定 float nFontSizePt = Utility_Usercontrol.ParseFontSize(fo_Record, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.Font = new System.Drawing.Font("MS UI Gothic", nFontSizePt, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); } // タブ・インデックス int nTabIndex; fo_Record.TryGetInt(out nTabIndex, NamesFld.S_TAB_INDEX, false, -1, this.ControlCommon.Owner_MemoryApplication, log_Reports); if (nTabIndex < 0) { // 未指定の場合は変更しません。 } else { this.UsercontrolTabindex = nTabIndex; } int nAbsXLt; fo_Record.TryGetInt(out nAbsXLt, NamesFld.S_X_LT, false, -1, this.ControlCommon.Owner_MemoryApplication, log_Reports); int nAbsYLt; fo_Record.TryGetInt(out nAbsYLt, NamesFld.S_Y_LT, false, -1, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.Location = new System.Drawing.Point(nAbsXLt, nAbsYLt); int nWidth; fo_Record.TryGetInt(out nWidth, NamesFld.S_WIDTH, false, 1, this.ControlCommon.Owner_MemoryApplication, log_Reports); int nHeight; fo_Record.TryGetInt(out nHeight, NamesFld.S_HEIGHT, false, 1, this.ControlCommon.Owner_MemoryApplication, log_Reports); this.Size = new System.Drawing.Size(nWidth, nHeight); // 背景色の設定 string sBackColor; fo_Record.TryGetString(out sBackColor, NamesFld.S_BACK_COLOR, false, "", this.ControlCommon.Owner_MemoryApplication, log_Reports); this.UsercontrolBackcolor = sBackColor; // コントロールは不可視にする。 this.customcontrolCheckbox1.Visible = false; this.ControlCommon.BAutomaticinputting = false; // 自動入力ここまで goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotSupportedValue: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, this.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //コントロール名 tmpl.SetParameter(2, sChkValueType, log_Reports); //CHK_VALUE_TYPEフィールド値 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(fo_Record.Parent_TableUserformconfig.Cur_Configurationtree), log_Reports); //設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:519;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// アクション実行。 /// /// 引数が object と EventArgs の場合。 /// /// ListBox の「項目選択時」は、これではなく、 /// NEventPerformer_ListboxImpl#Perform_OEa /// を使ってください。 /// /// 数値ボックスの "Se:値変更時;" は、ここにくる。 /// </summary> /// <param nFcName="sender"></param> /// <param nFcName="e"></param> public override void Execute4_OnOEa( object sender, EventArgs e ) { Log_Method pg_Method = new Log_MethodImpl(0); Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(pg_Method); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "Execute4_OnOEa", log_Reports_ThisMethod); // // Customcontrol cct = null; // // コントロール名。 // string sName_Usercontrol; if (sender is Customcontrol) { cct = (Customcontrol)sender; sName_Usercontrol = cct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports_ThisMethod); log_Reports_ThisMethod.Comment_EventCreationMe = "[" + sName_Usercontrol + "]コントロールでOEaアクションが実行されました。"; // ステータスバーに、コントロール名を表示。 //cct.ControlCommon.MoControlMediator.AddStatus_ActionFcName(sName_Usercontrol, d_Logging_Dammy); } else { sName_Usercontrol = ""; log_Reports_ThisMethod.Comment_EventCreationMe = "OEaアクションが実行されました。"; } // // ストップウォッチ // if (log_Reports_ThisMethod.CanStopwatch) { pg_Method.Log_Stopwatch.Message = Utility_Format.Format( sName_Usercontrol, this.ConfigurationtreeToExpression_Event.Name ); pg_Method.Log_Stopwatch.Begin(); } // // // // //ystem.Console.WriteLine(Info_Forms.LibraryName + ":" + this.GetType().Name + "#Perform_OEa: 何回呼び出される?(A)"); // // 登録アクション作成・実行ループ。 // // // 「登録アクション設定」を元に、「アクション」を作成し、実行順に実行。 // if (!this.ConfigurationtreeToExpression_Event.IsTranslated_ConfigurationtreeToExpression) { // まだアクションが作成されていなければ、作成。 this.ConfigurationtreeToExpression_Event.Translate(cct.ControlCommon.Owner_MemoryApplication, log_Reports_ThisMethod); } //EnumEventhandler err_Eh; if (log_Reports_ThisMethod.Successful) { // 登録されているアクションを実行。 foreach (Expression_Node_Function expr_Func in this.List_Item) { expr_Func.Execute4_OnOEa(sender, e); } } goto gt_EndMethod; // gt_EndMethod: pg_Method.EndMethod(log_Reports_ThisMethod); log_Reports_ThisMethod.EndLogging(pg_Method); }