示例#1
0
        public void ShowMenu()
        {
            IDialog   dialog   = uiFactory.CreateDialog();
            IMenuView menuView = uiFactory.CreateMenuView();
            var       menu     = commands.Keys.ToList();

            menu.Add("UNDO");
            menu.Add("EXIT");

            while (true)
            {
                var result = menuView.ShowMenu(menu);
                int i      = Int32.Parse(result);

                if (i <= commands.Count)
                {
                    if (commands.Values.ToList()[i - 1] is IUndoableCommand)
                    {
                        processor.Execute(((commands.Values.ToList()[i - 1]) as IUndoableCommand).Clone() as IUndoableCommand);
                    }
                    else
                    {
                        processor.Execute(commands.Values.ToList()[i - 1]);
                    }
                }
                else if (i == commands.Count + 1)
                {
                    processor.Undo();
                }
                else if (i == commands.Count + 2)
                {
                    return;
                }
            }
        }
示例#2
0
        public void Execute()
        {
            var dialog = factory.CreateDialog(Title, "Poll name", "Eligible voters");

            dialog.ResultsCreatedEvent += GetResults;
            dialog.Show();
        }
示例#3
0
        public void Execute()
        {
            var dialog = factory.CreateDialog("Select created voting", "Name");

            dialog.ResultsCreatedEvent += Dialog_ResultsCreatedEvent;
            dialog.Show();
        }
示例#4
0
        public void Execute()
        {
            IDialog dialog = uiFactory.CreateDialog();

            loan   = GetLoan(dialog);
            values = loan.GetValues();
            loan.Pay();
        }
        public void Execute()
        {
            IDialog     dialog     = factory.CreateDialog();
            IClientView clientView = factory.CreateClientView();
            ILoanView   loanView   = factory.CreateLoanView();
            Client      client     = GetClient(dialog);
            Loan        loan       = GetLoan(dialog);

            client.Notify(loan.GetValues());

            loan.AddObserver(client);
        }
示例#6
0
        public void Execute()
        {
            IDialog dialog = factory.CreateDialog();

            loan            = GetLoan(dialog);
            oldInterestRate = loan.interestRateProperty;
            List <string> args = new List <string>();

            args.Add("Enter new interest rate: ");
            newInterestRate = Double.Parse(dialog.ShowDialogSingle(args));
            loan.ChangeInterestRate(newInterestRate);
        }
        public void Execute()
        {
            var arguments = new[] { "Id", "Name" };

            IDialog dialog = uiFactory.CreateDialog();
            var     input  = dialog.ShowDialog(arguments).ToArray();

            string id   = input[0];
            string name = input[1];

            Client client = factory.createClient(id, name);

            repository.Add(client);
            client.AddObserver(uiFactory.CreateClientView());
        }
示例#8
0
        public void Execute()
        {
            var arguments = new[] { "Id", "Amount", "Term", "Interest rate" };

            IDialog dialog = uiFactory.CreateDialog();
            var     input  = dialog.ShowDialog(arguments).ToArray();

            string  id           = input[0];
            decimal amount       = Decimal.Parse(input[1]);
            int     term         = Int32.Parse(input[2]);
            double  interestRate = Double.Parse(input[3]);

            Loan loan = factory.createLoan(id, amount, term, interestRate);

            loan.AddObserver(uiFactory.CreateLoanView());

            repository.Add(loan);
        }