Exemplo n.º 1
0
 Remotе.kResponse OnMasterEvent(Remotе.kAction k_Action)
 {
     Remotе.kResponse k_Response = new Remotе.kResponse();
     if (mb_WaitButton)
     {
         k_Response.s_Result =
             "Sorry! Slave is currently busy.\r\nTry again later";
         return(k_Response);
     }
     textBoxMessage.Text = string.Format("Message from [{0}]:\r\n{1}\r\n(Click Button \"Send\" to answer)", k_Action.s_Computer, k_Action.s_Command);
     mi_EraseTextTimer.Stop();
     mb_WaitButton = true;
     while (mb_WaitButton)
     {
         Thread.Sleep(200);
     }
     ;
     k_Response.s_Result = textBoxResponce.Text;
     return(k_Response);
 }
Exemplo n.º 2
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            Remotе.kAction k_Action = new Remotе.kAction();
            k_Action.s_Command  = textBoxMessage.Text;
            k_Action.s_Computer = Environment.MachineName;
            this.Cursor         = Cursors.WaitCursor;
            string s_URL = string.Format("tcp://{0}:{1}/TestService", textBoxComputer.Text, textBoxPort.Text);

            try
            {
                mi_Transfer = (Remotе.cTransfer)Activator.GetObject(typeof(Remotе.cTransfer), s_URL);
                Remotе.kResponse k_Response = mi_Transfer.CallSlave(k_Action);
                textBoxAnswer.Text = "Answer from Slave:\r\n" + k_Response.s_Result;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(this, "Error sending message to Slave:\n" +
                                Ex.Message, "Master Error");
            }

            this.Cursor = Cursors.Arrow;
            mi_EraseTextTimer.Start();
        }
Exemplo n.º 3
0
 public kResponse CallSlave(kAction k_Action)
 {
     return(ev_SlaveCall(k_Action));
 }