} //HubEventHandler() // // // // #endregion//Private Methods #region Event Handlers // ***************************************************************** // **** Event Handlers **** // ***************************************************************** // // // **** Display_FormClosing() **** // /// <summary> /// Since this display is closing, lets request to remove it /// from receiving events in future. /// This should be called by a display that is closing. /// Called by external thread. /// </summary> private void Display_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs eventArg) { if (sender.GetType() == typeof(ClusterDisplay)) { DisplayArgs args = new DisplayArgs(); args.display = (ClusterDisplay)sender; args.Request = DisplayArgs.DisplayRequest.RemoveDisplay; HubEventEnqueue(args); } } // Display_FormClosing().
}//end constructor // // #endregion//Constructors #region no Properties // ***************************************************************** // **** Properties **** // ***************************************************************** // // #endregion//Properties #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** // // /// <summary> /// A new display is made and passed to this hub for management. /// Called by an external thread. /// </summary> /// <param name="aHub"></param> public void NewDisplay(ClusterDisplay newDisplay) { lock (NextClusterDisplayIDLock) { // Get next id number available. newDisplay.ID = m_NextClusterDisplayID; newDisplay.prevGuiTurns = currentClusterDisplayNumber; m_NextClusterDisplayID += 1; } newDisplay.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Display_FormClosing); DisplayArgs args = new DisplayArgs(); args.display = newDisplay; args.Request = DisplayArgs.DisplayRequest.NewDisplay; HubEventEnqueue(args); }//NewDisplay().