Example #1
0
        /// <summary>
        /// Syncs all tables.
        /// </summary>
        /// <returns>The all async.</returns>
        /// <param name="syncUserSpecific">If set to <c>true</c> sync user specific.</param>
        public async Task <bool> SyncAllAsync(bool syncUserSpecific)
        {
            if (!IsInitialized)
            {
                await InitializeAsync();
            }

            var taskList = new List <Task <bool> >();

            taskList.Add(LockerStore.SyncAsync());
            taskList.Add(CategoryStore.SyncAsync());
            taskList.Add(EventStore.SyncAsync());
            taskList.Add(UserStore.SyncAsync());
            taskList.Add(NotificationStore.SyncAsync());
            taskList.Add(WineStore.SyncAsync());
            taskList.Add(NewsStore.SyncAsync());
            taskList.Add(WineVarietalStore.SyncAsync());

            if (syncUserSpecific)
            {
                taskList.Add(FeedbackStore.SyncAsync());
                taskList.Add(FavoriteStore.SyncAsync());
            }

            var successes = await Task.WhenAll(taskList);

            return(successes.Any(x => !x));//if any were a failure.
        }
Example #2
0
        /// <summary>
        /// Drops all tables from the database and updated DB Id
        /// </summary>
        /// <returns>The everything async.</returns>
        public Task DropEverythingAsync()
        {
            Settings.UpdateDatabaseId();
            CategoryStore.DropTable();
            EventStore.DropTable();
            MiniHacksStore.DropTable();
            NotificationStore.DropTable();
            LockerStore.DropTable();
            WineStore.DropTable();
            UserStore.DropTable();
            NewsStore.DropTable();
            FeedbackStore.DropTable();
            FavoriteStore.DropTable();
            WineVarietalStore.DropTable();

            IsInitialized = false;
            return(Task.FromResult(true));
        }