/// <summary>動的に追加したコントロールをLstUserControlに追加する</summary> /// <param name="sender">object</param> /// <param name="e">ControlEventArgs</param> private void groupBox_ControlAdded(object sender, ControlEventArgs e) { // UOC_イベントハンドラ内で追加/削除すると例外が発生するのでBeginInvokeで書く。 this.BeginInvoke( (MethodInvoker <Control>)((x) => { // UserControlの追加処理 if (x is UserControl) { // コントロール検索&イベントハンドラ設定(ルートから1回だけ行う) RcFxCmnFunction.GetCtrlAndSetClickEventHandler2( x, this.CreatePrefixAndEvtHndHt(), this.ControlHt); // Base RcMyCmnFunction.GetCtrlAndSetClickEventHandler2( x, this.MyCreatePrefixAndEvtHndHt(), this.ControlHt); // MyBase // UserControlのLstUserControlへの追加(は再帰的に行う) this.AddToLstUserControl(x); } }), new object[] { e.Control }); }
/// <summary>Form_Loadのイベントハンドラ</summary> private void Form_Load(object sender, EventArgs e) { try { #region ウィンドウ数・インスタンス管理 //lock (_lock) //{ // ウィンドウ数管理 // - 全Form型 ++BaseControllerWin._intWindowsCount; // - 当該Form型 if (BaseControllerWin._dicWindowsCount.ContainsKey(this.GetType())) { // 初回以降(インクリメント) int i = BaseControllerWin._dicWindowsCount[this.GetType()]; BaseControllerWin._dicWindowsCount[this.GetType()] = ++i; } else { // 初回(初期化) BaseControllerWin._dicWindowsCount[this.GetType()] = 1; } // ウィンドウ インスタンス管理 if (BaseControllerWin._windowInstances.ContainsKey(this.GetType())) { // 初回以降(インクリメント) List <Form> list = BaseControllerWin._windowInstances[this.GetType()]; list.Add(this); BaseControllerWin._windowInstances[this.GetType()] = list; } else { // 初回(初期化) List <Form> list = new List <Form>(); list.Add(this); BaseControllerWin._windowInstances[this.GetType()] = list; } //} #endregion #region コントロールの初期化 if (!this.IsInitializedEvent) { // ユーザ コントロールの検索&取得 this.GetUserControl(this); // コントロール検索&取得&イベントハンドラ設定 RcFxCmnFunction.GetCtrlAndSetClickEventHandler2( this, this.CreatePrefixAndEvtHndHt(), this.ControlHt); } #endregion #region 画面の初期処理 this.UOC_CMNFormInit(); this.UOC_FormInit(); this.UOC_CMNAfterFormInit(); #endregion } catch (BusinessApplicationException baEx) { // アプリケーション例外発生時の処理は派生クラスに記述する。 this.UOC_ABEND(baEx, new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); // アプリケーション例外はリスローしない。 } catch (BusinessSystemException bsEx) { // システム例外発生時の処理は派生クラスに記述する。 this.UOC_ABEND(bsEx, new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); // システム例外はリスローする。 throw; } //catch (System.Threading.ThreadAbortException taEx) //{ // // スレッド中断エラーの場合は何もしない // Exception ex = taEx; // ← 警告を出さないため //} catch (Exception ex) { // 一般的な例外発生時の処理は派生クラスに記述する this.UOC_ABEND(ex, new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); // 一般的な例外はリスローする。 throw; } finally { // 初回のみ実行 this._isInitializedEvent = true; // Finally節のUOCメソッド this.UOC_Finally(new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); } }
/// <summary>Form_Loadのイベントハンドラ</summary> private void Form_Load(object sender, EventArgs e) { try { #region ウィンドウ数・インスタンス管理 //lock (_lock) //{ // ウィンドウ数管理 // 全Form型 ++BaseControllerWin._intWindowsCount; // 当該Form型 if (BaseControllerWin._dicWindowsCount.ContainsKey(this.GetType())) { // 初回以降(インクリメント) int i = BaseControllerWin._dicWindowsCount[this.GetType()]; BaseControllerWin._dicWindowsCount[this.GetType()] = ++i; } else { // 初回(初期化) BaseControllerWin._dicWindowsCount[this.GetType()] = 1; } // ・・・ // ウィンドウ インスタンス管理 if (BaseControllerWin._windowInstances.ContainsKey(this.GetType())) { // 初回以降(インクリメント) List <Form> list = BaseControllerWin._windowInstances[this.GetType()]; list.Add(this); BaseControllerWin._windowInstances[this.GetType()] = list; } else { // 初回(初期化) List <Form> list = new List <Form>(); list.Add(this); BaseControllerWin._windowInstances[this.GetType()] = list; } //} #endregion // ユーザ コントロールの初期化 this.GetUserControl(this); #region コントロール取得処理 #region 旧処理 //// BUTTON //RcFxCmnFunction.GetCtrlAndSetClickEventHandler( // this, GetConfigParameter.GetConfigValue(FxLiteral.PREFIX_OF_BUTTON), // new System.EventHandler(this.Button_Click), this.ControlHt); //// PICTURE BOX //RcFxCmnFunction.GetCtrlAndSetClickEventHandler( // this, GetConfigParameter.GetConfigValue(FxLiteral.PREFIX_OF_PICTURE_BOX), // new System.EventHandler(this.Button_Click), this.ControlHt); //// COMBO BOX //RcFxCmnFunction.GetCtrlAndSetClickEventHandler( // this, GetConfigParameter.GetConfigValue(FxLiteral.PREFIX_OF_COMBO_BOX), // new System.EventHandler(this.List_SelectedIndexChanged), this.ControlHt); //// LIST BOX //RcFxCmnFunction.GetCtrlAndSetClickEventHandler( // this, GetConfigParameter.GetConfigValue(FxLiteral.PREFIX_OF_LIST_BOX), // new System.EventHandler(this.List_SelectedIndexChanged), this.ControlHt); //// RADIO BUTTON //RcFxCmnFunction.GetCtrlAndSetClickEventHandler( // this, GetConfigParameter.GetConfigValue(FxLiteral.PREFIX_OF_RADIO_BUTTON), // new System.EventHandler(this.Check_CheckedChanged), this.ControlHt); #endregion // コントロール検索&イベントハンドラ設定 RcFxCmnFunction.GetCtrlAndSetClickEventHandler2( this, this.CreatePrefixAndEvtHndHt(), this.ControlHt); #endregion #region 画面の初期処理 this.UOC_CMNFormInit(); this.UOC_FormInit(); this.UOC_CMNAfterFormInit(); #endregion } catch (BusinessApplicationException baEx) { // アプリケーション例外発生時の処理は派生クラスに記述する。 this.UOC_ABEND(baEx, new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); // アプリケーション例外はリスローしない。 } catch (BusinessSystemException bsEx) { // システム例外発生時の処理は派生クラスに記述する。 this.UOC_ABEND(bsEx, new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); // システム例外はリスローする。 throw; } //catch (System.Threading.ThreadAbortException taEx) //{ // // スレッド中断エラーの場合は何もしない // Exception ex = taEx; // ← 警告を出さないため //} catch (Exception ex) { // 一般的な例外発生時の処理は派生クラスに記述する this.UOC_ABEND(ex, new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); // 一般的な例外はリスローする。 throw; } finally { // Finally節のUOCメソッド this.UOC_Finally(new RcFxEventArgs( FxLiteral.EVENT_FORM_LOAD, "", sender, e)); } }