public static void SaveConfig()
        {
            Type type = typeof(Config);

            configuration.Clear();
            foreach (FieldInfo field in type.GetFields())
            {
                var attribute = field.GetCustomAttribute <CUEConfigAttribute>();

                var tmp = field.GetValue(null);
                configuration.Put(attribute.Name, tmp);
            }
            configuration.Save();
        }
        public async Task LogoutAsync()
        {
            MobileServiceClient client = AppService.Instance.Client;

            if (client.CurrentUser == null || client.CurrentUser.MobileServiceAuthenticationToken == null)
            {
                return;
            }

            CookieManager.Instance.RemoveAllCookie();

            // Log out of the identity provider (if required)

            // Invalidate the token on the mobile backend
            var authUri = new Uri($"{client.MobileAppUri}/.auth/logout");

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Add("X-ZUMO-AUTH", client.CurrentUser.MobileServiceAuthenticationToken);
                await httpClient.GetAsync(authUri);
            }

            RemoveTokenFromSecureStore();

            //clear user information
            Preferences.Clear();

            // Remove the token from the MobileServiceClient
            await client.LogoutAsync();
        }
Example #3
0
        protected override async void OnStart()
        {
            if (Preferences.ContainsKey("Saved_Login"))
            {
                Response re = await backend.LogIn(Preferences.Get("Saved_User", ""), Preferences.Get("Saved_Pass", "No"));

                if (re.status == statuscode.OK)
                {
                    MainPage = new TimetablePage();
                }
                else if (re.status == statuscode.NOT_THESE_DROIDS)
                {
                    Preferences.Clear();
                    Device.BeginInvokeOnMainThread(async() => {
                        await MainPage.DisplayAlert("Saved login fail", "We coulden't log you in with your saved credentials", "OK");
                        MainPage = new LoginPage();
                    });
                }
                else
                {
                    MainPage = new LoginPage();
                }
            }
            else
            {
                MainPage = new LoginPage();
            }
            // Handle when your app starts
        }
        private async void BtnSubmitSeats_Clicked(object sender, EventArgs e)
        {
            DateTime date        = DateTime.UtcNow;
            var      accessToken = Preferences.Get("accessToken", string.Empty);
            var      capacityId  = Preferences.Get("capacityId", string.Empty);

            var reservation = new Reservation
            {
                CapacityId  = capacityId,
                Name        = EntName.Text,
                PhoneNo     = EntPhoneNumber.Text,
                Email       = EntEmail.Text,
                SeatsBooked = Int32.Parse(EntSeatsBooked.Text),
                Comments    = EntComments.Text,
                AddedBy     = "User",
                AddedDate   = date,
                UpdatedDate = date
            };
            await ApiService.PostReservationAsync(reservation, accessToken);

            await DisplayAlert("Success!", "Seats reserved successfully", "OK");

            await Navigation.PopModalAsync();

            Preferences.Clear();
        }
        private async Task ExecuteFinalizarCommandAsync()
        {
            await Shell.Current.Navigation.PopModalAsync();

            Preferences.Clear();
            await Shell.Current.GoToAsync("HomePage");
        }
Example #6
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("BuyoutPriceMult", BuyoutPriceMult);
     Configuration.Put("TraderItemListIDs", TraderItemListIDs);
     Configuration.Save();
 }
Example #7
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("StarPrice", StarPrice);
     Configuration.Put("TreasureBagsShop", TS);
     Configuration.Save(true);
 }
Example #8
0
        public profiloPalestra()
        {
            InitializeComponent();
            _auth = DependencyService.Get <IFirebaseAuthenticator>();

            pictureFullScreen();

            getInfo(uid);

            picker.SelectedIndexChanged += async(sender, args) =>
            {
                if (picker.SelectedIndex == -1)
                {
                }
                else
                {
                    string colorName = picker.Items[picker.SelectedIndex];
                    picker.SelectedItem = -1;
                    if (colorName.Equals("Modifica Profilo"))
                    {
                        await Navigation.PushAsync(new home.palestra.Page1());
                    }
                    else
                    {
                        _auth.Logout();
                        Preferences.Clear("profilePic");
                        Navigation.InsertPageBefore(new Main(), Navigation.NavigationStack[0]);
                        await Navigation.PopToRootAsync();
                    }
                }
            };
        }
        async void OnRegisterButtonClicked(object sender, EventArgs e)
        {
            var user = new User()
            {
                Password = Password.Text,
                Email    = Email.Text
            };

            Preferences.Clear();
            Preferences.Set("password", Password.Text);
            Preferences.Set("email", Email.Text);
            // Sign up logic goes here

            var signUpSucceeded = AreDetailsValid(user);

            if (signUpSucceeded)
            {
                var rootPage = Navigation.NavigationStack.FirstOrDefault();
                if (rootPage != null)
                {
                    App.IsUserLoggedIn = true;

                    Navigation.InsertPageBefore(new LoginPage(), Navigation.NavigationStack.First());
                    await Navigation.PopToRootAsync();
                }
            }
            else
            {
                await DisplayAlert("Alert", "SignUp Failed", "OK");
            }
        }
Example #10
0
        private void Clear_Clicked(object sender, EventArgs a)
        {
            // Remove items from Xamarin Essentials
            try
            {
                Preferences.Clear();
                SecureStorage.Remove("pwd");
            }
            catch (Exception ex)
            {
                Msg.Text = ex.Message.ToString();
            }

            /*
             * Clear screen.  If you leave without SAVE
             * fields will be popluated by defaults.
             * Password will be empty
             */
            Initials.Text = "";
            Tos.Text      = "";
            From.Text     = "";
            Ccopy.Text    = "";
            Host.Text     = "";
            Pwd.Text      = "";
            Port.Text     = "";
            TLS.IsToggled = true;
        }
Example #11
0
        public async Task <bool> CheckLogin()
        {
            try
            {
                var username = Preferences.Get(AuthorizeConstants.UserKey, string.Empty);
                var password = Preferences.Get(AuthorizeConstants.PasswordKey, string.Empty);

                var response = await JongSnamServices.LoginWithHttpMessagesAsync(username, password);

                var userModel = await GetRespondDtoHandlerHttpStatus <UserModel>(response);

                if (userModel == null)
                {
                    return(false);
                }
                else
                {
                    Preferences.Clear();

                    // save access token
                    Preferences.Set(AuthorizeConstants.UserIdKey, userModel.Id.ToString());
                    Preferences.Set(AuthorizeConstants.UserKey, userModel.Email);
                    Preferences.Set(AuthorizeConstants.PasswordKey, userModel.Password);
                    Preferences.Set(AuthorizeConstants.UserTypeKey, userModel.UserType);
                    Preferences.Set(AuthorizeConstants.IsLoggedInKey, userModel.IsLoggedIn.ToString());
                    await Task.Delay(MillisecondsDelay);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        static void CreateConfig()
        {
            Configuration.Clear();
            Configuration.Put("GlobalEnemySpawnRateMultiplier", GlobalEnemySpawnRateMultiplier);
            Configuration.Put("GlobalEnemySpawnCapMultiplier", GlobalEnemySpawnCapMultiplier);
            Configuration.Put("GlobalEnemyHealthMultiplier", GlobalEnemyHealthMultiplier);
            Configuration.Put("GlobalEnemyDamageMultiplier", GlobalEnemyDamageMultiplier);
            Configuration.Put("GlobalProjectileDamageMultiplier", GlobalProjectileDamageMultiplier);
            Configuration.Put("GlobalEnemyDefenseMultiplier", GlobalEnemyDefenseMultiplier);
            Configuration.Put("GlobalEnemyKnockbackMultiplier", GlobalEnemyKnockbackMultiplier);
            //Configuration.Put("GlobalNonBossKnockbackMultiplier", GlobalNonBossKnockbackMultiplier);
            //Configuration.Put("GlobalEnemyScaleMultiplier", GlobalEnemyScaleMultiplier);
            Configuration.Put("GlobalEnemyMoneyMultiplier", GlobalEnemyMoneyMultiplier);
            //Configuration.Put("GlobalEnemyMoveSpeedMultiplier", GlobalEnemyMoveSpeedMultiplier);
            Configuration.Put("GlobalArmorDefenseMultiplier", GlobalArmorDefenseMultiplier);
            Configuration.Put("GlobalItemDamageMultiplier", GlobalItemDamageMultiplier);
            Configuration.Put("GlobalItemManaUsageMultiplier", GlobalItemManaUsageMultiplier);
            Configuration.Put("GlobalPlayerHealthMultiplier", GlobalPlayerHealthMultiplier);
            Configuration.Put("GlobalPlayerHealthRegenMultiplier", GlobalPlayerHealthRegenMultiplier);
            Configuration.Put("GlobalPlayerManaMultiplier", GlobalPlayerManaMultiplier);
            Configuration.Put("GlobalPlayerDefenseMultiplier", GlobalPlayerDefenseMultiplier);
            Configuration.Put("GlobalPlayerCritChanceMultiplier", GlobalPlayerCritChanceMultiplier);

            Configuration.Put("GlobalBossHealthMultiplier", GlobalBossHealthMultiplier);
            Configuration.Put("GlobalBossDamageMultiplier", GlobalBossDamageMultiplier);
            Configuration.Put("GlobalBossDefenseMultiplier", GlobalBossDefenseMultiplier);
            Configuration.Put("GlobalBossKnockbackMultiplier", GlobalBossKnockbackMultiplier);
            Configuration.Put("GlobalBossMoneyMultiplier", GlobalBossMoneyMultiplier);
            Configuration.Put("GlobalBossScaleMultiplier", GlobalBossScaleMultiplier);

            Configuration.Put("HardmodeGlobalEnemyHealthMultiplier", HardmodeGlobalEnemyHealthMultiplier);
            Configuration.Put("HardmodeGlobalEnemyDamageMultiplier", HardmodeGlobalEnemyDamageMultiplier);
            Configuration.Put("HardmodeGlobalProjectileDamageMultiplier", HardmodeGlobalProjectileDamageMultiplier);
            Configuration.Put("HardmodeGlobalEnemyDefenseMultiplier", HardmodeGlobalEnemyDefenseMultiplier);
            Configuration.Put("HardmodeGlobalEnemyKnockbackMultiplier", HardmodeGlobalEnemyKnockbackMultiplier);
            //Configuration.Put("HardmodeGlobalNonBossKnockbackMultiplier", HardmodeGlobalNonBossKnockbackMultiplier);
            Configuration.Put("HardmodeGlobalEnemyMoneyMultiplier", HardmodeGlobalEnemyMoneyMultiplier);

            Configuration.Put("HardmodeGlobalBossHealthMultiplier", HardmodeGlobalBossHealthMultiplier);
            Configuration.Put("HardmodeGlobalBossDamageMultiplier", HardmodeGlobalBossDamageMultiplier);
            Configuration.Put("HardmodeGlobalBossDefenseMultiplier", HardmodeGlobalBossDefenseMultiplier);
            Configuration.Put("HardmodeGlobalBossKnockbackMultiplier", HardmodeGlobalBossKnockbackMultiplier);
            Configuration.Put("HardmodeGlobalBossMoneyMultiplier", HardmodeGlobalBossMoneyMultiplier);

            Configuration.Put("PostMoonLordGlobalEnemyHealthMultiplier", PostMoonLordGlobalEnemyHealthMultiplier);
            Configuration.Put("PostMoonLordGlobalEnemyDamageMultiplier", PostMoonLordGlobalEnemyDamageMultiplier);
            Configuration.Put("PostMoonLordGlobalProjectileDamageMultiplier", PostMoonLordGlobalProjectileDamageMultiplier);
            Configuration.Put("PostMoonLordGlobalEnemyDefenseMultiplier", PostMoonLordGlobalEnemyDefenseMultiplier);
            Configuration.Put("PostMoonLordGlobalEnemyKnockbackMultiplier", PostMoonLordGlobalEnemyKnockbackMultiplier);
            //Configuration.Put("PostMoonLordGlobalNonBossKnockbackMultiplier", PostMoonLordGlobalNonBossKnockbackMultiplier);
            Configuration.Put("PostMoonLordGlobalEnemyMoneyMultiplier", PostMoonLordGlobalEnemyMoneyMultiplier);

            Configuration.Put("PostMoonLordGlobalBossHealthMultiplier", PostMoonLordGlobalBossHealthMultiplier);
            Configuration.Put("PostMoonLordGlobalBossDamageMultiplier", PostMoonLordGlobalBossDamageMultiplier);
            Configuration.Put("PostMoonLordGlobalBossDefenseMultiplier", PostMoonLordGlobalBossDefenseMultiplier);
            Configuration.Put("PostMoonLordGlobalBossKnockbackMultiplier", PostMoonLordGlobalBossKnockbackMultiplier);
            Configuration.Put("PostMoonLordGlobalBossMoneyMultiplier", PostMoonLordGlobalBossMoneyMultiplier);

            Configuration.Save();
        }
        public MainModel()
        {
            MessagingCenter.Subscribe <MenuModel, MenuAction>(this, "MenuAction", (sender, action) =>
            {
                switch (action)
                {
                case MenuAction.LensPreview:

                    DetailChanging.Invoke(this, new LensPreviewPage());
                    break;

                case MenuAction.Logout:

                    if (!Device.WPF.Equals(Device.RuntimePlatform))
                    {
                        Preferences.Clear();
                    }

                    authenticatingMessageInspector.Bearer = string.Empty;

                    foreach (Cookie cookie in authenticatingMessageInspector.Cookies)
                    {
                        cookie.Expires = DateTime.Now.Subtract(TimeSpan.FromDays(1));
                    }

                    IsLogged = false;

                    break;
                }
            });
        }
Example #14
0
 public static void SaveConfig()
 {
     Configuration.Clear();
     Configuration.Put(AltStaffsKey, AltStaffs);
     Configuration.Put(MagicStonesKey, MagicStones);
     Configuration.Put(GodStoneKey, GodStone);
     Configuration.Put(DemonCrownKey, DemonCrown);
     Configuration.Put(HeartLocketKey, HeartLocket);
     Configuration.Put(MagnetsKey, Magnets);
     Configuration.Put(NinjaGearKey, NinjaGear);
     Configuration.Put(ReinforcedVestKey, ReinforcedVest);
     Configuration.Put(AncientForgesKey, AncientForges);
     Configuration.Put(RedBrickFurnitureKey, RedBrickFurniture);
     Configuration.Put(AncientMuramasaKey, AncientMuramasa);
     Configuration.Put(GasterBlasterKey, GasterBlaster);
     Configuration.Put(SpearofJusticeKey, SpearofJustice);
     Configuration.Put(WormholeMirrorKey, WormholeMirror);
     Configuration.Put(CellPhoneUpgradeKey, CellPhoneUpgrade);
     Configuration.Put(CellPhoneRespriteKey, CellPhoneResprite);
     Configuration.Put(RodofWarpingKey, RodofWarping);
     Configuration.Put(RodofWarpingChaosStateKey, RodofWarpingChaosState);
     Configuration.Put(EmblemofDeathKey, EmblemofDeath);
     Configuration.Put(BuildingMaterialsKey, BuildingMaterials);
     Configuration.Put(BaseballBatsKey, BaseballBats);
     Configuration.Put(AncientOrbKey, AncientOrb);
     Configuration.Put(ExtraDyesKey, ExtraDyes);
     Configuration.Put(AutofisherKey, Autofisher);
     Configuration.Put(MechanicsRodOftenKey, MechanicsRodOften);
     Configuration.Put(ChestVacuumKey, ChestVacuum);
     Configuration.Save();
 }
Example #15
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("Disable Mod Accesory Prefixes", disableModAccesoryPrefixes);
     Configuration.Put("Classic fortress sprites", classicFortress);
     Configuration.Save();
 }
Example #16
0
 private async Task ClearState()
 {
     Preferences.Clear(StateMachineSettingSharedName); // Cannot use PersistKeys.StateMachine.SharedName because it is internal.
     Preferences.Clear(DeviceSettingSharedName);       // Cannot use PersistKeys.Device.SharedName because it is internal.
     _displayAlert("State cleared. Restart the application");
     await LoadState();
 }
Example #17
0
        public async System.Threading.Tasks.Task <LogoutDTO> LogoutAsync()   //Servizio di Log Out
        {
            try
            {
                var data = new Dictionary <string, string>();
                {
                    data.Add("command-name", "logout");
                }
                var result = await Services.Concatenazione()
                             .WithCookie("auth-key", Services.GetAuthKey())
                             .WithCookie("token", token)
                             .PostUrlEncodedAsync(data)
                             .ReceiveJson <LogoutDTO>();


                if (result.success == true)
                {
                    Preferences.Clear();
                }
                return(result);
            }

            catch (FlurlHttpTimeoutException ex)
            {
                await App.Current.MainPage.DisplayAlert("Fondo Merende", "Connessione al server scaduta", "OK");
            }
            catch (FlurlHttpException ex)
            {
                await App.Current.MainPage.DisplayAlert("Fondo Merende", ex.InnerException.Message, "OK");
            }

            return(null);
        }
Example #18
0
        void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as SideMenuModel;

            if (item != null)
            {
                masterPage.listView.SelectedItem = null;
                IsPresented = false;

                if (item.TargetType == typeof(LogoutPage))
                {
                    Application.Current.MainPage = new NavigationPage(new LoginPage());
                    Preferences.Clear();
                }
                else if (item.TargetType == typeof(AccountIndexPage))
                {
                    //Detail =  new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
                    Navigation.PushAsync((Page)Activator.CreateInstance(item.TargetType));
                }
                else
                {
                    //Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
                    Navigation.PushModalAsync(new NavigationPage((Page)Activator.CreateInstance(item.TargetType)));
                }
            }
        }
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (id == Resource.Id.nav_my_cars)
            {
                //   showFragment(mMyCarsFragment);

                Intent live_try = new Intent(this, typeof(review));
                live_try.PutExtra("carId", "7029774");
                live_try.PutExtra("renter_id", "2");
                live_try.PutExtra("cost", "25.4₪");
                StartActivity(live_try);
            }
            if (id == Resource.Id.nav_home)
            {
                showFragment(mMainFragment);
            }
            else if (id == Resource.Id.nav_history)
            {
                showFragment(mHistoryFragment);
            }
            else if (id == Resource.Id.nav_logout)
            {
                Preferences.Clear();
                Intent login_try = new Intent(this, typeof(loginActivity));
                StartActivity(login_try);
                Finish();
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Example #20
0
 //Creates a config file. This will only be called if the config file doesn't exist yet or it's invalid.
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("ThrowingDamageBoomerang", ThrowingDamageBoomerang);
     Configuration.Put("ChangeToolDamageType", ChangeToolDamageType);
     Configuration.Save();
 }
Example #21
0
 //Creates a config file. This will only be called if the config file doesn't exist yet or it's invalid.
 static void CreateConfig()
 {
     _configuration.Clear();
     _configuration.Put("IsChargeToggled", isChargeToggled);
     _configuration.Put("IsSaiyanGradeNames", isSaiyanGradeNames);
     _configuration.Save();
 }
Example #22
0
 //Creates a config file. This will only be called if the config file doesn't exist yet or it's invalid.
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("PlanetoidMusic", PlanetoidMusic);
     Configuration.Put("WyrmMusic", WyrmMusic);
     Configuration.Save();
 }
Example #23
0
 private async void ResetAppOnClicked(object sender, EventArgs e)
 {
     if (await DisplayAlert(AppResources.Confirm, AppResources.ResetAppText, AppResources.Yes, AppResources.No))
     {
         Preferences.Clear();
         DependencyService.Get <IIntentService>()?.ExitApplication();
     }
 }
Example #24
0
 private void SignOut_Clicked(object sender, EventArgs e)
 {
     Preferences.Clear();
     Device.BeginInvokeOnMainThread(() => {
         Navigation.PopModalAsync();
         Navigation.PushModalAsync(new MainPage(), false);
     });
 }
Example #25
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("showDayCounter", showDayCounter);
     Configuration.Put("showFishCatchLocation", showFishCatchLocation);
     Configuration.Put("messageColor", messageColor);
     Configuration.Save();
 }
Example #26
0
 public static void SaveConfig()
 {
     Configuration.Clear();
     Configuration.Put("LuckyOreMine", LuckyOre);
     Configuration.Put("LuckyPotionGet", LuckyPotion);
     Configuration.Put("RareNpcList", ListRareNpc);
     Configuration.Save(true);
 }
        private async void LogginOut(object obj)
        {
            Xamarin.Essentials.SecureStorage.RemoveAll();
            Preferences.Clear();

            Application.Current.MainPage = new AccessShell();
            await Shell.Current.GoToAsync($"{nameof(LoginPage)}");
        }
Example #28
0
        async void SignoutButton_Clicked(object sender, System.EventArgs e)
        {
            Preferences.Clear();
            Auth.SignOut();


            await this.Navigation.PopToRootAsync();
        }
 private void ClearSettings()
 {
     Preferences.Clear();
     //SecureStorage.Remove("Password");
     //Email = string.Empty;
     //Password = string.Empty;
     //ConfirmPassword = string.Empty;
 }
Example #30
0
 public IntroPage()
 {
     InitializeComponent();
     dataBaseUtil       = new DataBaseUtil();
     App.IsUserLoggedIn = false;
     Preferences.Clear();
     ResetDataRegis();
 }