Automobile.Mobile.Android.Automation.AutomationActivity.OnCreate C# (CSharp) Method

OnCreate() protected method

Executed when activity is started
protected OnCreate ( Bundle bundle ) : void
bundle Bundle Can be used to restore activity to a previous saved state
return void
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            _connTypeKey = GetString(Resource.String.ConnectionType);
            _connStringKey = GetString(Resource.String.ConnectionString);
            var prefs = GetSharedPreferences("AutomationConfig", FileCreationMode.WorldWriteable);

            // No connection type set, launch the config screen
            if(!prefs.Contains(_connTypeKey))
            {
                StartActivity(typeof (ConfigActivity));
                Finish();
                return;
            }

            // Init device
            _device = new AndroidDevice(this,
                (ConnectionType) prefs.GetInt(_connTypeKey, (int)ConnectionType.Direct),
                prefs.GetString(_connStringKey, ""));

            // Make an automation thread, so it doesn't block UI
            _autoThread = new Thread(_device.BeginAutomation);
        }