//Lang private void LangPref_OnPreferenceChange(object sender, Preference.PreferenceChangeEventArgs eventArgs) { try { if (eventArgs.Handled) { var etp = (ListPreference)sender; var value = eventArgs.NewValue; Settings.Lang = value.ToString(); WowTime_Main_Settings.SetApplicationLang(Activity, Settings.Lang); Toast.MakeText(ActivityContext, GetText(Resource.String.Lbl_Application_Restart), ToastLength.Long).Show(); var intent = new Intent(Activity, typeof(SpalshScreen_Activity)); intent.AddCategory(Intent.CategoryHome); intent.SetAction(Intent.ActionMain); intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask); Activity.StartActivity(intent); Activity.FinishAffinity(); Settings.Lang = value.ToString(); } } catch (Exception e) { Crashes.TrackError(e); } }
public override void OnCreate() { try { base.OnCreate(); //A great place to initialize Xamarin.Insights and Dependency Services! RegisterActivityLifecycleCallbacks(this); instance = this; Settings st = new Settings(); Client.WebsiteUrl = st.WebsiteUrl; Current.CurrentInstance.ServerKey = st.ServerKey; Current.CurrentInstance.SetWebsiteURL(st.WebsiteUrl, st.ServerKey); //Bypass Web Errors //====================================== if (Settings.TurnSecurityProtocolType3072On) { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; var client = new HttpClient(new AndroidClientHandler()); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; } if (Settings.TurnTrustFailureOn_WebException) { //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; var b = new AesCryptoServiceProvider(); } //OneSignal Notification //====================================== OneSignalNotification.RegisterNotificationDevice(); // Check Created My Folder Or Not //====================================== IMethods.IPath.Chack_MyFolder(); //====================================== //Init Settings WowTime_Main_Settings.Init(); //Change the Lang WowTime_Main_Settings.SetApplicationLang(this, Settings.Lang); //====================================== //App restarted after crash //====================================== AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser; } catch (Exception exception) { Crashes.TrackError(exception); } }