Esempio n. 1
0
        internal async void ExecuteRunDialog(WindowArgument argument)
        {
            AddFoodViewModel model;

            switch (argument)
            {
            case WindowArgument.New:
                model = new AddFoodViewModel();
                break;

            case WindowArgument.Edit:
                model = new AddFoodViewModel(_mainViewModel.SelectedFood);
                break;

            default:
                model = new AddFoodViewModel();
                break;
            }
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new AddFoodView()
            {
                DataContext = model
            };

            //show the dialog
            var result = await DialogHost.Show(view, "RootDialog");

            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));

            CalculateDialogResult(argument, result);
        }
Esempio n. 2
0
 private void RunOpenAddFood(Type obj)
 {
     AddFoodView    = new AddFoodView(_eventAggregator, _myMessageDialog);
     SelectedView   = AddFoodView;
     IsHomeSelected = false;
 }