private void btnCall_Click(object sender, EventArgs e)
        {
            // calls the SendAlert method within the Communicator class of the SecureCommunicationComponent
            Communicator callCommunicator = null;//dont initialize yet
            try {
                callCommunicator = new Communicator();
                CommunicationFeedback communicationFeedbackSubscriber = new CommunicationFeedback();
                callCommunicator.CommunicationHappened += communicationFeedbackSubscriber.OnCommunicationHappened;

                callCommunicator.SendAlert(textBox3.Text, "Test Message!").ToString();//Test Message! is arbitrary
                if (callCommunicator != null) callCommunicator.Dispose();//get rid of communicator to free precious resources
            }
            catch (SecureCommunicationException)
            {
                MessageBox.Show("Your message has NOT been sent.  Please check to make sure that the Officer name does not start with A, B or C.");
            }
            catch (MutexWrapperNotAvailableException)
            {
                MessageBox.Show("Your message has NOT been sent.  All communication channels are in use.  Please try again later");
            }
            catch (ObjectDisposedException)
            {
                //dont want to do anything if the program calls dispose on an object that has already been disposed
            }
            finally
            {

            }
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     Communicator testCommunicator = new Communicator();
     string output = testCommunicator.SendAlert("testAddressee", "testMessage");
     Console.WriteLine(output);
     System.Threading.Thread.Sleep(2000);
 }
 private void btnCall_Click(object sender, EventArgs e)
 {
     // calls the SendAlert method within the Communicator class of the SecureCommunicationComponent
     Communicator callCommunicator = new Communicator();
     try {
         MessageBox.Show(callCommunicator.SendAlert(textBox3.Text, "Test Message!"));//Test Message! is just for debugging
     }
     catch (SecureCommunicationException)
     {
         MessageBox.Show("Your message has NOT been sent.  Please check to make sure that the Officer name does not start with A, B or C.");
     }
 }
Ejemplo n.º 4
0
 private void CallButton_Click(object sender, EventArgs e)
 {
     Communicator MyCommunicator = new Communicator();
     string message = MyCommunicator.SendAlert(OfficerTextBox.Text, "Hello, from Police Dispatcher");
     MessageBox.Show(message);
 }
 private void btnCall_Click(object sender, EventArgs e)
 {
     Communicator comm = new Communicator();
     MessageBox.Show(comm.SendAlert(tbOfficer.Text, "Hello, Officer"));
 }
 private void btnCall_Click(object sender, EventArgs e)
 {
     // calls the SendAlert method within the Communicator class of the SecureCommunicationComponent
     Communicator callCommunicator = new Communicator();
     MessageBox.Show(callCommunicator.SendAlert(textBox3.Text, "Test Message!"));//Test Message! is just for debugging
 }