Ejemplo n.º 1
0
        private void DoMessagePoint(MessageBodyModel msgModel)
        {
            Model.EnumServerMessage messageContent = (Model.EnumServerMessage)Enum.Parse(typeof(Model.EnumServerMessage), msgModel.MessageContent);
            m_AutoServerConnected = true;
            switch (messageContent)
            {
            case Model.EnumServerMessage.StateWorked:
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke((MethodInvoker) delegate
                        {
                            lab_connection.Appearance.ForeColor = Color.LightGreen;
                            lab_connection.Caption = "自动服务状态:正常运行";
                            m_Checked = false;
                        });
                }
            }
            break;

            case Model.EnumServerMessage.StateNoWork:
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke((MethodInvoker) delegate
                        {
                            lab_connection.Appearance.ForeColor = Color.Coral;
                            lab_connection.Caption = "自动服务状态:服务停止";
                            m_Checked = false;
                        });
                }
            }
            break;

            case Model.EnumServerMessage.StateShutdown:
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke((MethodInvoker) delegate
                        {
                            lab_connection.Appearance.ForeColor = Color.Coral;
                            lab_connection.Caption = "自动服务状态:服务停止";
                            m_Checked = false;
                        });
                }
            }
            break;
            }
        }
Ejemplo n.º 2
0
 void m_MessageSocketClient_EventRecieveMessage(object sender, EventArgs e)
 {
     Careysoft.Dotnet.Server.MessageServer.Model.MessageBodyModel model = sender as Careysoft.Dotnet.Server.MessageServer.Model.MessageBodyModel;
     Model.EnumServerMessage messageContent = (Model.EnumServerMessage)Enum.Parse(typeof(Model.EnumServerMessage), model.MessageContent);
     switch (messageContent)
     {
     case Model.EnumServerMessage.QueryState:
         if (m_TaskServer.Worked)
         {
             model.MessageContent = Model.EnumServerMessage.StateWorked.ToString();
         }
         else
         {
             model.MessageContent = Model.EnumServerMessage.StateNoWork.ToString();
         }
         break;
     }
     model.Header.TargetCode = model.Header.SourceCode;
     m_MessageSocketClient.SendPointMessage(model);
 }