예제 #1
0
        /// <summary>
        /// Sets the default value for AlarmRecord object
        /// </summary>
        public void SetDefault()
        {
            /// Sets current time to scheduled date time (Alarm creation time)
            ScheduledDateTime = System.DateTime.Now;

            // 24-hour format or not (AM or PM)
            AlarmDateFormat = ((App)Application.Current).Is24hourFormat ? DateFormat.Format24Hour : DateFormat.Format12HourAM;
            if (((App)Application.Current).Is24hourFormat)
            {
                AlarmDateFormat = DateFormat.Format24Hour;
            }
            else
            {
                if (ScheduledDateTime.ToString("tt").Equals("AM"))
                {
                    AlarmDateFormat = DateFormat.Format12HourAM;
                }
                else
                {
                    AlarmDateFormat = DateFormat.Format12HourPM;
                }
            }

            /// Sets Never to Repeat weekday flag
            WeekFlag = AlarmWeekFlag.Never;

            /// Sets WeekdayRepeatText
            WeekdayRepeatText = GetFormatted(WeekFlag, true);

            /// Sets repeat to false
            Repeat = false;

            /// Sets default alarm type to sound
            AlarmType = AlarmTypes.Sound;

            /// Sets volume to 0.1
            Volume = 0.7;

            IsMute = false;

            /// Sets default alarm to alarm mp3
            AlarmToneType = AlarmToneTypes.Default;

            /// Sets default state to active
            AlarmState = AlarmStates.Snooze;
            ///// Sets snooze to true
            Snooze = true;

            /// Sets alarm name to empty
            AlarmName = "";

            /// This indicates whether it is newly created or not.
            /// This value should set to false at default creation time
            IsSerialized = false;

            /// This field is used to uniquely identify alarm by created time
            DateCreated = ScheduledDateTime.TimeOfDay;
        }
 public override string ToString()
 {
     return(string.Format($"Date: {ScheduledDateTime.ToShortDateString()} {ScheduledDateTime.ToLongTimeString()}, count: {Recipients.Count()}"));
 }