Example #1
0
        private void btnMsgRoutingOff_Click(object sender, System.EventArgs e)
        {
            btnMsgRoutingOff.Enabled   = false;
            btnMsgRoutingOff.BackColor = Color.Red;
            btnMsgRoutingOn.Enabled    = true;
            btnMsgRoutingOn.BackColor  = Color.White;

            try
            {
                // Disable message routing
                comm.DisableMessageRouting();
                if (registerMessageReceived)
                {
                    comm.MessageReceived   -= new MessageReceivedEventHandler(comm_MessageReceived);
                    registerMessageReceived = false;
                }
                MessageBox.Show("Message receiving deactivated.", "Message Receiving", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }