public async Task<IEnumerable<ushort>> ShowControllerDialogAsync(object context, ISolver solver, string generatorName, SkillTree tree) { var vm = new ControllerViewModel(solver, generatorName, tree, this); var view = new ControllerWindow(); Task<IEnumerable<ushort>> task = null; await ShowDialogAsync(context, vm, view, () => task = vm.RunSolverAsync()); return await task; }
public void SkillAllTaggedNodes() { if (!GetCheckedNodes().Except(SkilledNodes).Any()) { Popup.Info(L10n.Message("Please tag non-skilled nodes by right-clicking them.")); return; } try { // Use the SettingsViewModel without View and with a fixed SteinerTabViewModel. var settingsVm = new SettingsViewModel(this, new SteinerTabViewModel(this)); settingsVm.StartController += (sender, args) => { var dialog = new ControllerWindow() {Owner = MainWindow, DataContext = args.ViewModel}; dialog.ShowDialog(); }; settingsVm.RunCommand.Execute(null); } catch (Exception e) { Popup.Error(L10n.Message("Error while trying to find solution"), e.Message); Debug.WriteLine("Exception in 'Skill Tagged Nodes':"); Debug.WriteLine(e.Message); } }