Ejemplo n.º 1
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            //WM_NOTIFY
            case 78:
                NMSHN nm = (NMSHN)Marshal.PtrToStructure(m.LParam, typeof(NMSHN));
                NotificationWithSoftKeys n = (NotificationWithSoftKeys)m_notifications[nm.idFrom];

                switch (nm.code)
                {
                case SHNN.DISMISS:
                    n.OnBalloonChanged(new BalloonChangedEventArgs(false));
                    break;

                case SHNN.SHOW:
                    n.OnBalloonChanged(new BalloonChangedEventArgs(true));
                    break;

                case SHNN.LINKSEL:
                    string link = Marshal.PtrToStringUni((IntPtr)nm.union1);
                    n.OnResponseSubmitted(new ResponseSubmittedEventArgs(link));
                    break;

                case SHNN.NAVNEXT:
                    n.OnSpinnerClick(new SpinnerClickEventArgs(true));
                    break;

                case SHNN.NAVPREV:
                    n.OnSpinnerClick(new SpinnerClickEventArgs(false));
                    break;
                }
                break;

            //WM_COMMAND
            case 0x0111:
            {
                uint value = ((uint)m.WParam & 0xFFFF);
                int  id    = (int)(value >> 8);
                byte index = (byte)(value & 0xFF);

                NotificationWithSoftKeys z = (NotificationWithSoftKeys)m_notifications[id];
                if (index == 0)
                {
                    z.OnLeftSoftKeyClick(EventArgs.Empty);
                }
                else
                {
                    z.OnRightSoftKeyClick(EventArgs.Empty);
                }
            }
            break;
            }

            //do base wndproc
            base.WndProc(ref m);
        }
        public void ShowNotif(String text)
        {
            _notifTexts.Add(text);
            _notifIndex = 1;

            if (_softkeyNotification == null)
            {
                _softkeyNotification = new NotificationWithSoftKeys();
                _softkeyNotification.Icon = Resources.Notif;
                _softkeyNotification.InitialDuration = 20;
                _softkeyNotification.Spinners = true;
                _softkeyNotification.SpinnerClick += new SpinnerClickEventHandler(softkeyNotification_SpinnerClick);
                _softkeyNotification.LeftSoftKey = new NotificationSoftKey(SoftKeyType.Hide, "Hide");
                _softkeyNotification.RightSoftKey = new NotificationSoftKey(SoftKeyType.Dismiss, "Dismiss all");
                _softkeyNotification.RightSoftKeyClick += new EventHandler(softkeyNotificationCustom2_RightSoftKeyClick);
            }

            _softkeyNotification.Caption = String.Format("Location Scheduler\t{0} of {1}", _notifIndex, _notifTexts.Count);
            _softkeyNotification.Text = text;
            _softkeyNotification.Visible = true;
        }
 private void softkeyNotificationCustom2_RightSoftKeyClick(object sender, EventArgs e)
 {
     _notifIndex = 1;
     _notifTexts.Clear();
     _softkeyNotification = null;
 }