コード例 #1
0
ファイル: Default.aspx.cs プロジェクト: mammons/MAP200
        private OperationResult StartPCT()
        {
            bool pctRunningOnMap200 = Map200.HasPctRunning();
            var  op = new OperationResult();

            if (!pctRunningOnMap200)
            {
                try
                {
                    Map200.StartPct();
                    op.Success = true;
                    op.Messages.Add("PCT Started");
                }
                catch (TimeoutException ex)
                {
                    op.Success = false;
                    op.ErrorMessages.Add(ex.Message);
                    logger.Debug(op.ErrorMessages);
                }
            }
            else
            {
                op.Success = true;
                op.Messages.Add("PCT already running");
            }
            return(op);
        }
コード例 #2
0
ファイル: Default.aspx.cs プロジェクト: mammons/MAP200
        private OperationResult RunTest()
        {
            var testOp         = new OperationResult();
            var assignOp       = AssignSerialIdToJumper();
            var testRequiredOp = CheckIfTestingRequired();

            if (!assignOp.Success)
            {
                WriteToLog(assignOp.ErrorMessages);
                testOp.Success = false;
                testOp.ErrorMessages.AddRange(assignOp.ErrorMessages);
                return(testOp);
            }

            var testingRequired = testRequiredOp.Messages.Any();

            if (testingRequired)
            {
                if (Map200.HasPctRunning())
                {
                    testOp = Map200.pct.RunTest(Jumper);
                    testOp.Messages.Add(string.Format("Jumper {0} completed the test", Jumper.SerialNumber));
                }
                else
                {
                    string msg = "PCT needs to be started before you can run a test";
                    testOp.Success = false;
                    testOp.ErrorMessages.Add(msg);
                }
            }
            else
            {
                string msg = testRequiredOp.Success ? string.Format("Testing not required for jumper with serial number: {0}", Jumper.SerialNumber) : "No response from PTS";
                testOp.Success = false;
                testOp.ErrorMessages.Add(msg);
            }

            return(testOp);
        }