/// <summary> /// When the selected index changes, we update the settings. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void combo_SelectedIndexChanged(object sender, EventArgs e) { ComboBox combo = (ComboBox)sender; NotificationCategory cat = (NotificationCategory)combo.Tag; m_settings.Categories[cat].ToolTipBehaviour = (ToolTipNotificationBehaviour)combo.SelectedIndex; }
/// <summary> /// Adds the combo box. /// </summary> /// <param name="height">The height.</param> /// <param name="cat">The cat.</param> private void AddComboBox(int height, NotificationCategory cat) { ComboBox tempCombo = null; try { tempCombo = new ComboBox(); tempCombo.Items.AddRange(new object[] { "Never", "Once", "Repeat until clicked" }); tempCombo.Tag = cat; tempCombo.SelectedIndex = 0; tempCombo.Margin = new Padding(3); tempCombo.Height = RowHeight - 4; tempCombo.Width = labelBehaviour.Width; tempCombo.DropDownStyle = ComboBoxStyle.DropDownList; tempCombo.Location = new Point(labelBehaviour.Location.X, height + 2); tempCombo.SelectedIndexChanged += combo_SelectedIndexChanged; ComboBox combo = tempCombo; tempCombo = null; Controls.Add(combo); m_combos.Add(combo); } finally { tempCombo?.Dispose(); } }
/// <summary> /// When the selected checkbox check state changes, we update the settings. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void checkbox_CheckedChanged(object sender, EventArgs e) { CheckBox checkbox = (CheckBox)sender; NotificationCategory cat = (NotificationCategory)checkbox.Tag; m_settings.Categories[cat].ShowOnMainWindow = checkbox.Checked; }
/// <summary> /// /// </summary> /// <param name="category"></param> /// <returns></returns> protected static UNNotificationCategory RegisterActionList(NotificationCategory category) { if (category is null || category.CategoryType == NotificationCategoryType.None) { return(null); } var nativeActionList = new List <UNNotificationAction>(); foreach (var notificationAction in category.ActionList) { if (notificationAction.ActionId == -1000) { continue; } var nativeAction = UNNotificationAction.FromIdentifier(notificationAction.ActionId.ToString(CultureInfo.InvariantCulture), notificationAction.Title, ToNativeActionType(notificationAction.iOSAction)); nativeActionList.Add(nativeAction); } if (nativeActionList.Any() == false) { return(null); } var notificationCategory = UNNotificationCategory .FromIdentifier(ToNativeCategory(category.CategoryType), nativeActionList.ToArray(), Array.Empty <string>(), UNNotificationCategoryOptions.CustomDismissAction); return(notificationCategory); }
public Notification(string content, NotificationCategory category, RegisteredUser notificationFrom, List <RegisteredUser> notificationTo) { ContentOfNotification = content; NotificationCategory = category; NotificationTo = notificationTo; NotificationFrom = notificationFrom; }
/// <summary> /// Gets the key for the given sender and category. /// </summary> /// <param name="sender"></param> /// <param name="category"></param> /// <returns></returns> public static long GetKey(Object sender, NotificationCategory category) { var left = ((long)category) << 32; var right = (sender == null ? 0 : sender.GetHashCode()); return(left | unchecked ((uint)right)); }
internal Notification(NotificationCategory category, NotificationType type, Security security, List <FieldChange> fieldChanges) { this.category = category; this.type = type; this.security = security; this.fieldChanges = fieldChanges; }
/// <summary> /// Gets the key for the given sender and category. /// </summary> /// <param name="sender"></param> /// <param name="category"></param> /// <returns></returns> public static long GetKey(Object sender, NotificationCategory category) { long left = (long)category << 32; int right = sender?.GetHashCode() ?? 0; return(left | unchecked ((uint)right)); }
/// <summary> /// Adds the check box. /// </summary> /// <param name="height">The height.</param> /// <param name="cat">The cat.</param> private void AddCheckBox(int height, NotificationCategory cat) { CheckBox tempCheckbox = null; try { tempCheckbox = new CheckBox(); tempCheckbox.CheckedChanged += checkbox_CheckedChanged; tempCheckbox.Tag = cat; tempCheckbox.Text = "Show"; tempCheckbox.Margin = new Padding(3); tempCheckbox.Height = RowHeight - 4; tempCheckbox.Width = labelMainWindow.Width; tempCheckbox.Location = new Point(labelMainWindow.Location.X + 15, height + 2); CheckBox checkbox = tempCheckbox; tempCheckbox = null; Controls.Add(checkbox); m_checkboxes.Add(checkbox); } finally { tempCheckbox?.Dispose(); } }
public ActionResult DeleteConfirmed(int id) { NotificationCategory notificationCategory = db.NotificationCategorys.Find(id); db.NotificationCategorys.Remove(notificationCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
internal Notification(NotificationCategory category, NotificationType type, IOI ioi, int errorCode, string errorMessage) { this.category = category; this.type = type; this.ioi = ioi; this._errorCode = errorCode; this._errorMessage = errorMessage; }
internal Notification(NotificationCategory category, NotificationType type, Security security, int errorCode, string errorMessage) { this.category = category; this.type = type; this.security = security; this._errorCode = errorCode; this._errorMessage = errorMessage; }
public ReportMsFailedNotificationViewModel(NotificationCategory category ,List<KeyInfo> keys) { this.keys = new ObservableCollection<KeyInfo>(keys); if (category == NotificationCategory.ReportedKeysFaild) SetReportedNotice(); else if (category == NotificationCategory.ReturnedKeysFaild) SetReturnedNotice(); }
/// <summary> /// /// </summary> public void Pop(NotificationCategory category) { Notification old = notifications.FirstOrDefault(n => n.Category == category); if (old != null) { notifications.Remove(old); } }
public void Should_Construct_NotificationCategory() { NotificationCategory notificationCategory = new NotificationCategory(); _ = notificationCategory.Id; _ = notificationCategory.ArabicName; _ = notificationCategory.EnglishName; notificationCategory.ShouldNotBeNull(); }
public ActionResult Edit([Bind(Include = "NotificationCategoryId,Name,Title,Details,DetailsURL,NotificationType")] NotificationCategory notificationCategory) { if (ModelState.IsValid) { db.Entry(notificationCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(notificationCategory)); }
public static int Insert(string Name, int ParentID) { using (var dbe = new inventorymanagementEntities()) { NotificationCategory ui = new NotificationCategory(); ui.Name = Name; ui.ParentID = ParentID; dbe.NotificationCategories.Add(ui); int kq = dbe.SaveChanges(); return(ui.ID); } }
public static IEnumerable<IPlayerNotification> GetNotifications(int count, NotificationCategory category) { var result = messages.Cast<IPlayerNotification>(); if (category != NotificationCategory.None) { result = result.Where(m => m.Category == category); } if (count > 0) { result = result.Take(count); } return result; }
// GET: NotificationCategories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NotificationCategory notificationCategory = db.NotificationCategorys.Find(id); if (notificationCategory == null) { return(HttpNotFound()); } return(View(notificationCategory)); }
internal Notification(NotificationCategory category, NotificationType type, object source, List <FieldChange> fieldChanges) { this.category = category; this.type = type; if (category == NotificationCategory.ORDER) { order = (Order)source; } else if (category == NotificationCategory.ROUTE) { route = (Route)source; } this.fieldChanges = fieldChanges; }
/// <summary> /// /// </summary> /// <param name="category"></param> /// <param name="message"></param> /// <param name="windowType"></param> /// <param name="callback"></param> /// <param name="windowParameters"></param> public Notification(NotificationCategory category, string message, Type windowType, Action callback, params object[] windowParameters) { Category = category; Message = message; WindowType = windowType; WindowParameters = windowParameters; Callback = callback; Timestamp = DateTime.Now; if (WindowType == null && Callback == null) { ButtonVisibility = Visibility.Hidden; } ButtonContent = WindowType == null ? MergedResources.Common_Ok : MergedResources.Common_View; }
public static NotificationCategory GetByID(int ID) { using (var dbe = new inventorymanagementEntities()) { NotificationCategory ai = dbe.NotificationCategories.Where(a => a.ID == ID).SingleOrDefault(); if (ai != null) { return(ai); } else { return(null); } } }
Notification(NotificationCategory category, NotificationType type, object source, int errorCode, string errorMessage) { this.category = category; this.type = type; if (category == NotificationCategory.ORDER) { order = (Order)source; } else if (category == NotificationCategory.ROUTE) { route = (Route)source; } this._errorCode = errorCode; this._errorMessage = errorMessage; }
public static string Update(int ID, string Name, int ParentID) { using (var dbe = new inventorymanagementEntities()) { NotificationCategory ui = dbe.NotificationCategories.Where(a => a.ID == ID).SingleOrDefault(); if (ui != null) { ui.Name = Name; ui.ParentID = ParentID; int kq = dbe.SaveChanges(); return(kq.ToString()); } else { return(null); } } }
public static void DefaultTemplate(DbEntities db) { var user = db.User.Local.Where(r => r.Name.Contains("System Admin")).FirstOrDefault() ?? db.User.Where(r => r.Name.Contains("System Admin")).FirstOrDefault(); foreach (NotificationType notifyType in Enum.GetValues(typeof(NotificationType))) { var tempSLA = db.SLAReminder.Where(s => s.NotificationType == notifyType).FirstOrDefault(); NotificationCategory tempCategory = (int)0; if (tempSLA != null) { tempCategory = tempSLA.NotificationCategory; } var template = db.NotificationTemplates.Local.Where(r => r.NotificationType == notifyType).FirstOrDefault() ?? db.NotificationTemplates.Where(r => r.NotificationType == notifyType).FirstOrDefault(); if (template == null) { db.NotificationTemplates.Add( new NotificationTemplate { NotificationType = notifyType, NotificationCategory = tempCategory, TemplateName = notifyType.DisplayName(), TemplateRefNo = "T" + ((int)notifyType).ToString(), enableEmail = true, TemplateSubject = "Subject: " + notifyType.DisplayName(), TemplateMessage = "Email Body Template", enableSMSMessage = true, SMSMessage = "SMS Message Template", enableWebMessage = true, WebMessage = "Web Message Template", WebNotifyLink = "", CreatedDate = DateTime.Now, CreatedBy = user.Id, User = user, Display = true }); } } }
public ActionResult Create([Bind(Include = "NotificationCategoryId,Name,Title,Details,DetailsURL,NotificationType")] NotificationCategory notificationCategory, string[] users) { if (ModelState.IsValid) { db.NotificationCategorys.Add(notificationCategory); NotificationCatUser nu = new NotificationCatUser(); foreach (string user in users) { nu = new NotificationCatUser(); nu.UserId = user; nu.NotificationCategoryId = notificationCategory.NotificationCategoryId; db.NotificationCatUsers.Add(nu); } db.SaveChanges(); return(RedirectToAction("Index")); } return(View(notificationCategory)); }
internal static AndroidNotificationCategory FromCrossPlatformCategory(NotificationCategory category) { if (category == null) { return(null); } var androidCat = new AndroidNotificationCategory(); androidCat.id = category.id; androidCat.groupId = category.groupId; androidCat.name = category.name; androidCat.description = category.description; androidCat.importance = (int)category.importance; androidCat.enableBadge = category.enableBadge; androidCat.lights = (int)category.lights; androidCat.lightColor = category.lightColor.ToARGBHex(); androidCat.vibration = (int)category.vibration; androidCat.vibrationPattern = category.vibrationPattern; androidCat.lockScreenVisibility = (int)category.lockScreenVisibility; androidCat.sound = (int)category.sound; androidCat.soundName = System.IO.Path.GetFileNameWithoutExtension(category.soundName); // Android doesn't need file extension var actionList = new List <AndroidActionButton>(); if (category.actionButtons != null) { for (int i = 0; i < category.actionButtons.Length; i++) { actionList.Add(new AndroidActionButton() { id = category.actionButtons[i].id, title = category.actionButtons[i].title }); } } androidCat.actionButtons = actionList.ToArray(); return(androidCat); }
/// <summary> /// Adds the label. /// </summary> /// <param name="height">The height.</param> /// <param name="cat">The cat.</param> private void AddLabel(int height, NotificationCategory cat) { Label tempLabel = null; try { tempLabel = new Label(); tempLabel.AutoSize = false; tempLabel.Text = cat.GetHeader(); tempLabel.TextAlign = ContentAlignment.MiddleLeft; tempLabel.Location = new Point(labelNotification.Location.X, height); tempLabel.Width = labelBehaviour.Location.X - 3; tempLabel.Height = RowHeight; Label label = tempLabel; tempLabel = null; Controls.Add(label); } finally { tempLabel?.Dispose(); } }
/// <summary> /// Constructor /// </summary> /// <param name="category"></param> /// <param name="sender"></param> public Notification(NotificationCategory category, Object sender) { m_category = category; m_sender = sender; }
public ReportMsFaildNotificationView(NotificationCategory category, List<KeyInfo> keys) { InitializeComponent(); VM = new ReportMsFailedNotificationViewModel(category, keys); this.DataContext = VM; }
/// <summary> /// Gets the key for the given sender and category. /// </summary> /// <param name="sender"></param> /// <param name="category"></param> /// <returns></returns> public static long GetKey(Object sender, NotificationCategory category) { long left = (long)category << 32; int right = sender?.GetHashCode() ?? 0; return left | unchecked((uint)right); }
public void UpdateNotificationCategory(NotificationCategory NotificationCategory) { context.Entry(NotificationCategory).State = System.Data.Entity.EntityState.Modified; }
/// <summary> /// Constructor /// </summary> /// <param name="category"></param> /// <param name="sender"></param> public NotificationEventArgs(Object sender, NotificationCategory category) { Sender = sender; Category = category; }
/// <summary> /// Constructor with a key identifying a sender/category pair. /// </summary> /// <param name="sender"></param> /// <param name="category"></param> public NotificationInvalidationEventArgs(Object sender, NotificationCategory category) { m_key = Notification.GetKey(sender, category); }
/// <summary> /// /// </summary> /// <param name="category"></param> /// <param name="message"></param> /// <param name="windowType"></param> /// <param name="callback"></param> /// <param name="windowParameters"></param> public Notification(NotificationCategory category, string message, Type windowType, Action callback, params object[] windowParameters) { Category = category; Message = message; WindowType = windowType; WindowParameters = windowParameters; Callback = callback; Timestamp = DateTime.Now; if (WindowType == null) ViewButtonVisibility = Visibility.Hidden; }
/// <summary> /// /// </summary> public void Pop(NotificationCategory category) { Notification old = notifications.FirstOrDefault(n => n.Category == category); if (old != null) notifications.Remove(old); }
/// <summary> /// Set error when internal web service dose not work /// </summary> /// <param name="e"></param> private bool IsUnknownError(NotificationCategory notificationCategory, string errorTitle, NotificationEventArgs e) { if (internalDiagnosticResult.DiagnosticResultType == DiagnosticResultType.Error) { SetSystemState(notificationCategory, new DiagnosticResult() { Exception = null, DiagnosticResultType = DiagnosticResultType.Error }, errorTitle, e); return true; } else { return false; } }
private void PopSystemErrorOnUnCheckSystemStatus() { Dispatch(() => { ObservableCollection<Notification> notifications = notificationWindow.VM.Notifications; NotificationCategory[] systemNotifications = new NotificationCategory[] { NotificationCategory.SystemError_DatePolling, NotificationCategory.SystemError_DownLevelSystem, NotificationCategory.SystemError_Internal, NotificationCategory.SystemError_MSConnection, NotificationCategory.SystemError_UpLevelSystem, NotificationCategory.SystemError_Unknow, NotificationCategory.SystemError_DataBaseError, NotificationCategory.SystemError_KeyProviderServiceError, }; var removed = notifications.Where(n => systemNotifications.Contains(n.Category)).ToList(); foreach (var systemError in removed) { notifications.Remove(systemError); } }); }
/// <summary> /// create system state notification /// </summary> /// <param name="diagnosticResult"></param> /// <param name="errorTitle"></param> /// <param name="e"></param> private void SetSystemState(NotificationCategory notificationCategory, DiagnosticResult diagnosticResult, string errorTitle, NotificationEventArgs e) { try { NotificationCategory category = notificationCategory; string errorMessage = null; Dispatch(() => { if ((category != NotificationCategory.SystemError_KeyProviderServiceError && category != NotificationCategory.SystemError_DatePolling) || diagnosticResult.Exception == null) errorMessage = diagnosticResult.Exception == null ? ResourcesOfR6.Notification_UnknowMessage : diagnosticResult.Exception.ToString(); if (diagnosticResult.DiagnosticResultType == DiagnosticResultType.Error) e.Push(new Notification(category, errorTitle, string.IsNullOrEmpty(errorMessage) ? null : typeof(SystemStateNotificationView), null, errorTitle, errorMessage)); else e.Pop(category); }); } catch (Exception ex) { MessageLogger.LogSystemError(MessageLogger.GetMethodName(), ex.GetTraceText()); } }
/// <summary> /// Constructor with a key identifying a sender/category pair. /// </summary> /// <param name="sender"></param> /// <param name="category"></param> public NotificationInvalidationEventArgs(Object sender, NotificationCategory category) { Key = NotificationEventArgs.GetKey(sender, category); }
/// <summary> /// Gets the key for the given sender and category. /// </summary> /// <param name="sender"></param> /// <param name="category"></param> /// <returns></returns> public static long GetKey(Object sender, NotificationCategory category) { var left = ((long)category) << 32; var right = (sender == null ? 0 : sender.GetHashCode()); return left | unchecked((uint)right); }