//--------------------------------------------------------------------------------------------------------- /// <summary> /// Добавление сообщения /// </summary> /// <param name="notice_type">Тип сообщения</param> /// <param name="message">Текст сообщения</param> //--------------------------------------------------------------------------------------------------------- public void AddNotification(TNotificationType notice_type, String message) { CNotification notification = new CNotification(); notification.NoticeType = notice_type; notification.Message = message; notification.ID = mCount++; switch (notice_type) { case TNotificationType.Info: { notification.Title = "Информация"; } break; case TNotificationType.Warning: { notification.Title = "Предупреждение"; } break; case TNotificationType.Error: { notification.Title = "Ошибка"; } break; default: break; } if (mCurrentNotifications.Count + 1 > MaxNotifications) { mBufferNotifications.Add(notification); } else { mCurrentNotifications.Add(notification); } //Show window if there're notifications if (mCurrentNotifications.Count > 0 && !IsActive) { Show(); } }
//--------------------------------------------------------------------------------------------------------- /// <summary> /// Добавление сообщения /// </summary> /// <param name="notification">Сообщение</param> //--------------------------------------------------------------------------------------------------------- public void AddNotification(CNotification notification) { notification.ID = mCount++; if (mCurrentNotifications.Count + 1 > MaxNotifications) { mBufferNotifications.Add(notification); } else { mCurrentNotifications.Add(notification); } //Show window if there're notifications if (mCurrentNotifications.Count > 0 && !IsActive) { Show(); } }
//--------------------------------------------------------------------------------------------------------- /// <summary> /// Удаление сообщения /// </summary> /// <param name="notification">Сообщение</param> //--------------------------------------------------------------------------------------------------------- public void RemoveNotification(CNotification notification) { if (mCurrentNotifications.Contains(notification)) { mCurrentNotifications.Remove(notification); } if (mBufferNotifications.Count > 0) { mCurrentNotifications.Add(mBufferNotifications[0]); mBufferNotifications.RemoveAt(0); } //Close window if there's nothing to show if (mCurrentNotifications.Count < 1) { Hide(); } }
//notification - no expectation of result public void doNotification(string ntype, uint a, uint b, uint c, string info) { var cn = new CNotification(ntype, a, b, c, info); command_.notify(position_, cn); }