Пример #1
0
        public async void ShowInternalOptions()
        {
            string strAbout          = "About";
            string strTestMessage    = "Send yourself a message";
            string strWebserviceInfo = "Webservice info";
            string strTest1          = "Test";
            string strUnregister     = "Unregister";

            string strInput = await NavPage.DisplayActionSheet("Byb - Internal", "Cancel", null, strAbout, strWebserviceInfo, strTestMessage, strUnregister, strTest1);

            if (strInput == strAbout)
            {
                InfoPage page = new InfoPage();
                await NavPage.Navigation.PushModalAsync(page);
            }

            if (strInput == strWebserviceInfo)
            {
                string text = "";
                text += "Last exception url: ";
                if (App.WebService.LastExceptionUrl != null)
                {
                    text += App.WebService.LastExceptionUrl;
                }
                else
                {
                    text += "none";
                }

                text += "\r\n\r\nLast exception: ";
                if (App.WebService.LastException == null)
                {
                    text += "null";
                }
                else
                {
                    text += TraceHelper.ExceptionToString(App.WebService.LastException);
                }

                InfoPage page = new InfoPage();
                page.Text = text;
                await NavPage.Navigation.PushModalAsync(page);
            }

            if (strInput == strTestMessage)
            {
                string msg = string.Format("Message from '{0}' : {1}", "Miguel", "Some message!!!");
                App.MobileNotificationsService.AddLocalNotification("Byb", msg, 0);
                return;
            }

            if (strInput == strUnregister)
            {
                string fileName = System.IO.Path.Combine(App.Files.GetWritableFolder(), Config.DatabaseFileName);
                App.Files.DeleteFile(fileName);
                await NavPage.DisplayAlert("Byb", "The local database deleted. Pease force-close the app now.", "Done");

                return;
            }

            if (strInput == strTest1 && Config.IsProduction == false)
            {
                OpenNewsfeedItemPage(1098);
                return;
            }

            //var athlete = App.Repository.GetMyAthlete();
            //					athlete.Country = "";
            //					athlete.MetroID = 0;
            //					App.Repository.UpdateAthlete(athlete);
            //					App.Navigator.DisplayAlertRegular("Set athlete's metro no empty. Try Edit Profile now.");
        }