protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); activityContext = this; // Log.Debug(TAG, "google app id: " + Resource.String.google_app_id); SetContentView(Resource.Layout.Main); receiver = new MySampleBroadcastReceiver(activityContext); //msgText = FindViewById<TextView>(Resource.Id.msgText); // preferenceHandler = new Utils.PreferenceHandler(); SetDrawer(); CreateDashboard(); //SetDrawer(); if (Intent.Extras != null) { foreach (var key in Intent.Extras.KeySet()) { //int value = Intent.Extras.GetInt(key); //Log.Debug(TAG, "Key: {0} Value: {1}", key, value); if (key.Equals(KEY_USER_ROLE)) { userRole = Intent.Extras.GetInt(key); } } } layoutProgress = FindViewById <LinearLayout>(Resource.Id.layout_progress); layoutProgress.Visibility = ViewStates.Gone; IsPlayServicesAvailable(); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.AdminDashboard); CurrentConsumption = ConsumptionFor.Premises; receiver = new MySampleBroadcastReceiver(this); if (!Utils.Utils.IsNetworkEnabled(this)) { RunOnUiThread(() => { Utils.Utils.ShowDialog(this, "Internet not available."); }); StartActivity(new Intent(Application.Context, typeof(LoginActivity))); Finish(); } else { if (PreferenceHandler.GetToken() == string.Empty) { await Utils.Utils.GetToken(); } CreateDashboard(); IsPlayServicesAvailable(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; startScan = FindViewById <Button>(Resource.Id.button1); startScan.Click += StartScan_Click; stopScan = FindViewById <Button>(Resource.Id.button2); stopScan.Click += StopScan_Click; edittext = FindViewById <EditText>(Resource.Id.edittext); edittext.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { Toast.MakeText(this, edittext.Text, ToastLength.Short).Show(); e.Handled = true; } else if (e.Event.Action == KeyEventActions.Up && e.KeyCode == Keycode.Enter) { edittext.Text = ""; e.Handled = true; } }; mRadioGroup = FindViewById <RadioGroup>(Resource.Id.mode_output); mRadioGroup.CheckedChange += delegate(object sender, RadioGroup.CheckedChangeEventArgs e) { switch (e.CheckedId) { case Resource.Id.intent_output: idmode[0] = 0; mScanManager.SetPropertyInts(idmodebuf, idmode); //scanResult.setVisibility(View.GONE); break; case Resource.Id.keyboard_output: idmode[0] = 1; idmode[1] = 2; mScanManager.SetPropertyInts(idmodebuf, idmode); //scanResult.setVisibility(View.VISIBLE); //scanResult.requestFocus(); break; } }; mScanManager = new ScanManager(); mScanManager.GetPropertyInts(idmodebuf, idmode); receiver = new MySampleBroadcastReceiver(); }