Example #1
0
        public void TestClone()
        {
            BaseCalendar baseCalendar = new BaseCalendar();

            baseCalendar.Description = "My description";
            baseCalendar.TimeZone    = TimeZoneInfo.GetSystemTimeZones()[3];
            BaseCalendar clone = (BaseCalendar)baseCalendar.Clone();

            Assert.AreEqual(baseCalendar.Description, clone.Description);
            Assert.AreEqual(baseCalendar.CalendarBase, clone.CalendarBase);
            Assert.AreEqual(baseCalendar.TimeZone, clone.TimeZone);
        }
Example #2
0
        public static BaseCalendar GetUserCalendar(this BaseCalendar calendar, UserViewSettings userViewSettings)
        {
            var cal = (BaseCalendar)calendar.Clone();

            if (userViewSettings == null)
            {
                return(cal);
            }

            //name
            if (!String.IsNullOrEmpty(userViewSettings.Name))
            {
                cal.Name = userViewSettings.Name;
            }

            //backgroundColor
            if (!String.IsNullOrEmpty(userViewSettings.BackgroundColor))
            {
                cal.Context.HtmlBackgroundColor = userViewSettings.BackgroundColor;
            }

            //textColor
            if (!String.IsNullOrEmpty(userViewSettings.TextColor))
            {
                cal.Context.HtmlTextColor = userViewSettings.TextColor;
            }

            //TimeZoneInfo
            if (userViewSettings.TimeZone != null)
            {
                cal.TimeZone = userViewSettings.TimeZone;
            }

            //alert type
            cal.EventAlertType = userViewSettings.EventAlertType;

            return(cal);
        }