コード例 #1
0
        public void Run(string[] args)
        {
            _view.PrintTitleText(MessagesResources.ApplicationName);
            _view.PrintInstructionText(MessagesResources.Instruction);

            try
            {
                _inboxParams = new MainParamValidator(args).GetMainParameters();
            }
            catch (Exception ex)
            {
                _view.PrintErrorText(ex.Message);
                return;
            }

            do
            {
                bool isFailed;
                do
                {
                    isFailed = false;
                    try
                    {
                        _view.AskInputPath(MessagesResources.AskInputPath);
                    }
                    catch (Exception ex)
                    {
                        _view.PrintErrorText(ex.Message);
                        isFailed = true;
                    }
                } while (isFailed);

                LuckyTicketsGenerator lackyGenerator = LuckyTicketsGenerator.Create(_countMethod, _inboxParams.QuantityDigits);

                try
                {
                    if (_inboxParams.PathLog != String.Empty)
                    {
                        lackyGenerator.SaveToFile(_inboxParams.PathLog);
                    }
                }
                catch
                {
                    _view.PrintErrorText(MessagesResources.ErrorFileNotSaved);
                }

                _view.PrintResultText(String.Format(MessagesResources.Result, lackyGenerator.Count().ToString()));
                _view.AskContinueFlag(MessagesResources.AskContunue);
            } while (_continueFlag);
        }
コード例 #2
0
        public void Run(string[] args)
        {
            _view.PrintTitleText(MessagesResources.ApplicationName);

            try
            {
                _inboxParams = new MainParamValidator(args).GetMainParameters();
            }
            catch (Exception ex)
            {
                _view.PrintErrorText(ex.Message);
                return;
            }
            if (_inboxParams.WorkMode == WorkMode.HelpMode)
            {
                _view.PrintInstructionText(MessagesResources.Instruction);
            }

            do
            {
                _triangles = new List <IFigure>();

                do
                {
                    try
                    {
                        _view.AskInputTriangle(MessagesResources.AskInputTriangle);
                    }
                    catch (Exception ex)
                    {
                        _view.PrintErrorText(ex.Message);
                    }

                    _view.AskAddTrianglesFlag(MessagesResources.AskAddTriangle);
                } while (_addNextTriangleFlag);

                _triangles.Sort(new TriangleComparerByAreaDesc());

                _view.PrintResult(_triangles);
                _view.AskContinueFlag(MessagesResources.AskContunue);
            } while (_continueFlag);
        }
コード例 #3
0
        public void Run(string[] args)
        {
            _view.PrintTitleText(MessagesResources.ApplicationName);

            try
            {
                _inboxParams = new MainParamValidator(args).GetMainParameters();
            }
            catch (Exception ex)
            {
                _view.PrintErrorText(ex.Message);
                return;
            }
            if (_inboxParams.WorkMode == WorkMode.HelpMode)
            {
                _view.PrintInstructionText(MessagesResources.Instruction);
            }

            while (_continueFlag)
            {
                AskEnvelops();
                _view.AskContinueFlag(MessagesResources.AskContunue);
            }
        }