Example #1
0
        /// <summary>
        /// Updates this form with the colors for the set theme
        /// </summary>
        public void SetTheme()
        {
            if (WelcomeTheme == null)
            {
                WelcomeTheme = new WelcomeTheme();
            }

            this.BackColor     = WelcomeTheme.GetBackColor();
            pnl_left.BackColor = Color.FromArgb(BackColor.A, BackColor.R - 10, BackColor.G - 10, BackColor.B - 10);

            lbl_welcome.ForeColor       = WelcomeTheme.GetMainLabelForeColor();
            lbl_recentQuizzes.ForeColor = WelcomeTheme.GetMainLabelForeColor();
            lbl_toBegin.ForeColor       = WelcomeTheme.GetMainLabelForeColor();

            btn_addQuiz.BackColor          = WelcomeTheme.GetButtonBackColor();
            btn_createQuiz.BackColor       = WelcomeTheme.GetButtonBackColor();
            btn_loadQuizFromFile.BackColor = WelcomeTheme.GetButtonBackColor();
            btn_importQuiz.BackColor       = WelcomeTheme.GetButtonBackColor();
            //btn_continueLast.BackColor = WelcomeTheme.GetMainButtonBackColor();

            //btn_createQuiz.ForeColor = WelcomeTheme.GetMainButtonForeColor();
            //btn_loadQuiz.ForeColor = WelcomeTheme.GetMainButtonForeColor();
            //btn_importQuizFromSite.ForeColor = WelcomeTheme.GetMainButtonForeColor();
            //btn_continueLast.ForeColor = WelcomeTheme.GetMainButtonForeColor();

            btn_addQuiz.ForeColor          = WelcomeTheme.GetButtonForeColor();
            btn_createQuiz.ForeColor       = WelcomeTheme.GetButtonForeColor();
            btn_loadQuizFromFile.ForeColor = WelcomeTheme.GetButtonForeColor();
            btn_importQuiz.ForeColor       = WelcomeTheme.GetButtonForeColor();
            //btn_continueLast.ForeColor = WelcomeTheme.GetButtonForeColor();

            //lbl_copyright.ForeColor = WelcomeTheme.GetBackgroundLabelForeColor();

            var btnbc = WelcomeTheme.GetButtonBackColor();

            btn_preferences.BackColor = Color.FromArgb(btnbc.A, btnbc.R - 10, btnbc.G - 10, btnbc.B - 10);

            btn_preferences.ForeColor = WelcomeTheme.GetButtonForeColor();

            foreach (var uc in this.GetAllChildrenRecursiveDerives(typeof(AutoThemeableUserControl)))
            {
                // Call the potentially overriden SetTheme() method
                dynamic ucT = Convert.ChangeType(uc, uc.GetType());
                ucT.Invoke(new Action(() =>
                {
                    ucT.SetTheme(null);
                }));

                //uc.SetTheme();
            }
        }
Example #2
0
        public override void SetTheme(GeneralTheme theme = null)
        {
            if (theme == null || theme.GetType() != typeof(WelcomeTheme))
            {
                theme = new WelcomeTheme();
            }

            var lbl_learningProgress_bar_color = lbl_learningProgress_bar.ForeColor;

            base.SetTheme(theme);

            lbl_learningProgress_bar.ForeColor = lbl_learningProgress_bar_color;

            RecolorCards();
        }
Example #3
0
        public override void SetTheme(GeneralTheme theme = null)
        {
            if (theme == null || theme.GetType() != typeof(WelcomeTheme))
            {
                theme = new WelcomeTheme();
            }

            var lbl_learningProgress_bar_color = lbl_learningProgress_bar.ForeColor;
            var bc = BackColor;

            base.SetTheme(theme);

            // Revert backcolor (it's handled in QuizProgressInfo)
            BackColor = bc;

            // Revert learning progress bar color (it should not be changed)
            lbl_learningProgress_bar.ForeColor = lbl_learningProgress_bar_color;
        }
Example #4
0
        /// <summary>
        /// Re-colors the cards in the list, to have every other Card in a different color, to make reading easier
        /// </summary>
        public void RecolorCards()
        {
            int count = 0;

            foreach (var c in flp_words.Controls.OfType <Control>())
            {
                // Every other Card should have a slighly different color to make reading them easier
                var bc = WelcomeTheme.GetBackColor();
                if (count % 2 == 0)
                {
                    c.BackColor = Color.FromArgb(bc.A, bc.R - 5, bc.G - 5, bc.B - 5);
                }
                else
                {
                    c.BackColor = bc;
                }

                ++count;
            }
        }
Example #5
0
        public void LoadCards()
        {
            foreach (var c in flp_words.Controls.OfType <Control>())
            {
                c.Dispose();
            }

            flp_words.Controls.Clear();

            var controls = new List <DashboardQuizCard>();

            foreach (var card in Quiz.Cards)
            {
                var c = new DashboardQuizCard(Quiz, card);
                c.Size = new Size(flp_words.Size.Width - 34, c.Size.Height);
                controls.Add(c);
            }

            switch (cmb_orderAscendingDescending.SelectedItem)
            {
            case "Ascending":
                switch (cmb_order.SelectedItem)
                {
                case "Success Rate":
                    controls = controls.OrderBy(x => x.SuccessRate).ToList();
                    break;

                case "Quiz Order":
                    break;

                case "Alphabetical Front":
                    controls = controls.OrderBy(x => x.Card.Front).ToList();
                    break;

                case "Alphabetical Back":
                    controls = controls.OrderBy(x => x.Card.Back).ToList();
                    break;
                }
                break;

            case "Descending":
                switch (cmb_order.SelectedItem)
                {
                case "Success Rate":
                    controls = controls.OrderByDescending(x => x.SuccessRate).ToList();
                    break;

                case "Quiz Order":
                    controls.Reverse();
                    break;

                case "Alphabetical Front":
                    controls = controls.OrderByDescending(x => x.Card.Front).ToList();
                    break;

                case "Alphabetical Back":
                    controls = controls.OrderByDescending(x => x.Card.Back).ToList();
                    break;
                }
                break;
            }

            int count = 0;

            foreach (var c in controls)
            {
                // Every other Card should have a slighly different color to make reading them easier
                var bc = WelcomeTheme.GetBackColor();
                if (count % 2 == 0)
                {
                    c.BackColor = Color.FromArgb(bc.A, bc.R - 5, bc.G - 5, bc.B - 5);
                }
                else
                {
                    c.BackColor = bc;
                }
                flp_words.Controls.Add(c);
                flp_words.SetFlowBreak(c, true);

                ++count;
            }
        }