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); } }
protected bool SetParsedSides(string[] argsForSides) //Set _sides field from argument line { if (argsForSides.Length != SIDES_NUMBER) { OutputResults.OutputMessage(ERR_WRONG_DATA); return(false); } for (int i = 0; i < SIDES_NUMBER; ++i) { if (!TryParseOneSide(argsForSides[i], out _sides[i])) { Console.WriteLine(Input.INCORRECT_ENTRY); Console.WriteLine(Input.DATA_NOT_ACCEPTED); Console.ReadLine(); return(false); } } return(true); }
/// <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); }