Automobile.Mobile.Android.Config.ConfigActivity.OnCreate C# (CSharp) Method

OnCreate() protected method

protected OnCreate ( Bundle bundle ) : void
bundle Bundle
return void
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            var prefs = GetSharedPreferences("AutomationConfig", FileCreationMode.WorldWriteable);
            var startAutomation = FindViewById<Button>(Resource.Id.StartAutomation);
            var registrarButton = FindViewById<RadioButton>(Resource.Id.registrarButton);
            var dbButton = FindViewById<RadioButton>(Resource.Id.dbButton);
            var directButton = FindViewById<RadioButton>(Resource.Id.directButton);
            var connStringText = FindViewById<TextView>(Resource.Id.ConnectionStringTextView);
            var connTypeKey = GetString(Resource.String.ConnectionType);
            var connStringKey = GetString(Resource.String.ConnectionString);

            if (!prefs.Contains(connTypeKey))
            {
                prefs.Edit().PutInt(connTypeKey, (int)ConnectionType.Direct).Commit();
            }

            registrarButton.Click += (sender, args) =>
                              {
                                  var view =
                                      FindViewById<LinearLayout>(Resource.Id.ServerLayout).Visibility =
                                      ViewStates.Visible;
                                  prefs.Edit().PutInt(connTypeKey, (int) ConnectionType.Registrar).
                                      PutString(connStringKey, connStringText.Text).Commit();
                              };
            dbButton.Click += (sender, args) =>
                              {
                                  var view =
                                      FindViewById<LinearLayout>(Resource.Id.ServerLayout).Visibility =
                                      ViewStates.Visible;
                                  prefs.Edit().PutInt(connTypeKey, (int)ConnectionType.DbRegistration)
                                                .PutString(connStringKey, connStringText.Text).Commit();
                              };
            directButton.Click += (sender, args) =>
                               {
                                   var view =
                                       FindViewById<LinearLayout>(Resource.Id.ServerLayout).Visibility =
                                       ViewStates.Gone;
                                   prefs.Edit().PutInt(connTypeKey, (int)ConnectionType.Direct).
                                       Commit();
                               };
            startAutomation.Click += (sender, args) =>
                                     {
                                        prefs.Edit().PutString(connStringKey, connStringText.Text).Commit();
                                        StartActivity(typeof (AutomationActivity));
                                     };
        }
ConfigActivity