public void Init()
        {
            callNumbers = randomGen.generateNumbersAndDescription(matches + 3);
            switch (ListToggle.IsChecked)
            {
            case false:
                keys = callNumbers.Keys.Take(matches).ToList();
                foreach (DeweyDecimalSystem item in callNumbers.Values)
                {
                    values.Add(item.High);
                }
                values = values.OrderBy(a => Guid.NewGuid()).ToList();

                FirstList.ItemsSource  = keys;
                SecondList.ItemsSource = values;
                elementFunctions.EnableDragAndDrop(SecondList, values, (Style)FindResource("MaterialDesignListBoxItem"), (Style)FindResource("MaterialDesignToolToggleFlatListBox"));
                break;

            case true:
                SecondList.ItemsSource = null;
                keys = callNumbers.Keys.OrderBy(a => Guid.NewGuid()).ToList();
                foreach (DeweyDecimalSystem item in callNumbers.Values)
                {
                    values.Add(item.High);
                }

                FirstList.ItemsSource  = values.Take(matches);
                SecondList.ItemsSource = keys;
                elementFunctions.EnableDragAndDrop(SecondList, keys, (Style)FindResource("MaterialDesignListBoxItem"), (Style)FindResource("MaterialDesignToolToggleFlatListBox"));
                break;
            }
            InitTimer();
        }
Exemplo n.º 2
0
        public void Init(int difficulty)
        {
            InitTimer();
            items = randomGen.generateNumbersAndDescription(matches);
            for (int i = 0; i < items.Count; i++)
            {
                callNumbers.Add(items.Keys.ElementAt(i));
                correctOrder.Add(items.Keys.ElementAt(i));
            }
            ReplaceBooksList.ItemsSource = callNumbers;
            ReplaceBooksList.HorizontalContentAlignment = HorizontalAlignment.Center;

            elementFunctions.EnableDragAndDrop(ReplaceBooksList, callNumbers, (Style)FindResource("MaterialDesignListBoxItem"), (Style)FindResource("MaterialDesignToolVerticalToggleListBox"));
        }