public void MessageRoutingON() { try { // Enable direct message routing to the application if (!registerMessageReceived) { comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived); registerMessageReceived = true; } comm.EnableMessageRouting(); } catch (Exception ex) { Output(ex.ToString()); } }
private void btnMsgRoutingOn_Click(object sender, System.EventArgs e) { btnMsgRoutingOn.Enabled = false; btnMsgRoutingOn.BackColor = Color.Red; btnMsgRoutingOff.Enabled = true; btnMsgRoutingOff.BackColor = Color.White; try { // Enable direct message routing to the application if (!registerMessageReceived) { comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived); registerMessageReceived = true; } comm.EnableMessageRouting(); MessageBox.Show("Message receiving activated.", "Message Receiving", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }