Example #1
0
        public async void SaveFavouriteToCloud(Favourite fav)
        {
            if (!AppService.IsConnected()) return;

            try
            {
                //var items = AppDatabase.Current.RetrieveSolutionsByGrouping(sessionId);
                //foreach (var item in items)
                //{
                AzureMobileService.Current.PushToCloud(fav);
                //}

                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" });
            }
            catch
            {
                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" });
            }
        }
Example #2
0
        public async void DeleteFavouriteFromCloud(Favourite fav)
        {
            if (!AppService.IsConnected()) return;

            await mstFavourite.DeleteAsync(fav);
        }
Example #3
0
        public async void PushToCloud(Favourite favourite)
        {
            if (!AppService.IsConnected()) return;

            try
            {
                if ( !string.IsNullOrEmpty(favourite.MSId) )
                {
                    string id = favourite.Id;
                    favourite.Id = favourite.MSId;
                    favourite.MSId = id;
                    await mstFavourite.UpdateAsync(favourite);
                    favourite.Id = id;
                }
                else
                {
                    favourite.Id = string.Empty;
                    favourite.MSId = string.Empty;
                    await mstFavourite.InsertAsync(favourite);
                    //AppDatabase.Current.UpdateFavouriteField(favourite.AggregateId, "MSId", favourite.Id, false);
                }

                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" });
            }
            catch
            {
                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" });
            }
        }