//Add offline sync item //Types: Read, Unread, Star, Unstar public static async Task AddOfflineSync(string AddId, string AddType) { try { //Add sync item TableOffline SyncItem = new TableOffline(); if (AddType == "Star") { SyncItem.item_star_status = AddId; } else if (AddType == "Unstar") { SyncItem.item_unstar_status = AddId; } else if (AddType == "Read") { SyncItem.item_read_status = AddId; } else if (AddType == "Unread") { SyncItem.item_unread_status = AddId; } await SQLConnection.InsertAsync(SyncItem); //Delete opposite await DeleteOppositeOfflineSync(AddId, AddType); } catch { } }
//Add offline sync items //Types: Read, Unread, Star, Unstar public static async Task AddOfflineSync(List <String> AddIds, String AddType) { try { //Wait for busy database await ApiUpdate.WaitForBusyDatabase(); //Sync variables List <TableOffline> AddSyncItems = new List <TableOffline>(); foreach (String AddId in AddIds) { //Add sync item TableOffline SyncItem = new TableOffline(); if (AddType == "Star") { SyncItem.item_star_status = AddId; } else if (AddType == "Unstar") { SyncItem.item_unstar_status = AddId; } else if (AddType == "Read") { SyncItem.item_read_status = AddId; } else if (AddType == "Unread") { SyncItem.item_unread_status = AddId; } AddSyncItems.Add(SyncItem); //Delete opposite await DeleteOppositeOfflineSync(AddId, AddType); } await SQLConnection.InsertAllAsync(AddSyncItems); } catch { } }