示例#1
0
        public void Process(string[] args)            //Process with arguments tested by their quantity
        {
            if (!AllParse(args))
            {
                OutputResults.OutputMessage(OutputResults.APP_CANNOT_PROCESS);
                OutputResults.OutputMessage(OutputResults.CAN_RESTART);
            }

            OutputResults.OutputMessage(DATA_ENTERED);

            if (TriangleGeometry.IsTriangle(_sides))
            {
                Triangle triangle = new Triangle(_sides);
                _triangles.Add(_name, triangle);

                OutputResults.ShowTriangleWithSquare(this as IViewable, _triangles.Last().Key);
            }
            else
            {
                OutputResults.OutputMessage(ERR_NOT_TRIANGLE);
            }
        }
示例#2
0
        /// <summary>
        /// Process console entery data for one trieangle.
        /// </summary>
        /// <returns>If the user wants to continue, returns false, else returns true.</returns>
        public bool Process()                                                    //Process with console data
        {
            if (!AllParse())                                                     //User's data are incorrect
            {
                if (!Input.AskContinue(OutputResults.ASK_CONTINUE_WITH_CONSOLE)) //User don't want to continue
                {
                    OutputResults.OutputMessage(OutputResults.CAN_RESTART);
                    OutputResults.OutputMessage(OutputResults.FINISH);
                    Console.ReadLine();

                    return(false);
                }

                return(true);      //User want to continue
            }

            //OutputResults.OutputMessage(DATA_ENTERED);

            if (TriangleGeometry.IsTriangle(_sides))
            {
                Triangle triangle = new Triangle(_sides);
                _triangles.Add(_name, triangle);

                triangle.ShowTriangleWithSquare(_name);
                OutputResults.ShowTriangleWithSquare(this as IViewable, _triangles.Last().Key);

                if (!Input.AskContinue(OutputResults.ASK_CONTINUE_WITH_CONSOLE))  //Ask about the continuation of the application
                {
                    OutputResults.OutputMessage(OutputResults.CAN_RESTART);
                    OutputResults.OutputMessage(OutputResults.FINISH);
                    Console.ReadLine();

                    return(false);         //User don't want to continue
                }

                return(true);     //User want to continue
            }
            else
            {
                OutputResults.OutputMessage(ERR_NOT_TRIANGLE);

                if (!Input.AskContinue(OutputResults.ASK_CONTINUE_WITH_CONSOLE))    //Ask about the continuation of the application
                {
                    OutputResults.OutputMessage(OutputResults.CAN_RESTART);
                    OutputResults.OutputMessage(OutputResults.FINISH);
                    Console.ReadLine();

                    return(false);     //User don't want to continue
                }

                return(true);          //User want to continue
            }

            if (!Input.AskContinue(OutputResults.ASK_CONTINUE_WITH_CONSOLE))
            {
                OutputResults.OutputMessage(OutputResults.CAN_RESTART);
                OutputResults.OutputMessage(OutputResults.FINISH);
                Console.ReadLine();

                return(false);
            }

            return(true);
        }