Example #1
0
        /// <summary>
        ///Updates the Switch toggle state.
        /// Unfortunately im not yet able to bind this as a command just
        /// But will soon as i figure it out
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void SwitchToggled(object sender, ToggledEventArgs e)
        {
            sub = new Subject {
                Name = Name.Text, Time = Time.Text, Period = Period.Text, Semester = DateTime.Now.Month > 6?2:1
            };
            var helper = new ReminderHelper();

            day = new RealmDataBase().GetDay(sub);
            if (Switch.IsToggled)
            {
                helper.SetReminder(sub, day);
            }
            else
            {
                helper.RemoveReminder(sub, day);
            }
        }
        /// <summary>
        /// Updates Switch toggeled State.
        /// </summary>
        /// //Still to be tested trying to multibind in xamarin is a bit of a challenge
        /// <param name="obj">Object.</param>
        public void SwitchToggeled(ReminderObject obj)
        {
            sub = new Subject {
                Name = obj.Name.Text, Time = obj.Time.Text, Period = obj.Period.Text, Semester = DateTime.Now.Month > 6?2:1
            };
            var helper = new ReminderHelper();

            day = new RealmDataBase().GetDay(sub);
            if (obj.zwitch.IsToggled)
            {
                helper.SetReminder(sub, day);
            }
            else
            {
                helper.RemoveReminder(sub, day);
            }
        }