Beispiel #1
0
        protected override void OnResume()
        {
            base.OnResume();

            Task startupWork = new Task(() =>
            {
                Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
                Thread.Sleep(2000);
                //Task.Delay(5000); // Simulate a bit of startup work.
                Log.Debug(TAG, "Working in the background - important stuff.");
            });

            startupWork.ContinueWith(t =>
            {
                Log.Debug(TAG, "Work is finished - start Activity1.");
                var userSettings = new AndroidUserSettings();
                if (string.IsNullOrEmpty(userSettings.GetUserSetting("language")))
                {
                    StartActivity(new Intent(Application.Context, typeof(LanguageInitializer)));
                }
                else
                {
                    StartActivity(new Intent(Application.Context, typeof(MainActivity)));
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());

            startupWork.Start();
        }
        public void SetLanguageSettings(string language)
        {
            var userSettings = new AndroidUserSettings();
            userSettings.SetUserSetting("language", language);

            language = language.Substring(0, 1).ToUpper() + language.Substring(1);
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle("Lanuage selection");
            builder.SetMessage("Your default language is " + language + ". You may change it at any time in the settings.");
            builder.SetCancelable(false);
            builder.SetPositiveButton("OK", delegate { StartActivity(new Intent(Application.Context, typeof(MainActivity))); });
            builder.Show();
        }
Beispiel #3
0
        public void SetLanguageSettings(string language)
        {
            var userSettings = new AndroidUserSettings();

            userSettings.SetUserSetting("language", language);

            language = language.Substring(0, 1).ToUpper() + language.Substring(1);
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle("Lanuage selection");
            builder.SetMessage("Your default language is " + language + ". You may change it at any time in the settings.");
            builder.SetCancelable(false);
            builder.SetPositiveButton("OK", delegate { StartActivity(new Intent(Application.Context, typeof(MainActivity))); });
            builder.Show();
        }