private string GetCompleteExecuteCommandWithResultProcessingStatement(AlgorithmDescription targetAlgorithmDescription, ComputeDeviceInfo targetComputeDeviceInfo, string port, string attributeKey = "ScalarExecuteCommand", string customResultProcessingStatement = null)
        {
            string errorList = "";

            if (targetAlgorithmDescription.Id != AlgorithmId)
            {
                errorList += "[ERROR] PresetDescription::GetCompleteExecuteCommand() - Preset.AlgorithmId does not match with given 'targetAlgorithmDescription'\n";
            }
            if (targetComputeDeviceInfo.ComputeDeviceId != ComputeDeviceId)
            {
                errorList += "[ERROR] PresetDescription::GetCompleteExecuteCommand() - Preset.ComputeDeviceId does not match with given 'targetComputeDeviceInfo'\n";
            }

            if (errorList != "")
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(errorList);
                Console.ResetColor();

                return(null);
            }

            string ipAddress = targetComputeDeviceInfo.IpAddress;

            string algorithmCommand = null;

            switch (attributeKey)
            {
            case "ScalarExecuteCommand":
                algorithmCommand = targetAlgorithmDescription.GetScalarExecuteCommand(ipAddress, port);
                break;

            case "InitCommand":
                algorithmCommand = targetAlgorithmDescription.GetInitCommand(ipAddress, port);
                break;

            case "UnloadCommand":
                algorithmCommand = targetAlgorithmDescription.GetUnloadCommand(ipAddress, port);
                break;
            }

            // If custom result processing statement is found, encode-append-send
            if (customResultProcessingStatement != null)
            {
                algorithmCommand += "\\n" + EncodeStringForTransmission(customResultProcessingStatement, ipAddress, port);
                return(algorithmCommand);
            }
            else if (ResultProcessingStatement == null || ResultProcessingStatement == "")
            {
                return(algorithmCommand);
            }
            else
            {
                algorithmCommand += "\\n" + EncodeStringForTransmission(ResultProcessingStatement, ipAddress, port);
                return(algorithmCommand);
            }
        }
示例#2
0
        public Window GetWindow()
        {
            Window newWindow;

            switch (Task.TaskType)
            {
            case TaskTypeEnum.AlgorithmDescription:
            {
                newWindow = new AlgorithmDescription(Task);
                return(newWindow);
            }

            case TaskTypeEnum.DriversProject:
            {
                newWindow = new DriversProject(Task);
                return(newWindow);
            }

            case TaskTypeEnum.ElectricalProject:
            {
                newWindow = new ElectricalProject(Task);
                return(newWindow);
            }

            case TaskTypeEnum.Maintainence:
            {
                newWindow = new MaintainenceWnd(Task);
                return(newWindow);
            }

            case TaskTypeEnum.Mounting:
            {
                newWindow = new Mounting(Task);
                return(newWindow);
            }

            case TaskTypeEnum.OrderList:
            {
                newWindow = new OrderList(Task);
                return(newWindow);
            }

            case TaskTypeEnum.ProjectDescription:
            {
                newWindow = new ProjectDescriptionWindow(Task);
                return(newWindow);
            }


            case TaskTypeEnum.VarDefTool:
            {
                newWindow = new VarDefTool(Task);
                return(newWindow);
            }

            case TaskTypeEnum.Workshop:
            {
                newWindow = new Workshop(Task);
                return(newWindow);
            }


            default:
            {
                return(null);
            }
            }
        }
        public string GetExecuteCommandWithCustomResultStatement(AlgorithmDescription targetAlgorithmDescription, ComputeDeviceInfo targetComputeDeviceInfo, string port, string customResultProcessingStatement)
        {
            string attributeKey = "ScalarExecuteCommand";

            return(GetCompleteExecuteCommandWithResultProcessingStatement(targetAlgorithmDescription, targetComputeDeviceInfo, port, attributeKey, customResultProcessingStatement));
        }
        public string GetCompleteUnloadCommand(AlgorithmDescription targetAlgorithmDescription, ComputeDeviceInfo targetComputeDeviceInfo, string port)
        {
            string attributeKey = "UnloadCommand";

            return(GetCompleteExecuteCommandWithResultProcessingStatement(targetAlgorithmDescription, targetComputeDeviceInfo, port, attributeKey));
        }