Ejemplo n.º 1
0
 public RemoteControllerForm()
 {
     InitializeComponent();
     Load                     += AfterFormLoaded;
     this.formService          = new Services.FormService(this);
     this.helpService          = formService.HelpService();
     this.displayWorkerMessage = new MessageFromWorker(this.HandleWorkerMessage);
 }
Ejemplo n.º 2
0
        //
        public void MessageReceivedInform()
        {
            bool flag = false;
            MessageFromWorker received_message = null;

            lock (receive_from_worker_construct.receive_from_worker_queue_lock)
            {
                if (receive_from_worker_construct.receive_from_worker_queue.Count > 0)
                {
                    received_message = receive_from_worker_construct.receive_from_worker_queue.Dequeue();
                    flag             = true;
                    if (receive_from_worker_construct.receive_from_worker_queue.Count == 0)
                    {
                        receive_from_worker_construct.receive_from_worker_queue_flag = false;
                    }
                }
                else
                {
                    receive_from_worker_construct.receive_from_worker_queue_flag = false;
                }
            }
            if (flag == true)
            {
                bool message_investigate = HelperFunctions.MessageFromWorkerInvestigate(received_message);
                if (message_investigate == false)
                {
                    MessageBox.Show("Invalid Message Object Rejected.");
                    return;
                }
                else if (message_investigate == true)
                {
                    if (received_message.Get_type_of_message_from_worker_object == TypeOfMessageFromWorker.SignalMessage && mode == TypeOfMode.TcpAllocation)
                    {
                        TcpModeReceive(((ClientWorkerSignal)received_message.Get_message_from_worker_object));
                        return;
                    }
                    else if (received_message.Get_type_of_message_from_worker_object == TypeOfMessageFromWorker.FinalMessage)
                    {
                        FinalMessageForClient final_message_received = (FinalMessageForClient)received_message.Get_message_from_worker_object;
                        if (mode == TypeOfMode.UnAuthMode && final_message_received.Get_message_type == TypeOfMessage.Dialog)
                        {
                            UnAuthModeReceive((DialogMessageForClient)final_message_received.Get_message_object);
                            return;
                        }
                        else if (mode == TypeOfMode.AuthMode)
                        {
                            AuthModeReceive(final_message_received);
                            return;
                        }
                    }
                    else if (received_message.Get_type_of_message_from_worker_object == TypeOfMessageFromWorker.OfflineInform)
                    {
                        is_there_worker = false;
                        OfflineApplication();
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            return;
        }