/// <summary>
        /// Show homework notification
        /// </summary>
        private static void NotifyHomework()
        {
            SaveInServer.Download();

            HomeworksViewerContainer viewer = new HomeworksViewerContainer();

            HomeworkManager.Initialize(viewer, new HomeworkEditorControl());

            Homework[] homeworks = null;
            DateTime   date      = HomeworkManager.todayDate.AddDays(1);

            for (int i = 0; i < 15; i++)
            {
                homeworks = HomeworkManager.GetHomeworksOf(date);

                if (homeworks == null || homeworks.Length <= 0)
                {
                    date = date.AddDays(1);
                }
                else
                {
                    break;
                }
            }

            new HomeworksNotificationWindow(homeworks, viewer, date).Show();
        }
Esempio n. 2
0
        /// <summary>
        /// Set color of homeworks text.
        /// </summary>
        /// <param name="target">The target of this change. <see cref="ColorTarget"/>.</param>
        /// <param name="brush">The new value (color or brush).</param>
        /// <param name="save">If true, this change will be saved.</param>
        public static void SetColor(ColorTarget target, Brush brush, bool save = true)
        {
            switch (target)
            {
            case ColorTarget.NormalHomeworks:
                Global.userData.settings.colors.NormalHomeworksColor = brush;
                break;

            case ColorTarget.Tests:
                Global.userData.settings.colors.TestsColor = brush;
                break;

            case ColorTarget.subjects:
                Global.userData.settings.colors.SubjectsColor = brush;
                break;

            case ColorTarget.HighlightedHomeworks:
                Global.userData.settings.colors.HighlightColor = brush;
                break;

            default:
                throw new Exception("ColorTarget value \"" + target + "\" isn't known (SettingsManager.SetColor)");
            }

            HomeworkManager.RecolorViewers();

            EventsManager.Call_ColorChanged(target, brush);

            if (save)
            {
                Save.SaveData();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Set font of homework text.
        /// </summary>
        /// <param name="target">The target of this change. <see cref="FontTarget"/>.</param>
        /// <param name="font">The new font. <see cref="FontGroup"/>.</param>
        /// <param name="save">If true, this change will be saved.</param>
        public static void SetFont(FontTarget target, FontGroup font, bool save = true)
        {
            if (font == null)
            {
                return;
            }

            switch (target)
            {
            case FontTarget.NormalHomeworks:
                Global.userData.settings.fonts.NormalHomeworksFont = font;
                break;

            case FontTarget.Tests:
                Global.userData.settings.fonts.TestsFont = font;
                break;

            case FontTarget.subjects:
                Global.userData.settings.fonts.SubjectsFont = font;
                break;

            default:
                throw new Exception("FontTarget value \"" + target + "\" isn't known (SettingsManager.SetFont)");
            }

            HomeworkManager.RefontViewers();
            EventsManager.Call_FontChanged(target, font);

            if (save)
            {
                Save.SaveData();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Set fonts settings.
        /// </summary>
        /// <param name="fontsSettings">The new <c>FontsSettings</c>.</param>
        /// <param name="save">If true, this change will be saved.</param>
        public static void SetFonts(FontsSettings fontsSettings, bool save = true)
        {
            Global.userData.settings.fonts = fontsSettings;

            EventsManager.Call_FontsSettingsChanged(fontsSettings);
            EventsManager.Call_FontChanged(FontTarget.NormalHomeworks, fontsSettings.NormalHomeworksFont);
            EventsManager.Call_FontChanged(FontTarget.Tests, fontsSettings.TestsFont);
            EventsManager.Call_FontChanged(FontTarget.subjects, fontsSettings.SubjectsFont);

            HomeworkManager.RefontViewers();

            if (save)
            {
                Save.SaveData();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Set colors settings.
        /// </summary>
        /// <param name="colorsSettings">The new colors settings.</param>
        /// <param name="save">If true, this change will be saved.</param>
        public static void SetColors(ColorsSettings colorsSettings, bool save = true)
        {
            Global.userData.settings.colors = colorsSettings;

            EventsManager.Call_ColorsSettingsChanged(colorsSettings);
            EventsManager.Call_ColorChanged(ColorTarget.NormalHomeworks, colorsSettings.NormalHomeworksColor);
            EventsManager.Call_ColorChanged(ColorTarget.Tests, colorsSettings.TestsColor);
            EventsManager.Call_ColorChanged(ColorTarget.subjects, colorsSettings.SubjectsColor);
            EventsManager.Call_ColorChanged(ColorTarget.HighlightedHomeworks, colorsSettings.HighlightColor);
            EventsManager.Call_WinBackgroundChanged(colorsSettings.BackgroundColor);

            HomeworkManager.RecolorViewers();

            if (save)
            {
                Save.SaveData();
            }
        }