C# StripStatusText Update Issue

Posted by ikurtz on Stack Overflow See other posts from Stack Overflow or by ikurtz
Published on 2010-04-07T13:14:55Z Indexed on 2010/04/07 13:23 UTC
Read the original article Hit count: 380

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about stripstatus