Exemplo n.º 1
0
        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();
        }
Exemplo n.º 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");
        }
Exemplo n.º 6
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("BuyoutPriceMult", BuyoutPriceMult);
     Configuration.Put("TraderItemListIDs", TraderItemListIDs);
     Configuration.Save();
 }
Exemplo n.º 7
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("StarPrice", StarPrice);
     Configuration.Put("TreasureBagsShop", TS);
     Configuration.Save(true);
 }
Exemplo n.º 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");
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
                }
            });
        }
Exemplo n.º 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();
 }
Exemplo n.º 15
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("Disable Mod Accesory Prefixes", disableModAccesoryPrefixes);
     Configuration.Put("Classic fortress sprites", classicFortress);
     Configuration.Save();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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);
        }
Exemplo n.º 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)));
                }
            }
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 24
0
 private void SignOut_Clicked(object sender, EventArgs e)
 {
     Preferences.Clear();
     Device.BeginInvokeOnMainThread(() => {
         Navigation.PopModalAsync();
         Navigation.PushModalAsync(new MainPage(), false);
     });
 }
Exemplo n.º 25
0
 static void CreateConfig()
 {
     Configuration.Clear();
     Configuration.Put("showDayCounter", showDayCounter);
     Configuration.Put("showFishCatchLocation", showFishCatchLocation);
     Configuration.Put("messageColor", messageColor);
     Configuration.Save();
 }
Exemplo n.º 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)}");
        }
Exemplo n.º 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;
 }
Exemplo n.º 30
0
 public IntroPage()
 {
     InitializeComponent();
     dataBaseUtil       = new DataBaseUtil();
     App.IsUserLoggedIn = false;
     Preferences.Clear();
     ResetDataRegis();
 }