Beispiel #1
0
        internal bool AddCommand(MOG_Command pCommand)
        {
            bool bSuccess = false;

            // Check if this is the StartJob command?
            if (pCommand.GetCommandType() == MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_StartJob)
            {
                mStartJobCommand = pCommand;
                bSuccess         = true;
            }
            else
            {
                // Check if this command has requested to have duplicate commands removed?
                if (pCommand.IsRemoveDuplicateCommands())
                {
                    // Scan the Server's command queue looking for any other instance of this same command?
                    if (RemoveDuplicateCommands(pCommand))
                    {
                    }
                }

                // Check if this is a completed command?
                if (pCommand.GetCommandType() == MOG.COMMAND.MOG_COMMAND_TYPE.MOG_COMMAND_Complete)
                {
                    // Immediately process 'Complete' commands
                    if (ProcessCommand(pCommand))
                    {
                        // Remove the original command that is encapsulated within this 'Complete' command
                        RemoveCommand(pCommand.GetCommand());
                        bSuccess = true;
                    }
                }
                else
                {
                    // Get the appropriate command list for this command
                    HybridDictionary commandList = GetJobCommandList(pCommand);
                    if (commandList != null)
                    {
                        // Make sure we always clear the command's assigned slave or else it will never get processed
                        pCommand.SetAssignedSlaveID(0);

                        // Add this command to the appropriate list for later processing
                        commandList[pCommand.GetCommandID().ToString()] = pCommand;
                        bSuccess = true;
                    }
                }
            }

            return(bSuccess);
        }
Beispiel #2
0
        public void UpdateCommands(MOG_Command command)
        {
            ListViewItem item;
            MOG_Command  action = command.GetCommand();

            if (action != null)
            {
                bool bAdd    = false;
                bool bRemove = false;

                switch (action.GetCommandType())
                {
                case MOG_COMMAND_TYPE.MOG_COMMAND_None:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew:
                case MOG_COMMAND_TYPE.MOG_COMMAND_InstantMessage:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LaunchSlave:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockCopy:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockMove:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkBroadcast:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NewBranch:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveCommands:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveConnections:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ViewConnection:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ViewLock:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate:
                    // Eat these commands, we don't need to show them in this window
                    break;

                case MOG_COMMAND_TYPE.MOG_COMMAND_Complete:
                    // Drill one more level into this Complete command
                    action  = action.GetCommand();
                    bRemove = true;
                    break;

                // All other commands can simply be added
                default:
                    bAdd = true;
                    break;
                }

                // Check if we are removing the command?
                if (bRemove)
                {
                    // Strip out any matching commands
                    do
                    {
                        // Find it using specific information
//						item = LocateItem((int)CommandsColumns.COMMANDID, action.GetCommandID().ToString(), mainForm.ConnectionManagerCommandsListView);
                        item = LocateCommandItem(action);
                        if (item != null)
                        {
                            item.Remove();
                        }
                    } while(item != null);
                }

                // Check if we are adding the command?
                if (bAdd)
                {
                    // Find it using a generic approach
                    item = LocateCommandItem(action);
                    if (item != null)
                    {
                        // Check if this could replace an existing command?
                        if (action.IsRemoveDuplicateCommands())
                        {
                            // Remove the duplicate
                            item.Remove();
                            item = null;
                        }
                    }

                    // Check if the item already exists
                    if (item == null)
                    {
                        //It doesn't already exist, so let's make a new one
                        item = new ListViewItem();
                        MOG_Time time = new MOG_Time();
                        time.SetTimeStamp(command.GetCommandTimeStamp());
                        string assetFullName = "PROJECT: " + action.GetProject() + "     ASSET: " + action.GetAssetFilename().GetAssetOriginalFullName();
                        if (string.Compare(action.GetProject(), MOG_ControllerProject.GetProjectName(), true) == 0)
                        {
                            assetFullName = action.GetAssetFilename().GetAssetFullName();
                        }

                        item.Text = action.ToString();
                        item.SubItems.Add(assetFullName);
                        item.SubItems.Add(action.GetPlatform());
                        item.SubItems.Add(action.IsCompleted() ? "Working" : "");
                        item.SubItems.Add(action.GetJobLabel());
                        item.SubItems.Add(action.GetComputerName().ToString());
                        item.SubItems.Add(action.GetComputerIP().ToString());
                        item.SubItems.Add(action.GetNetworkID().ToString());
                        item.SubItems.Add(action.GetCommandID().ToString());
                        item.Tag = action;

                        item.ImageIndex = GetImageIndex(action.GetCommandType());

                        mainForm.ConnectionManagerCommandsListView.Items.Add(item);
                    }
                }
            }
        }