Beispiel #1
0
 /// <summary>
 /// Unlink the current item, if any.
 /// </summary>
 private void UnlinkItem()
 {
     if (m_item == null) return;
     m_wm.GetKwsByInternalID(m_item.InternalWsID).ReleaseRef();
     m_item = null;
 }
Beispiel #2
0
        /// <summary>
        /// Show the tray message.
        /// </summary>
        /// <param name="item">What to display.</param>
        /// <param name="detail">Desired notification detail.</param>
        public void ShowMessage(NotificationItem item)
        {
            if (IsDisposed || Disposing)
            {
                Debug.Assert(false);
                Logging.Log(2, "Error in TrayMessage. Contact Teambox support.");
                return;
            }

            DateTime now = DateTime.Now;

            // If not enough time has passed since the last notification or we
            // haven't caught up or an item is being displayed, bail out
            if (m_lastNotificationDate.AddSeconds(MinNotifInterval) >= now ||
                !m_wm.GetKwsByInternalID(item.InternalWsID).KAnpState.CaughtUpFlag ||
                this.Visible)
            {
                return;
            }

            // Set the current item.
            LinkItem(item);

            // Set the last notification date.
            m_lastNotificationDate = now;

            lblTitle.Text = item.WorkspaceName;

            rtbNotification.Text = "";
            rtbNotification.Rtf = null;
            if (item.HasRtfText) rtbNotification.Rtf = item.EventRtf;
            else rtbNotification.Text = item.EventText;

            this.Top = m_downTop;
            this.Left = iLeft;

            this.Refresh();

            timerAnimShow.Tick += new EventHandler(ShowMe);
            timerAnimShow.Interval = 10;
            timerAnimShow.Enabled = true;
            timerAnimShow.Start();

            timerHideDelay.Tick += new EventHandler(HideMessage);
            timerHideDelay.Interval = Misc.ApplicationSettings.NotificationDelay;
            timerHideDelay.Enabled = true;
            timerHideDelay.Start();

            Base.ShowInactiveTopmost(this);
            m_isShowing = true;
        }
Beispiel #3
0
 /// <summary>
 /// Store a reference to the item specified.
 /// </summary>
 private void LinkItem(NotificationItem item)
 {
     UnlinkItem();
     m_item = item;
     m_wm.GetKwsByInternalID(item.InternalWsID).AddRef();
 }
Beispiel #4
0
        public void NotifyUser(NotificationItem item)
        {
            if (!HasCaughtUpWithKasEvents()) item.WantShowPopup = false;

            m_wm.UiBroker.NotifyUser(item);
        }
Beispiel #5
0
 public KwmPopupEventArgs(NotificationItem item)
 {
     NotificationItem = item;
 }
Beispiel #6
0
        /// <summary>
        /// Show the tray message.
        /// </summary>
        /// <param name="item">What to display.</param>
        /// <param name="detail">Desired notification detail.</param>
        public void ShowMessage(NotificationItem item)
        {
            DateTime now = DateTime.Now;

            // If not enough time has passed since the last notification or we
            // haven't caught up or an item is being displayed, bail out
            if (m_lastNotificationDate.AddSeconds(MinNotifInterval) >= now ||
                !m_wm.GetKwsByInternalID(item.InternalWsID).KAnpState.CaughtUpFlag ||
                this.Visible)
            {
                return;
            }

            // Set the current item.
            LinkItem(item);

            // Set the last notification date.
            m_lastNotificationDate = now;

            lblTitle.Text = item.WorkspaceName;

            rtbNotification.Text = "";
            rtbNotification.Rtf = null;
            if (item.HasRtfText) rtbNotification.Rtf = item.EventRtf;
            else rtbNotification.Text = item.EventText;

            this.Top = m_downTop;
            this.Left = iLeft;

            // Make sure the modifications are applied. This is necessary
            // because under a certain amount of load, the old strings
            // are showed for half a second before being replaced by the real
            // content.
            this.Invalidate();

            timerAnimShow.Tick += new EventHandler(ShowMe);
            timerAnimShow.Interval = 10;
            timerAnimShow.Enabled = true;
            timerAnimShow.Start();

            timerHideDelay.Tick += new EventHandler(HideMessage);
            timerHideDelay.Interval = Misc.ApplicationSettings.NotificationDelay;
            timerHideDelay.Enabled = true;
            timerHideDelay.Start();

            Base.ShowInactiveTopmost(this);
            m_isShowing = true;
        }
Beispiel #7
0
        /// <summary>
        /// Method used to update the UI in order to alert the user that 
        /// a new event was received in one of his workspaces.
        /// </summary>
        public void NotifyUser(NotificationItem item)
        {
            Debug.Assert(item != null);
            Workspace ws = m_wm.KwsTree[item.InternalWsID];

            // Show the tray message if configured to do so.
            if (Misc.ApplicationSettings.ShowNotification && item.WantShowPopup)
                m_trayMessage.ShowMessage(item);

            // Set the appropriate background color if the notification is not related to
            // the current workspace.
            if (Browser.GetSelectedKwsID() != item.InternalWsID && item.WantBoldWs)
            {
                if (MarkNodeNotifyFlag(ws))
                {
                    // Node did not have its Notify flag set, so we're changing
                    // the wmstate. Mark as dirty.
                    m_wm.SetDirty();
                    RequestBrowserUiUpdate(false);
                }
            }

            // If the main form is not the selected application, start the tray icon blinking.
            if (item.WantBlinkTrayIcon && m_mainForm.Handle != (IntPtr)Syscalls.GetForegroundWindow())
                m_mainForm.StartBlinking();
        }
Beispiel #8
0
 // *******************
 // This section contains the user notification logic.
 // *******************
 /// <summary>
 /// Called when a notification item is clicked on. The Main form is 
 /// shown if needed and the relevant workspace and application tabs 
 /// are automatically selected.
 /// </summary>
 public void HandleOnTrayClick(NotificationItem item)
 {
     if (!Misc.IsUiStateOK()) return;
     m_mainForm.ShowMainForm();
     RequestSelectKws(m_wm.GetKwsByInternalID(item.InternalWsID), true);
     m_mainForm.SetTabApplication(item.AppId);
 }