Esempio n. 1
0
        /// <summary>
        /// execute all pending commands - create the equivalent local commands and invoke its' execute method
        /// </summary>
        /// <param name="sendingInstruction"></param>
        /// <param name="sessionStage"></param>
        /// <param name="res"></param>
        internal override void Execute(SendingInstruction sendingInstruction, SessionStage sessionStage, IResultValue res)
        {
            MGDataCollection mgDataTab = MGDataCollection.Instance;

            // loop on all MGData
            for (int i = 0; i < mgDataTab.getSize(); i++)
            {
                MGData mgd = mgDataTab.getMGData(i);
                if (mgd != null && !mgd.IsAborting)
                {
                    CommandsTable commands = mgd.CmdsToServer;

                    // go over all commands
                    while (commands.getSize() > 0)
                    {
                        // extract command from CmdsToServer
                        IClientCommand          command             = commands.ExtractCommand(0);
                        LocalRunTimeCommandBase localRunTimeCommand = _localRunTimeCommandFactory.CreateLocalRunTimeCommand(command);
                        localRunTimeCommand.Execute();
                    }

                    Debug.Assert(mgd.CmdsToClient.getSize() == 0, "Not all commands were executed");
                }
            }
        }