예제 #1
0
 private void InitializeDialogProviders()
 {
     CrudDialogProvider.AddDialog <PresetViewModel>(_serviceProvider.GetService <INestedViewDialog <PresetViewModel> >());
     CrudDialogProvider.AddDialog <RegionViewModel>(_serviceProvider.GetService <INestedViewDialog <RegionViewModel> >());
     var messageBox    = new MessageBoxProvider(_serviceProvider.GetService <IDialogService <MessageBoxDialog, LulDialogResult> >());
     var inputProvider = new InputDialogProvider(_serviceProvider.GetService <IDialogService <InputDialog, InputDialogResult> >());
 }
예제 #2
0
        public static void InitializeOkCancelDialog(RegionViewModel dialogViewModel, DialogResults buttonResult)
        {
            var dialogResult  = new NestedDialogResults <RegionViewModel>(dialogViewModel, buttonResult);
            var dialogService = Substitute.For <INestedViewDialog <RegionViewModel> >();

            dialogService.Show(Arg.Any <NestedViewModel <RegionViewModel> >()).Returns(dialogResult);

            CrudDialogProvider.AddDialog <RegionViewModel>(dialogService);
        }
예제 #3
0
        public void NewItemClicked(ButtonClickArgs e)
        {
            var title   = $"{e.Action} {e.ItemDescriptor}";
            var message = $"{e.Action} {e.ItemDescriptor}: ";

            var results = CrudDialogProvider.Show(new NestedViewModel <RegionViewModel>(title, message, new RegionViewModel(), DialogButtons.OkCancel));

            if (results.DialogResult != DialogResults.Ok)
            {
                return;
            }

            var newRegion = _regionController.Create(SelectedPreset.Id, results.InnerResults.Name);

            Regions.Add(newRegion);
            SelectedRegion = newRegion;
        }
예제 #4
0
        public void EditItemClicked(object sender, ButtonClickArgs e)
        {
            var selectedRegion = SelectedRegion;
            var results        = CrudDialogProvider.Show(new NestedViewModel <RegionViewModel>("Editing Region", "Editing Region: ", selectedRegion, DialogButtons.OkCancel));

            if (results.DialogResult != DialogResults.Ok)
            {
                return;
            }

            var existingRegionIndex = Regions.IndexOf(SelectedRegion);

            _regionController.Delete(SelectedPreset.Id, SelectedRegion.Id);
            var newRegion = _regionController.Create(SelectedPreset.Id, results.InnerResults.Name);

            Regions[existingRegionIndex] = newRegion;
            SelectedRegion = newRegion;
        }
예제 #5
0
        public async Task EditItemClickedAsync(object sender, ButtonClickArgs e)
        {
            var results = CrudDialogProvider.Show(new NestedViewModel <PresetViewModel>("Editing Preset", "Editing Preset: ", SelectedPreset, DialogButtons.OkCancel));

            if (results.DialogResult != DialogResults.Ok)
            {
                return;
            }

            var existingPresetIndex = Presets.IndexOf(SelectedPreset);

            SelectedPreset.Name        = results.InnerResults.Name;
            SelectedPreset.ProcessName = results.InnerResults.ProcessName;

            await _presetController.UpdateAsync(SelectedPreset);

            Presets[existingPresetIndex] = SelectedPreset;
        }
예제 #6
0
        public async Task NewItemClickedAsync(ButtonClickArgs args)
        {
            var e = (ButtonClickArgs)args;

            var title        = $"{e.Action} {e.ItemDescriptor}";
            var message      = $"{e.Action} {e.ItemDescriptor}: ";
            var selectedItem = SelectedPreset;
            var results      = CrudDialogProvider.Show(new NestedViewModel <PresetViewModel>(title, message, selectedItem, DialogButtons.OkCancel));

            if (results.DialogResult != DialogResults.Ok)
            {
                return;
            }

            var newPreset = await _presetController.CreateAsync(results.InnerResults.Name, results.InnerResults.ProcessName);

            Presets.Add(newPreset);
            SelectedPreset = newPreset;
        }