Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 public TasksManager(IDataSourceConfiguration dataSourceConfiguration, IDataProviderBase dataProvider, INotificationType messageService, NotificationConstants notificationConstants)
 {
     this.dataSourceConfiguration = dataSourceConfiguration;
     this.dataProvider            = dataProvider;
     this.notificationService     = messageService;
     this.notificationConstants   = notificationConstants;
 }
Ejemplo n.º 3
0
        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
                       ));
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public NotificationType(INotificationType notificationType)
 {
     Type   = notificationType.Type.TypeInfo.Type;
     Member = notificationType.ObjectIndexMember.MemberInfo;
 }
Ejemplo n.º 6
0
 /// <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));
 }
Ejemplo n.º 7
0
 public void EnqueueNotification <T>(INotificationType <T> message) => SendInternal(message, true);
Ejemplo n.º 8
0
 public void Notify <T>(INotificationType <T> message) => SendInternal(message);
Ejemplo n.º 9
0
 public Notification(INotificationType type)
 {
     this.Type = type;
 }
Ejemplo n.º 10
0
 public void Notify(INotificationType message) => SendInternal(message);