Current filter:
                                You should refresh the page.
                                  • Here is what we want to do in our xaf app (Win module).

                                    1. User launches app
                                    2. System checks if certain orders require approval (check BO if any hits exist)
                                    3. If step 2 finds hits, notify the user
                                    4. Repeat the above every x minutes

                                    When notifying the user, we want to either show an icon in the lower right corner (like your notification module) or flash/highlight a Navigation Item.

                                    I reviewed your Notification module and it seems more geared towards datetime items. In our example, date/time has no impact.

                                    I don't doubt we could do a standard Windows timer every x minutes in our app. I'm wondering what might be the best approach and whether any built-in tool from DevExpress allows me to create this more easily.

                                    Thanks for your input.

                                    Steve

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Steve,

                                The Notifications Module is suitable to achieve this functionality. You can register your custom notification provider as described in the Notifications Service and Notifications Providers article. In its NotificationTypesInfo property, return an empty HashSet collection of the ITypeInfo objects. In the GetActiveNotificationsCount method, make a call to your database and return a value greater than 0 if you need to highlight the bell in the status bar. Otherwise, return a value less than 0. In the GetNotificationItems method, return an empty list of the INotificationItem objects. You don't need to implement other methods if you don't use our Scheduler module or don't have classes that implement the ISupportNotifications interface.

                                The Notifications Module will automatically ask your providers about notification at startup with a delay specified by the NotificationsStartDelay property and periodically at intervals specified by the NotificationsRefreshInterval property.

                                [C#]
                                using DevExpress.ExpressApp; using DevExpress.ExpressApp.DC; using DevExpress.ExpressApp.Notifications; using DevExpress.Persistent.Base.General; using System; using System.Collections.Generic; namespace MySolution.Module.Win.Controllers { public class MyWindowController : WindowController { public MyWindowController() { TargetWindowType = WindowType.Main; } protected override void OnActivated() { base.OnActivated(); NotificationsModule notificationsModule = Application.Modules.FindModule<NotificationsModule>(); notificationsModule.NotificationsService.RegisterNotificationsProvider(new MyNotificationProvider(Application)); } } public class MyNotificationProvider : INotificationsProvider { XafApplication xafApplication; HashSet<ITypeInfo> eventsTypes; public MyNotificationProvider(XafApplication xafApplication) { this.xafApplication = xafApplication; eventsTypes = new HashSet<ITypeInfo>(); } public IList<INotificationItem> GetNotificationItems() { return new List<INotificationItem>(); } public int GetActiveNotificationsCount() { return 1; } public int GetPostponedNotificationsCount() { throw new NotImplementedException(); } public void Dismiss(IEnumerable<INotificationItem> notificationItems) { throw new NotImplementedException(); } public void Postpone(IEnumerable<INotificationItem> notificationItems, TimeSpan postponeTime) { throw new NotImplementedException(); } public HashSet<ITypeInfo> NotificationTypesInfo => eventsTypes; } }
                                • Steve Finner 08.25.2019

                                  I was able to convert your sample code to VB and produce the expected notification bell in the status bar.

                                  N‍ow I'm trying to produce a ListView when the user clicks the bell. I know I need to work with the INotifcationItem but I can't seem to find an example that I can understand given my scenario? How do I present a ListView that I can control the content based on my calls to my database?

                                  T‍hanks,

                                  S‍teve

                                • Gosha (DevExpress Support) 08.26.2019

                                  Hi Steve,

                                  In this case, return a list with at least one INotificationItem object in the INotificationsProvider.GetNotificationItems method. You can create your own class that implements the INotificationItem interface and create its instance. For example:

                                  [C#]
                                  public class MyNotificationItem : INotificationItem { public ISupportNotifications NotificationSource => new MySupportNotifications(); } public class MySupportNotifications : ISupportNotifications { public DateTime? AlarmTime { get => null; set => throw new NotImplementedException(); } public object UniqueId => throw new NotImplementedException(); public string NotificationMessage => "Test"; public bool IsPostponed { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } }
                                  [C#]
                                  public IList<INotificationItem> GetNotificationItems() { return new List<INotificationItem>() { new MyNotificationItem() }; }

                                  Then, cancel showing the default reminder window in the NotificationsController.CustomProcessNotifications event and show your own List View.

                                  [C#]
                                  private void Controller_CustomProcessNotifications(object sender, NotificationItemsEventArgs e) { e.Handled = true; View view = Application.CreateListView(typeof(MyClass), false); Application.ShowViewStrategy.ShowViewInPopupWindow(view); ((NotificationsController)sender).RefreshNotifications(); }
                                • Gosha (DevExpress Support) 09.03.2019

                                  Hi Steve,

                                  You have an interesting scenario, and other users would benefit from this information as well as from the suggested solution.
                                  Would you mind making this ticket Public for the benefits of the XAF community? Thank you for your consideration.

                                • Steve Finner 09.05.2019

                                  Making this ticket Public is fine with me. Not sure if I can change this or you guys need to do it?

                                  Thanks,

                                  Steve

                                • Gosha (DevExpress Support) 09.05.2019

                                  Thank you for your cooperation, Steve. I made this ticket public.