I am here due to a strange behaviour in Button_Click event. The code is attached.
The issue is the first StripStatus message is never displayed. any ideas as to why?
private void FireBtn_Click(object sender, EventArgs e)
{
// Control local controls for launching attack
AwayTableLayoutPanel.Enabled = false;
AwayCancelBtn.Enabled = false;
FireBtn.Enabled = false;
////////////// Below statusBar message is never displayed but the folowing sound clip is.
GameToolStripStatusLabel.Text = "(Home vs. Away)(Attack Coordinate: (" +
GameModel.alphaCoords(GridLock.Column) + "," + GridLock.Row + "))(Action: Fire)";
////////////////////////////////////////////
if (audio)
{
SoundPlayer fire = new SoundPlayer(Properties.Resources.fire);
fire.PlaySync();
fire.Dispose();
}
// compile attack message
XmlSerializer s;
StringWriter w;
FireGridUnit fireGridUnit = new FireGridUnit();
fireGridUnit.FireGridLocation = GridLock;
s = new XmlSerializer(typeof(FireGridUnit));
w = new StringWriter();
s.Serialize(w, fireGridUnit);
//////////////////////////////////////////////////////////
// send attack message
GameMessage GameMessageAction = new GameMessage();
GameMessageAction.gameAction = GameMessage.GameAction.FireAttack;
GameMessageAction.statusMessage = w.ToString();
s = new XmlSerializer(typeof(GameMessage));
w = new StringWriter();
s.Serialize(w, GameMessageAction);
SendGameMsg(w.ToString());
GameToolStripStatusLabel.Text = "(Home vs. Away)(Attack Coordinate: (" +
GameModel.alphaCoords(GridLock.Column) + "," + GridLock.Row + "))(Action: Awaiting Fire Result)";
}
EDIT: if I put in a messageBox after the StripStatus message the status is updated.