/// <summary> /// Adds the notification list page. /// </summary> /// <param name="title">Title.</param> /// <param name="icon">Icon.</param> /// <param name="filtered">Filtered.</param> /// <param name="priority">Priority.</param> public void AddNotificationListPage(string title, string icon, IEnumerable <Notification> filtered, Notification.NotificationPriority priority) { NotificationListPage page = new NotificationListPage(title, icon, filtered, priority); Device.BeginInvokeOnMainThread(() => { Children.Add(page); }); }
/// <summary> /// Filters the by priority. /// </summary> /// <returns>The by priority.</returns> /// <param name="results">Results.</param> /// <param name="priority">Priority.</param> public static IEnumerable <Notification> FilterByPriority(IEnumerable <Notification> results, Notification.NotificationPriority priority) { return(from element in results where element.Priority == priority orderby element.DaysAgo select element); }
/// <summary> /// Initializes a new instance of the <see cref="PhoenixImperator.Pages.Entities.NotificationListPage"/> class. /// </summary> /// <param name="title">Title.</param> /// <param name="icon">Icon.</param> /// <param name="notifications">Notifications.</param> /// <param name="priority">Priority.</param> public NotificationListPage(string title, string icon, IEnumerable <Notification> notifications, Notification.NotificationPriority priority) : base(title, Phoenix.Application.NotificationManager, NotificationTabbedPage.FilterByPriority(notifications, priority), true, true, false) { Icon = icon; Priority = priority; }
/// <summary> /// Alls for position. /// </summary> /// <param name="positionId">Position identifier.</param> /// <param name="callback">Callback.</param> /// <param name="priority">Priority</param> public async void AllForPosition(int positionId, Action <List <Notification> > callback, Notification.NotificationPriority priority = Notification.NotificationPriority.All) { Log.WriteLine(Log.Layer.BL, this.GetType(), "All Notifications For Position " + positionId); List <Notification> results = await GetNotificationDataManager().GetNotificationsForPosition(positionId); callback(results); }
/// <summary> /// Gets the notifications for position. /// </summary> /// <returns>The notifications for position.</returns> /// <param name="positionId">Position identifier.</param> /// <param name="priority">Priority</param> /// <param name="progressCallback">Progress callback.</param> /// <param name="sort">If set to <c>true</c> sort.</param> public Task <List <Notification> > GetNotificationsForPosition(int positionId, Notification.NotificationPriority priority = Notification.NotificationPriority.All, IProgress <int> progressCallback = null, bool sort = false) { return(Task <List <Notification> > .Factory.StartNew(() => { List <Notification> models = null; if (priority == Notification.NotificationPriority.All) { models = DL.PhoenixDatabase.GetNotificationsForPosition(positionId); } else { models = DL.PhoenixDatabase.GetNotificationsForPosition(positionId, priority); } Log.WriteLine(Log.Layer.DAL, this.GetType(), "Get Notifications for Position " + positionId + ": " + models.Count); return models; })); }
/// <summary> /// Gets the notifications for position. /// </summary> /// <returns>The notifications for position.</returns> /// <param name="positionId">Position identifier.</param> /// <param name="priority">Priority.</param> public static List <Notification> GetNotificationsForPosition(int positionId, Notification.NotificationPriority priority) { return(Query <Notification> ("select n.* from Notification n where n.PositionId = ? and n.Priority = ? order by DaysAgo asc", positionId, priority)); }