コード例 #1
0
        /// <summary>
        /// Handles Messages sent from a host sub-engine to its clients
        /// </summary>
        /// <param name="Command"></param>
        /// <param name="pMessage"></param>
        public void HandleMessage(ICDEThing sender, object pIncoming)
        {
            TheProcessMessage pMsg = pIncoming as TheProcessMessage;

            if (pMsg == null)
            {
                return;
            }

            string[] cmd = pMsg.Message.TXT.Split(':');
            switch (cmd[0])
            {
            case "CDE_INITIALIZED":
                MyBaseEngine.SetInitialized(pMsg.Message);
                break;

            case "CDE_INITIALIZE":
                if (MyBaseEngine.GetEngineState().IsService)
                {
                    if (!MyBaseEngine.GetEngineState().IsEngineReady)
                    {
                        MyBaseEngine.SetEngineReadiness(true, null);
                    }
                    MyBaseEngine.ReplyInitialized(pMsg.Message);
                }
                break;

            case "REFRESH_DASH":
                InitServers();
                mMyDashboard.Reload(pMsg, false);
                break;

            default:
                TheThing tt = TheThingRegistry.GetThingByProperty(MyBaseEngine.GetEngineName(), Guid.Empty, "ID", pMsg.Message.PLS);
                if (tt != null)
                {
                    tt.HandleMessage(this, pMsg);
                }
                break;
            }
        }