public ViewModelLocator()
        {
            var kernel = new StandardKernel();

            kernel.Bind <IKeyboardService>().To <DefaultKeyboardService>();

            if (ViewModelBase.IsInDesignModeStatic)
            {
                kernel.Bind <IConfigurationService>().To <DesignConfigurationService>();
                kernel.Bind <INuiService>().To <MockNuiService>();
            }
            else
            {
                kernel.Bind <IConfigurationService>().To <AppConfigConfigurationService>();
                kernel.Bind <INuiService>().To <KinectNuiService>();
            }

            nuiService = kernel.Get <INuiService>();

            main = new MainViewModel(
                kernel.Get <IConfigurationService>(),
                nuiService,
                kernel.Get <IKeyboardService>());

            boundingBox = new BoundingBoxViewModel(
                nuiService);

            explorer = new ExplorerViewModel(
                nuiService, kernel.Get <IConfigurationService>());

            math = new MathViewModel();
        }
예제 #2
0
 private MathViewModel SetResult(MathViewModel quantity, Quantity q1, Quantity q2)
 {
     if (quantity.SelectedOperation == "Add")
     {
         quantity.ResultQuantity = q1.Add(q2);
     }
     else if (quantity.SelectedOperation == "Subtract")
     {
         quantity.ResultQuantity = q1.Subtract(q2);
     }
     else if (quantity.SelectedOperation == "Multiply")
     {
         quantity.ResultQuantity = q1.Multiply(q2);
     }
     else if (quantity.SelectedOperation == "Divide")
     {
         quantity.ResultQuantity = q1.Divide(q2);
     }
     else if (quantity.SelectedOperation == "Compare")
     {
         quantity.Result = SetComparingResult(q1, q2);
     }
     else if (quantity.SelectedOperation == "Round")
     {
         quantity.ResultQuantity = q1.Round(new Rounding());
     }
     if (quantity.Result == null)
     {
         quantity.Result = quantity.ResultQuantity.Amount.ToString();
     }
     return(quantity);
 }
예제 #3
0
        public void AddTest()
        {
            var vm = new MathViewModel();

            vm.ValueA = 8;
            vm.ValueB = 7;
            vm.AddCommand.Execute(null);
            Assert.IsTrue(vm.Result == 15, "vm.Result!=15 ");
        }
예제 #4
0
        public void EUR_1_how_many_PLN()
        {
            var vm = new MathViewModel();

            ////przykladowy kurs euro dla zlotowki
            vm.Currency = 0.2260295647;

            vm.RateForSpecificCurrencyCommand.Execute(null);
            ////Assert
            Console.WriteLine("result" + vm.Result);
            Assert.True(vm.Result.ToString("0.00") == "4,42", "vm.Result != 4.42 !");
        }
예제 #5
0
        public void PLN_100_to_EUR_format_test()
        {
            var vm = new MathViewModel();

            vm.Amount = 100.0;
            ////przykladowy kurs euro dla zlotowki
            vm.Currency = 0.2260295647;

            vm.ConvertAmountToAnotherCurrencyCommand.Execute(null);
            ////Assert

            Assert.True(vm.Result.ToString("0.00") == "22,60", "vm.Result != 22.60 !");
        }
예제 #6
0
        public void AddTest()
        {
            //Arrange
            var vm = new MathViewModel();

            vm.ValA = 6;
            vm.ValB = 7;
            //Act

            vm.AddCommand.Execute(null);

            //Assert

            Assert.IsTrue(vm.Result == 13, "vm.Result !=13");
        }
예제 #7
0
        public void AddTest()
        {
            // Arrange

            var vm = new MathViewModel();

            vm.ValueA = 4;
            vm.ValueB = 6;

            //Act

            vm.AddCommand.Execute(null);

            //Assert
            Assert.IsTrue(vm.Result == 10, "vm.Result != 10 !");
        }
예제 #8
0
        public ActionResult Result(MathViewModel quantity)
        {
            var m = BaseMeasure.Random();

            Measures.Instance.Add(m);
            var u1 = new BaseUnit(m, Unit.SetFactor(quantity.QuantityList[0].Unit), quantity.QuantityList[0].Unit, quantity.QuantityList[0].Unit);

            Units.Instance.Add(u1);
            var      q1 = new Quantity(quantity.QuantityList[0].Amount, u1);
            Quantity q2 = new Quantity();

            if (quantity.QuantityList[1].Unit != string.Empty)
            {
                var u2 = new BaseUnit(m, Unit.SetFactor(quantity.QuantityList[1].Unit), quantity.QuantityList[1].Unit, quantity.QuantityList[1].Unit);
                Units.Instance.Add(u2);
                q2 = new Quantity(quantity.QuantityList[1].Amount, u2);
            }
            quantity = SetResult(quantity, q1, q2);
            return(View("Index", quantity));
        }
예제 #9
0
 public SetNumberOfOperationsCommand(MathViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
예제 #10
0
 public AddUser(MathViewModel viewModel) : this()
 {
     this.viewModel = viewModel;
     AddPlayer      = new AddPlayerCommand(viewModel);
 }
예제 #11
0
 public AddPlayerCommand(MathViewModel viewModel)
 {
     this.viewModel = viewModel;
 }
 public NumberOfQuestions(MathViewModel viewModel) : this()
 {
     SetQuestions = new SetNumberOfOperationsCommand(viewModel);
 }
예제 #13
0
 public MainPage()
 {
     InitializeComponent();
     BindingContext = new MathViewModel();
 }
예제 #14
0
        public ActionResult Index()
        {
            var q = new MathViewModel();

            return(View("Index", q));
        }
예제 #15
0
        public IActionResult Index()
        {
            var viewModel = new MathViewModel(MathService.Sessions);

            return(View(viewModel));
        }