Example #1
0
        private void Run()
        {
            if (StartController == null)
            {
                return;
            }

            var savedHighlights = _tree.HighlightedNodes;

            var settings     = CreateSettings();
            var solver       = Tabs[_selectedTabIndex].CreateSolver(settings);
            var controllerVm = new ControllerViewModel(solver, Tabs[_selectedTabIndex].DisplayName, _tree);

            controllerVm.StartSolverAsync();
            // Kinda crude, but I'm not going to write a framework for a few popups.
            StartController.Raise(this, new StartControllerEventArgs(controllerVm));

            if (controllerVm.Result == true)
            {
                _tree.SkilledNodes = new HashSet <ushort>(controllerVm.BestSoFar);
            }
            _tree.HighlightedNodes = savedHighlights;
            _tree.DrawTreeComparisonHighlight();
            _tree.DrawHighlights();
            _tree.UpdateAvailNodes();

            RunFinished.Raise(this);
        }
 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;
 }
Example #3
0
        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 StartControllerEventArgs(ControllerViewModel viewModel)
 {
     ViewModel = viewModel;
 }
        private void Run()
        {
            if (StartController == null) return;

            var savedHighlights = _tree.HighlightedNodes;

            var settings = CreateSettings();
            var solver = Tabs[_selectedTabIndex].CreateSolver(settings);
            var controllerVm = new ControllerViewModel(solver, Tabs[_selectedTabIndex].DisplayName, _tree);

            controllerVm.StartSolverAsync();
            // Kinda crude, but I'm not going to write a framework for a few popups.
            StartController.Raise(this, new StartControllerEventArgs(controllerVm));

            if (controllerVm.Result == true)
            {
                _tree.SkilledNodes = new HashSet<ushort>(controllerVm.BestSoFar);
            }
            _tree.HighlightedNodes = savedHighlights;
            _tree.DrawNodeBaseSurroundHighlight();
            _tree.DrawHighlights();
            _tree.UpdateAvailNodes();

            RunFinished.Raise(this);
        }
Example #6
0
 public StartControllerEventArgs(ControllerViewModel viewModel)
 {
     ViewModel = viewModel;
 }