Beispiel #1
0
        private void ShowNotification(string alarmString)
        {
            Notify.ClearUserNotification(this.timerNotificationHandle);

            FormEngine.BringWindowToTop(this);

            if (this.notificationAlarm != null)
            {
                this.notificationAlarm.Dispose();
            }

            this.notificationAlarm = new Microsoft.WindowsCE.Forms.Notification();

            this.notificationAlarm.Caption  = this.Text;
            this.notificationAlarm.Critical = false;

            this.notificationAlarm.InitialDuration    = 60;
            this.notificationAlarm.BalloonChanged    += new Microsoft.WindowsCE.Forms.BalloonChangedEventHandler(notificationAlarm_BalloonChanged);
            this.notificationAlarm.ResponseSubmitted += new Microsoft.WindowsCE.Forms.ResponseSubmittedEventHandler(notificationAlarm_ResponseSubmitted);

            int minute = this.timeRemaining.Minutes;

            if (this.timeRemaining.Seconds > 0)
            {
                minute++;
            }

            this.notificationAlarm.Text     = string.Format(alarmString, minute);
            this.notificationAlarm.Critical = true;

            //this.notificationAlarm.Icon = global::AdaTimerPpc.Properties.Resources.AlarmIcon;
            this.notificationAlarm.Visible = true;
        }
Beispiel #2
0
        private void CleanupNotifications()
        {
            if (this.notificationAlarm != null)
            {
                this.notificationAlarm.Dispose();
                this.notificationAlarm = null;
            }

            Notify.ClearUserNotification(this.timerNotificationHandle);
            Notify.RunAppAtTime(this.application, DateTime.Now);
        }
Beispiel #3
0
        private void menuItemAlarm_Click(object sender, EventArgs e)
        {
            AlarmForm f = new AlarmForm();

            if (this.alarmDateTime.CompareTo(DateTime.Now) <= 0)
            {
                this.isAlarmSet    = false;
                this.alarmDateTime = DateTime.Now.AddMinutes(10);
            }

            f.IsAlarmSet    = this.isAlarmSet;
            f.AlarmDateTime = this.alarmDateTime;

            if (f.ShowDialog() == DialogResult.OK)
            {
                this.isAlarmSet    = f.IsAlarmSet;
                this.alarmDateTime = f.AlarmDateTime;

                Notify.ClearUserNotification(this.alarmNotificationHandle);

                if (this.isAlarmSet)
                {
                    UserNotification notification = new UserNotification();

                    notification.Text   = string.Format(global::AdaTimerPpc.Properties.Resources.AlarmMessage, this.title);
                    notification.Action = NotificationAction.Dialog;
                    notification.Title  = this.title;

                    UserNotificationTrigger trigger = new UserNotificationTrigger();
                    trigger.Application = this.application;
                    trigger.Arguments   = "-ALARM";
                    trigger.Type        = NotificationType.Time;
                    trigger.StartTime   = this.alarmDateTime;

                    this.alarmNotificationHandle = Notify.SetUserNotification(trigger, notification);
                }

                this.SaveSetting();
            }
        }