コード例 #1
0
        public ReminderCurrentUc(Reminder reminder)
        {
            InitializeComponent();

            _reminder = reminder;
            _reminder.RefreshTimer += OnRefreshTimer;

            nameLbl.Text = _reminder.Name;
            timeLbl.Text = _reminder.GetRemainingTime().ToString();
        }
コード例 #2
0
        private void OnRefreshTimer(object sender, ReminderEventArgs e)
        {
            var remainingTime = _reminder.GetRemainingTime();

            if (remainingTime == _reminder.Interval - 1 || remainingTime == -1) // Repeats or is done
            {
                RefreshReminders?.Invoke(sender, e);
            }

            timeLbl.Text = remainingTime.ToString();
        }