protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); MenuViewModel = MenuViewModel.Instance; MusicPlayer = new MusicPlayer(this); SetContentView(Resource.Layout.activity_menu); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); InitViews(); if (MenuViewModel.currentImage.ImagePath == null) { StartActivityForResult(new Intent(this, typeof(CameraActivity)), REQUEST_CODE_CAMERA); } else { MenuViewModel.image = BitmapFactory.DecodeFile(MenuViewModel.currentImage.ImagePath); ShowInformation(); MenuViewModel.DeleteImage(); } }
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_CAMERA && resultCode == Result.Ok) { if (MenuViewModel.currentImage.ImagePath == null) { StartActivityForResult(new Intent(this, typeof(CameraActivity)), REQUEST_CODE_CAMERA); } else { MenuViewModel.image = BitmapFactory.DecodeFile(MenuViewModel.currentImage.ImagePath); ShowInformation(); MenuViewModel.DeleteImage(); } } else if (requestCode == REQUEST_CODE_CAMERA && resultCode == Result.Canceled) { ShowInformation(true); } }