private void GameEndedCommon(PlayerType player, string message)
        {
            MessageBox.Show(string.Format(CultureInfo.InvariantCulture, message, player.ToString()),
                            "TicTacToe",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);

            ActorProxy.Unregister(PlayerChoice.Value, true);

            _closeSilently = true;

            // Close Window from UI thread
            //System.Threading.SynchronizationContext.Current.Send((state) =>
            _synchronizationContext.Send((state) =>
            {
                Close();
            }, null);
        }
        private void frmTicTacToe_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!_closeSilently)
            {
                DialogResult result = MessageBox.Show("Do you wish to quit the game?",
                                                      "TicTacToe",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question);

                if (result == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }
                else
                {
                    ActorProxy.Unregister(PlayerChoice.Value, true);
                }
            }
        }