IsConnected() public static method

public static IsConnected ( ) : bool
return bool
Example #1
0
        public async void SaveUIElementStatesToCloud(string sceneAggregateId)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                var items = AppDatabase.Current.RetrieveUIElementStatesByScene(sceneAggregateId);
                foreach (var item in items)
                {
                    AzureMobileService.Current.PushToCloud(item);
                }

                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 SavePromoteToCloud(Promote promote)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

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

                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 #3
0
        public async void PushToCloud(AppWideSetting appWideSetting)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                if (appWideSetting != null && !String.IsNullOrEmpty(appWideSetting.Id))
                {
                    await mstAppWideSetting.UpdateAsync(appWideSetting);
                }
                else
                {
                    appWideSetting.Id   = string.Empty;
                    appWideSetting.MSId = string.Empty;
                    await mstAppWideSetting.InsertAsync(appWideSetting);
                }

                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 #4
0
        public async void DeleteFavouriteFromCloud(Favourite fav)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            await mstFavourite.DeleteAsync(fav);
        }
Example #5
0
        public async Task <List <Comment> > RetrieveCommentLessThanDateFromCloudAsync(DateTime dateStamp, int pageSize = 30)
        {
            if (!AppService.IsConnected())
            {
                return(null);
            }

            var result = await mstComment.Where(x => x.TimeStamp < dateStamp).OrderByDescending(x => x.TimeStamp).Take(pageSize).ToListAsync();

            return(result);
        }
Example #6
0
        public async Task <List <Promote> > RetrievePromotedGreaterThanDateFromCloudAsync(DateTime dateStamp, int pageSize = 30)
        {
            if (!AppService.IsConnected())
            {
                return(null);
            }

            var result = await mstPromote.Where(x => x.TimeStamp > dateStamp).OrderBy(x => x.TimeStamp).Take(pageSize).ToListAsync();

            return(result.OrderByDescending(x => x.TimeStamp).ToList());
        }
Example #7
0
        public async Task <List <Promote> > RetrievePromotedFromCloudAsync(int pageSize = 30)
        {
            if (!AppService.IsConnected())
            {
                return(null);
            }

            var result = await mstPromote.OrderByDescending(x => x.TimeStamp).Take(pageSize).ToListAsync();

            return(result);
        }
Example #8
0
        public async Task <List <AppWideSetting> > RetrieveAppWideSettingFromCloudAsync()
        {
            if (!AppService.IsConnected())
            {
                return(null);
            }

            var result = await mstAppWideSetting.ToListAsync();

            return(result);
        }
Example #9
0
        public async void PushToCloud(Promote promote)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                if (!string.IsNullOrEmpty(promote.MSId))
                {
                    string id = promote.Id;
                    promote.Id   = promote.MSId;
                    promote.MSId = id;
                    await mstPromote.UpdateAsync(promote);

                    promote.Id = id;
                }
                else
                {
                    promote.Id   = string.Empty;
                    promote.MSId = string.Empty;
                    await mstPromote.InsertAsync(promote);

                    //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"
                });
            }
        }
Example #10
0
        public async void PushToCloud(Scene scene)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                if (scene.MSId != 0)
                {
                    int id = scene.Id;
                    scene.Id   = scene.MSId;
                    scene.MSId = id;
                    await mstScene.UpdateAsync(scene);

                    scene.Id = id;
                }
                else
                {
                    scene.Id = 0;
                    await mstScene.InsertAsync(scene);

                    AppDatabase.Current.UpdateSceneField(scene.AggregateId, "MSId", scene.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"
                });
            }
        }
Example #11
0
        public async void PushToCloud(Comment comment)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                if (!string.IsNullOrEmpty(comment.MSId))
                {
                    string id = comment.Id;
                    comment.Id   = comment.MSId;
                    comment.MSId = id;
                    await mstComment.UpdateAsync(comment);

                    comment.Id = id;
                }
                else
                {
                    comment.Id   = string.Empty;
                    comment.MSId = string.Empty;
                    await mstComment.InsertAsync(comment);
                }

                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 #12
0
        public async void SaveFeedbackToCloud(Feedback fb)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                AzureMobileService.Current.PushToCloud(fb);

                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"
                });
            }
        }