示例#1
0
        private async void ExecuteEditMachine(object o)
        {
            if (!(o is MachineViewModel))
            {
                return;
            }

            var editingMachine = o as MachineViewModel;

            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new AddMachineDialog
            {
                DataContext = new MachineViewModel()
                {
                    Id              = editingMachine.Id,
                    Name            = editingMachine.Name,
                    Code            = editingMachine.Code,
                    TagIndex        = editingMachine.TagIndex,
                    CumulativeCount = editingMachine.CumulativeCount
                }
            };

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

            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
示例#2
0
        private async void ExecuteAddMachine(object o)
        {
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new AddMachineDialog
            {
                DataContext = new MachineViewModel()
            };

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

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