public SolutionView(GlobalClass global)
        {
            if (global.Solution == null)
            {
                throw new BasicBlankException("No solution to even show");
            }
            if (global.Solution.Count != 4)
            {
                throw new BasicBlankException("Must have 4 for the solution");
            }
            StackPanel stack = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            //this can be larger because nothing else is showing now at this point.
            global.Solution.ForEach(bead =>
            {
                CirclePieceWPF <EnumColorPossibilities> thisControl = new CirclePieceWPF <EnumColorPossibilities>();
                thisControl.SetBinding(CirclePieceWPF <EnumColorPossibilities> .MainColorProperty, new Binding(nameof(Bead.UIColor)));
                thisControl.DataContext       = bead;
                thisControl.Height            = 250;
                thisControl.Width             = 250; //can experiment this time.
                thisControl.NeedsWhiteBorders = true;
                //thisControl.CommandParameter = bead;
                thisControl.Init();
                stack.Children.Add(thisControl);
            });
            Content = stack;
        }
Example #2
0
        public void Init(Guess thisGuess)
        {
            _thisStack             = new StackPanel();
            _thisStack.Orientation = Orientation.Horizontal;
            // at first, act like its nothing.
            int x;

            for (x = 1; x <= 4; x++)
            {
                CirclePieceWPF <EnumColorPossibilities> thisCon = new CirclePieceWPF <EnumColorPossibilities>();
                thisCon.NeedsWhiteBorders = true;
                thisCon.Height            = GuessWidthHeight;
                thisCon.Width             = GuessWidthHeight;
                thisCon.Init();
                _thisStack.Children.Add(thisCon);
            }
            Content = _thisStack;
            SetBinding(HowManyCompletelyCorrectProperty, new Binding(nameof(Guess.HowManyBlacks)));
            SetBinding(HowManySemiCorrectProperty, new Binding(nameof(Guess.HowManyAquas)));
            DataContext = thisGuess;
        }
Example #3
0
        public void PopulateControls(Guess guess)
        {
            _thisStack.Children.Clear();
            if (guess.YourBeads.Count == 0)
            {
                return; //maybe you don't need it at that moment (?)
                //throw new BasicBlankException("You need the 4.  Otherwise don't know anymore");
            }
            if (guess.YourBeads.Count != 4)
            {
                throw new BasicBlankException("Only 4 are supported");
            }
            guess.YourBeads.ForEach(bead =>
            {
                //we may have to manually add to the special list (?)
                CirclePieceWPF <EnumColorPossibilities> thisControl = new CirclePieceWPF <EnumColorPossibilities>();
                thisControl.SetBinding(CirclePieceWPF <EnumColorPossibilities> .MainColorProperty, new Binding(nameof(Bead.UIColor)));
                thisControl.DataContext       = bead;
                thisControl.Height            = GuessWidthHeight;
                thisControl.Width             = GuessWidthHeight;
                thisControl.NeedsWhiteBorders = true;
                thisControl.CommandParameter  = bead;
                thisControl.Init();


                //try to manually hook up this time
                //thisControl.Command =


                thisControl.Name = nameof(GameBoardViewModel.ChangeMind);
                GamePackageViewModelBinder.ManuelElements.Add(thisControl); //try this way.
                //Binding newBind = new Binding(nameof(HintChooserViewModel.ChangeMindCommand));
                //newBind.Source = _thisMod!.Guess1;
                //thisControl.SetBinding(CirclePieceWPF<EnumColorPossibilities>.CommandProperty, newBind);
                _thisStack.Children.Add(thisControl);
            });
        }