static async Task Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Initialize needed classes. dataProvider = InitializeDataprovider(); notificationService = InitializeNotification(); notificationConstants = new NotificationConstants(); tasksManager = InitializeTasksManager(dataProvider, notificationService, notificationConstants); // get all tasks. ITaskGroup tasks = tasksManager.GetAllTasks(); //Get current date and save if its new day. dayFollower = InitializeDayFollower(dataProvider); await dayFollower.SetNewDay(); //! Change var timer = new System.Threading.Timer( async e => await dayFollower.SetNewDay(), null, TimeSpan.Zero, TimeSpan.FromMinutes(30)); // start the check list view. Application.Run(new CheckListApp(tasksManager, tasks)); }
public TasksManager(IDataSourceConfiguration dataSourceConfiguration, IDataProviderBase dataProvider, INotificationType messageService, NotificationConstants notificationConstants) { this.dataSourceConfiguration = dataSourceConfiguration; this.dataProvider = dataProvider; this.notificationService = messageService; this.notificationConstants = notificationConstants; }
static TasksManager InitializeTasksManager(IDataProviderBase dataProvider, INotificationType messageService, NotificationConstants notificationConstants) { string folderName = ConfigurationManager.AppSettings.Get("FileFolder"); string fileName = ConfigurationManager.AppSettings.Get("TasksFileName"); //string fileName = ConfigurationManager.AppSettings.Get("DayCoveredFileName"); return(new TasksManager( new DataSourceConfiguration(new DataSourceFileConfiguration($"{folderName}\\{fileName}")), dataProvider, messageService, notificationConstants )); }
public static bool NotificationEnabled( this IUser user, IUserNotificationTypeDefaults userNotificationTypeDefaults, INotificationType notificationType) { foreach (var userNotificationType in userNotificationTypeDefaults.GetUserNotificationTypesWithDefaults(user)) { if (userNotificationType.Name.Equals(notificationType.Name, StringComparison.OrdinalIgnoreCase)) { return(userNotificationType.Enabled); } } return(false); }
public NotificationType(INotificationType notificationType) { Type = notificationType.Type.TypeInfo.Type; Member = notificationType.ObjectIndexMember.MemberInfo; }
/// <summary> /// Sends the notification on a background thread /// </summary> /// <param name="message"></param> /// <returns></returns> public System.Threading.Tasks.Task NotifyAsync <T>(INotificationType <T> message) { return(System.Threading.Tasks.Task.Factory.StartNew(() => { SendInternal(message); }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Current)); }
public void EnqueueNotification <T>(INotificationType <T> message) => SendInternal(message, true);
public void Notify <T>(INotificationType <T> message) => SendInternal(message);
public Notification(INotificationType type) { this.Type = type; }
public void Notify(INotificationType message) => SendInternal(message);