//--------------------------------------------------------------------------------------------------------- /// <summary> /// Конвертер типа NotificationType в соответствующую графическую пиктограмму. /// </summary> /// <param name="value">Значение</param> /// <param name="target_type">Целевой тип</param> /// <param name="parameter">Дополнительный параметр</param> /// <param name="culture">Культура</param> /// <returns>Графическая пиктограмма</returns> //--------------------------------------------------------------------------------------------------------- public Object Convert(Object value, Type target_type, Object parameter, CultureInfo culture) { TNotificationType val = (TNotificationType)value; switch (val) { case TNotificationType.Info: { return(Info); } case TNotificationType.Warning: { return(Warning); } case TNotificationType.Error: { return(Error); } default: break; } return(null); }
//--------------------------------------------------------------------------------------------------------- /// <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(); } }