0
我在這裏由於Button_Click事件中的奇怪行爲。該代碼已附加。C#StripStatusText更新問題
問題是第一個StripStatus消息從不顯示。任何想法爲什麼?
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)";
}
編輯:如果我在StripStatus消息之後放入消息框狀態更新。
@克里斯:聲音樣本效力於近2秒鐘,這樣的狀況應該已經先並用大量的更新時間。 – iTEgg 2010-04-07 13:24:44