void InitSettingDialog(View rootView) { var chineseRadio = rootView.FindViewById <AppCompatRadioButton>(Resource.Id.radioChinese); var englishRadio = rootView.FindViewById <AppCompatRadioButton>(Resource.Id.radioEnglish); string CurrentLang = PreferenceUtils.readString(this.ParentActivity, PreferenceUtils.LANG); if (string.Equals(CurrentLang, @"EN")) { englishRadio.Checked = true; } else { chineseRadio.Checked = true; } chineseRadio.Click += ChineseRadio_Click; englishRadio.Click += EnglishRadio_Click; }
void CheckToken() { var token = PreferenceUtils.readString(this, PreferenceUtils.TOKEN); if (!string.IsNullOrEmpty(token)) { if (CrossConnectivity.Current.IsConnected) { var model = new GetContactRequest() { TOKEN = token }; ViewModel.LoginWithTokenCommand.Execute(model); } else { DialogUtils.ShowOKDialog(this, @"Warning", @"No Internet Connection"); } } }
public void ChangeLanguage() { this.MyApplication.InitLangResource(!string.Equals(PreferenceUtils.readString(this.BaseContext, PreferenceUtils.LANG), @"CH") ? @"EN" : @"CH"); leftNav.Menu.GetItem(0).SetChecked(true); Recreate(); }
void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == nameof(LoginViewModel.IsBusy)) { if (ViewModel.IsBusy) { this.RunOnUiThread(() => { ShowLoadingDialog(@"Log in"); }); } else { this.RunOnUiThread(() => { HideLoadingDialog(); }); if (ViewModel.LoginResultModel == null) { RunOnUiThread(() => { DialogUtils.ShowOKDialog(this, @"Warning", @"Invalid authentication"); }); return; } else { if (ViewModel.LoginResultModel.RESULT) { this.MyApplication.Me = ViewModel.GetUserFromLoginResult(); if (EngineService.EngineInstance == null) { var startEngine = new Intent(this, typeof(EngineService)); StartService(startEngine); } PreferenceUtils.saveString(this, PreferenceUtils.LANG, MyApplication.Me.LANG == 1?"CH":"EN"); PreferenceUtils.saveString(this, PreferenceUtils.TOKEN, MyApplication.Me.TOKEN); MyApplication.InitLangResource(MyApplication.Me.LANG == 1 ? "CH" : "EN"); GotoMainScreen(); } else { if (string.Equals(ViewModel.LoginResultModel.MSG, GlobalConstants.RESPONSE_NO_USER_ERROR)) { DialogUtils.ShowOKDialog(this, @"Warning", @"Invalid authentication"); return; } else if (string.Equals(ViewModel.LoginResultModel.MSG, GlobalConstants.RESPONSE_BLOCK_ACCOUNT)) { DialogUtils.ShowOKDialog(this, @"Warning", @"Account is not available."); return; } else if (string.Equals(ViewModel.LoginResultModel.MSG, GlobalConstants.RESPONSE_INVALID_IMEI)) { DialogUtils.ShowOKDialog(this, @"Warning", @"You can't use this account on this device."); return; } else { return; } } } } } }
private void FlowerRadio_Click(object sender, EventArgs e) { PreferenceUtils.saveBool(this.ParentActivity, PreferenceUtils.WALLPAPER, false); mBottomSheetDialog.Dismiss(); }