My application consists of a number of tab pages.
On one we have 5 custom buttons that can be set with details that are then used when the button is clicked. The buttons have 3 main states.
On the main tab page I have 5 buttons of the same type that are representative of the other buttons which basically gives 5 pairs of buttons.
When any button is pushed on either tab page code is run and I need the other paired button to be set to the same state.
All buttons use the same code from the main Form file and the buttons on the setup tab are linked via
this.commentatorPicks.PTR_Commentator_1.Click += new System.EventHandler(this.CommentatorPTR_Click);
this.commentatorPicks.PTR_Commentator_2.Click += new System.EventHandler(this.CommentatorPTR_Click);
this.commentatorPicks.PTR_Commentator_3.Click += new System.EventHandler(this.CommentatorPTR_Click);
this.commentatorPicks.PTR_Commentator_4.Click += new System.EventHandler(this.CommentatorPTR_Click);
this.commentatorPicks.PTR_Commentator_5.Click += new System.EventHandler(this.CommentatorPTR_Click);
with the other buttons linked via the OnClick event.
I have tried a number of ways to keep the buttons in sync like cloning the state of the paired button that is not clicked, but the state of the first button looks like it is not set until after the call
The code I am trying to run is this
public void CommentatorPTR_Click(object sender, EventArgs e)
PreviewTakeRemoveButton ptrBtn = sender as PreviewTakeRemoveButton;
PreviewTakeRemoveButton remoteBtn = null;
if (ptrBtn != null)
String name = (sender as Button).Name;
int pos = name.LastIndexOf("_") + 1;
String number = name.Substring(pos, name.Length - pos);
remoteBtn = (PreviewTakeRemoveButton)inRaceSceneControl.GetControl(NZRB_Global.Consts.COMMENTATOR_PICKS_BUTTON_PREFIX + number);
remoteBtn = (PreviewTakeRemoveButton)inRaceSceneControl.GetControl(NZRB_Global.Consts.MAIN_PICKS_BUTTON_PREFIX + number);
String commentator = (String)ptrBtn.Tag;
XmlNode picks = commentatorPicks.GetCommentatorPicks(commentator);
if (null == picks)
NZRB_Global.Utils.LogButtonClick(sender, ptrBtn.Name + " " + ptrBtn.ButtonState);
String dp = commentatorPicks.GetCommentatorDataPool(picks);
inRaceSceneControl.ShowScene(false, NZRB_Global.Consts.DIRECTOR_FF_SELECTIONS, Consts.GFX_LBAR_LAYER, null, SceneType.sports, true);
inRaceSceneControl.ClearScene(false, NZRB_Global.Consts.DIRECTOR_FF_SELECTIONS, Consts.GFX_LBAR_LAYER);
inRaceSceneControl.ShowScene(true, NZRB_Global.Consts.DIRECTOR_FF_SELECTIONS, Consts.GFX_LBAR_LAYER, null, SceneType.sports, true);
inRaceSceneControl.ClearScene(true, NZRB_Global.Consts.DIRECTOR_FF_SELECTIONS, Consts.GFX_LBAR_LAYER);
Does anyone have any idea how i can get this to work?
What I have tried:
Cloning second buttons state
Setting second button to next state
Canning Perform Click on second button (endless loop)
Additional Info's :
I am using Winforms and it is quite a complex UI due to the working style of the operators.
Basically there are many custom buttons and User Controls that send graphics to a "preview" machine and then the main on-air graphics engine.
There are many scenes that can be sent and some scenes can co-exist with others while other scenes need to be removed automatically if another scene is sent over top.
When a scene is removed automatically the corresponding buttons also need to be reset to a starting state.
I also have to juggle the existence of a background that can be used with some of the scenes either manually or automatically.
I have dealt with the current situation(in the short term at least) by ensuring the operator can only use one of the paired buttons at a time to remove the "mix and match" possibility. So once a button sends an image to either the preview or main display the corresponding "paired" button is disabled until the scene is removed either by another button click or automatically.