Пример #1
0
        /// <summary>
        /// Create, initialize and return an instance of EventCachePortable.
        /// </summary>
        /// <returns></returns>
        static async Task <EventCachePortable> CreateInstanceAsync()
        {
            var cache = new EventCachePortable();

            await cache.InitializeAsync();

            return(cache);
        }
Пример #2
0
        /// <summary>
        /// Create, initialize and return an instance of EventCachePortable.
        /// </summary>
        /// <returns></returns>
        public static async Task<EventCachePortable> NewAsync()
        {
            var instance = new EventCachePortable();

            var keenFolder = await getKeenFolder()
                .ConfigureAwait(continueOnCapturedContext: false);
            var files = (await keenFolder.GetFilesAsync().ConfigureAwait(continueOnCapturedContext: false)).ToList();

            lock(events)
                if (events.Any())
                    foreach (var f in files)
                        events.Enqueue(f.Name);

            return instance;
        }
Пример #3
0
        /// <summary>
        /// Create, initialize and return an instance of EventCachePortable.
        /// </summary>
        /// <returns></returns>
        public static async Task <EventCachePortable> NewAsync()
        {
            var instance = new EventCachePortable();

            var keenFolder = await getKeenFolder()
                             .ConfigureAwait(continueOnCapturedContext: false);

            var files = (await keenFolder.GetFilesAsync().ConfigureAwait(continueOnCapturedContext: false)).ToList();

            lock (events)
                if (events.Any())
                {
                    foreach (var f in files)
                    {
                        events.Enqueue(f.Name);
                    }
                }

            return(instance);
        }