Esempio n. 1
0
        public void LoadPreferences(Preferences prefs, String key, bool appOnly)
        {
            m_DayView.TaskColorIsBackground        = prefs.GetProfileBool("Preferences", "ColorTaskBackground", false);
            m_DayView.ShowParentsAsFolder          = prefs.GetProfileBool("Preferences", "ShowParentsAsFolders", false);
            m_DayView.AutoCalculateDependencyDates = prefs.GetProfileBool("Preferences", "AutoAdjustDependents", false);
            m_DayView.StrikeThruDoneTasks          = prefs.GetProfileBool("Preferences", "StrikethroughDone", true);
            m_DayView.ShowLabelTips = !prefs.GetProfileBool("Preferences", "ShowInfoTips", false);

            m_AllowModifyTimeEstimate = !prefs.GetProfileBool("Preferences", "SyncTimeEstAndDates", false);

            m_WorkWeek.Load(prefs);
            m_DayView.WeekendDays = m_WorkWeek.WeekendDays();

            int gridColor = -1;

            if (prefs.GetProfileBool("Preferences", "SpecifyGridColor", true))
            {
                gridColor = prefs.GetProfileInt("Preferences\\Colors", "GridLines", -1);
            }

            m_DayView.GridlineColor = ((gridColor == -1) ? DefGridColor : DrawingColor.ToColor((UInt32)gridColor));

            if (!appOnly)
            {
                // private settings
                m_PrefsDlg.LoadPreferences(prefs, key);
                UpdateDayViewPreferences();

                SetDaysShowing(prefs.GetProfileInt(key, "DaysShowing", 7));
            }
            else
            {
                UpdateWorkingHourDisplay();
            }
        }
Esempio n. 2
0
        public void LoadPreferences(Preferences prefs, String key, bool appOnly)
        {
            bool taskColorIsBkgnd = prefs.GetProfileBool("Preferences", "ColorTaskBackground", false);

            m_DayView.TaskColorIsBackground = taskColorIsBkgnd;

            bool showParentsAsFolder = prefs.GetProfileBool("Preferences", "ShowParentsAsFolders", false);

            m_DayView.ShowParentsAsFolder = showParentsAsFolder;

            m_AllowModifyTimeEstimate = !prefs.GetProfileBool("Preferences", "SyncTimeEstAndDates", false);

            m_WorkWeek.Load(prefs);
            m_DayView.WeekendDays = m_WorkWeek.WeekendDays();

            if (!appOnly)
            {
                // private settings
                m_PrefsDlg.LoadPreferences(prefs, key);
                UpdateDayViewPreferences();
            }
            else
            {
                UpdateWorkingHourDisplay();
            }
        }
Esempio n. 3
0
        public void LoadPreferences(Preferences prefs, String key, bool appOnly)
        {
            if (!appOnly)
            {
                // private settings
                m_PrefsDlg.LoadPreferences(prefs, key);
                UpdateDayViewPreferences();
            }

            bool taskColorIsBkgnd = prefs.GetProfileBool("Preferences", "ColorTaskBackground", false);

            m_DayView.TaskColorIsBackground = taskColorIsBkgnd;

            bool showParentsAsFolder = prefs.GetProfileBool("Preferences", "ShowParentsAsFolders", false);

            m_DayView.ShowParentsAsFolder = showParentsAsFolder;

            // Remove for 7.3 *********************************
            String fontName = FontName;
            int    fontSize = 8;

            if (prefs.GetProfileBool("Preferences", "SpecifyTreeFont", false))
            {
                fontName = prefs.GetProfileString("Preferences", "TreeFont", fontName);
                fontSize = prefs.GetProfileInt("Preferences", "FontSize", fontSize);
            }
            SetTaskFont(fontName, fontSize);
            // ************************************************

            // Weekends
            WeekendDays dwWeekends = (WeekendDays)prefs.GetProfileInt("Preferences", "Weekends", 0);

            List <System.DayOfWeek> weekendDays = new List <System.DayOfWeek>();

            if ((dwWeekends & WeekendDays.SUNDAY) == WeekendDays.SUNDAY)
            {
                weekendDays.Add(System.DayOfWeek.Sunday);
            }

            if ((dwWeekends & WeekendDays.SATURDAY) == WeekendDays.SATURDAY)
            {
                weekendDays.Add(System.DayOfWeek.Saturday);
            }

            if ((dwWeekends & WeekendDays.MONDAY) == WeekendDays.MONDAY)
            {
                weekendDays.Add(System.DayOfWeek.Monday);
            }

            if ((dwWeekends & WeekendDays.TUESDAY) == WeekendDays.TUESDAY)
            {
                weekendDays.Add(System.DayOfWeek.Tuesday);
            }

            if ((dwWeekends & WeekendDays.WEDNESDAY) == WeekendDays.WEDNESDAY)
            {
                weekendDays.Add(System.DayOfWeek.Wednesday);
            }

            if ((dwWeekends & WeekendDays.THURSDAY) == WeekendDays.THURSDAY)
            {
                weekendDays.Add(System.DayOfWeek.Thursday);
            }

            if ((dwWeekends & WeekendDays.FRIDAY) == WeekendDays.FRIDAY)
            {
                weekendDays.Add(System.DayOfWeek.Friday);
            }

            m_DayView.WeekendDays = weekendDays;

            // Working hours
            double hoursInDay = prefs.GetProfileDouble("Preferences", "HoursInDay", 8.0);

            // assume working days pivot about 1.30pm
            // eg. a standard working day of 8 hours (+1 for lunch)
            // starts at 9am (13.50 - 4.5) and
            // ends at 6pm (13.30 + 4.5)
            const double MIDDAY         = 13.5;
            const double LUNCHSTARTTIME = (MIDDAY - 0.5);
            const double LUNCHENDTIME   = (MIDDAY + 0.5);

            double StartOfDay = Math.Max(LUNCHSTARTTIME - (hoursInDay / 2), 0);
            double EndOfDay   = Math.Min(LUNCHENDTIME + (hoursInDay / 2), 24);

            m_DayView.WorkingHourStart   = (int)StartOfDay;
            m_DayView.WorkingMinuteStart = (int)((StartOfDay - m_DayView.WorkingHourStart) * 60);

            m_DayView.WorkingHourEnd   = (int)EndOfDay;
            m_DayView.WorkingMinuteEnd = (int)((EndOfDay - m_DayView.WorkingHourEnd) * 60);
        }
        public void LoadPreferences(Preferences prefs, String key, bool appOnly)
        {
            HoursInWorkingDay   = prefs.GetProfileDouble("Preferences", "HoursInDay", 8.0);
            StartOfDayInHours   = prefs.GetProfileDouble("Preferences", "StartOfWorkdayInHours", 9.0);
            StartOfLunchInHours = prefs.GetProfileDouble("Preferences", "StartOfLunchInHours", 13.0);

            if (prefs.GetProfileBool("Preferences", "HasLunchBreak", true))
            {
                EndOfLunchInHours = prefs.GetProfileDouble("Preferences", "EndOfLunchInHours", 14.0);
            }
            else
            {
                EndOfLunchInHours = StartOfLunchInHours;
            }

            bool taskColorIsBkgnd = prefs.GetProfileBool("Preferences", "ColorTaskBackground", false);

            m_DayView.TaskColorIsBackground = taskColorIsBkgnd;

            bool showParentsAsFolder = prefs.GetProfileBool("Preferences", "ShowParentsAsFolders", false);

            m_DayView.ShowParentsAsFolder = showParentsAsFolder;

            // Weekends
            WeekendDays dwWeekends = (WeekendDays)prefs.GetProfileInt("Preferences", "Weekends", 0);

            List <System.DayOfWeek> weekendDays = new List <System.DayOfWeek>();

            if ((dwWeekends & WeekendDays.SUNDAY) == WeekendDays.SUNDAY)
            {
                weekendDays.Add(System.DayOfWeek.Sunday);
            }

            if ((dwWeekends & WeekendDays.SATURDAY) == WeekendDays.SATURDAY)
            {
                weekendDays.Add(System.DayOfWeek.Saturday);
            }

            if ((dwWeekends & WeekendDays.MONDAY) == WeekendDays.MONDAY)
            {
                weekendDays.Add(System.DayOfWeek.Monday);
            }

            if ((dwWeekends & WeekendDays.TUESDAY) == WeekendDays.TUESDAY)
            {
                weekendDays.Add(System.DayOfWeek.Tuesday);
            }

            if ((dwWeekends & WeekendDays.WEDNESDAY) == WeekendDays.WEDNESDAY)
            {
                weekendDays.Add(System.DayOfWeek.Wednesday);
            }

            if ((dwWeekends & WeekendDays.THURSDAY) == WeekendDays.THURSDAY)
            {
                weekendDays.Add(System.DayOfWeek.Thursday);
            }

            if ((dwWeekends & WeekendDays.FRIDAY) == WeekendDays.FRIDAY)
            {
                weekendDays.Add(System.DayOfWeek.Friday);
            }

            m_DayView.WeekendDays = weekendDays;

            if (!appOnly)
            {
                // private settings
                m_PrefsDlg.LoadPreferences(prefs, key);
                UpdateDayViewPreferences();
            }
            else
            {
                UpdateWorkingHourDisplay();
            }
        }