예제 #1
0
        /// <summary>
        /// Notify observer
        /// </summary>
        /// <param name="content">message content</param>
        /// <param name="type">notification type</param>
        protected void NotifyObserver(string content, NOTIFICATION_TYPE type)
        {
            switch (type)
            {
            case NOTIFICATION_TYPE.QUESTION:
                observer.QuestionAsked(content);
                break;

            case NOTIFICATION_TYPE.ANSWER:
                observer.AnswerGiven(content);
                break;
            }
        }
예제 #2
0
        public void     NotifyFiche(Fiche _fiche, NOTIFICATION_TYPE _type)
        {
            // Register notification
            m_lastNotificationTime = DateTime.Now;

            int panelsCount = 0;

            switch (_type)
            {
            case NOTIFICATION_TYPE.SUCCESS: m_successCounter++; panelsCount++; break;

            case NOTIFICATION_TYPE.WARNING: m_warningCounter++; panelsCount++; break;

            case NOTIFICATION_TYPE.ERROR:   m_errorCounter++; panelsCount++; break;
            }

            // Resize depending on amount of panels we need
            this.Size = new Size(panelsCount * ICON_PANEL_SIZE, ICON_PANEL_SIZE);

            // Center form on screen
            Point sourcePosition;

            if (Visible)
            {
                sourcePosition = this.Location;                                 // Next, simply use the screen where the form already is
            }
            else
            {
                sourcePosition = Control.MousePosition;                 // First popup on the screen where the mouse is
            }
            Screen containingScreen;
            IntPtr hMonitor;

            Interop.GetMonitorFromPosition(sourcePosition, out containingScreen, out hMonitor);
            this.Location = new Point((containingScreen.Bounds.Width - this.Width) / 2, (containingScreen.Bounds.Height - this.Height) / 2);

            // Ask for a repaint
            Invalidate();

            // Show if not already visible
            if (!Visible)
            {
                Show(m_owner);
            }
        }
 public UserNotification( NOTIFICATION_TYPE type, string userName, string data = "")
 {
     this.type = type;
     this.userName = userName;
     this.data = data;
 }