Ejemplo n.º 1
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (resultCode == Result.Canceled)
            {
                _file.Delete();
            }
            else
            {
                Intent          mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
                Android.Net.Uri contentUri      = Android.Net.Uri.FromFile(_file);
                mediaScanIntent.SetData(contentUri);
                SendBroadcast(mediaScanIntent);

                GC.Collect();


                var cars = _carRepository.GetAllCar();
                var wins = cars.Select(x => x.WIN).ToArray();

                _winDialog = new WinSelectDialog(this, "Dodaj zdjęcie", _activeCar?.WIN);
                _winDialog.SetDissmisEvent(new OnDismissListener(() =>
                {
                    _file.Delete();
                }));
                _winDialog.Build(wins, OkAction);
                _winDialog.Show();
            }
        }
Ejemplo n.º 2
0
        public override bool OnContextItemSelected(IMenuItem item)
        {
            var menuItemIndex = item.ItemId;

            if (menuItemIndex == 0) //Edytuj
            {
                _editDialog = new WinSelectDialog(this, "Edytuj zdjęcie", _activeCar.WIN, _selectetImage.Note);
                _editDialog.SetButtonTitle("Edytuj");
                _editDialog.Build(_carRepository.GetAllCar().Select(x => x.WIN).ToArray(), OnEdit);
                _editDialog.Show();
            }

            else if (menuItemIndex == 1) // usun
            {
                var directoryName = Path.GetDirectoryName(_selectetImage.PhotoName);
                File.Delete(_selectetImage.PhotoName);

                var deleteCar = _carRepository.DeleteImageFromCar(_selectetImage);
                if (deleteCar && directoryName != null)
                {
                    Directory.Delete(directoryName);
                }

                Toast.MakeText(this, "Usunięto", ToastLength.Short).Show();
                CreateViewForSingleCar(_activeCar.WIN);
            }
            else if (menuItemIndex == 2)//wyslij
            {
            }
            return(true);
        }
Ejemplo n.º 3
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (id == Resource.Id.nav_camera)
            {
                AddFromCamera();
            }
            else if (id == Resource.Id.nav_gallery)
            {
                _searchDialog = new WinSelectDialog(this, "Szukaj");
                _searchDialog.SetButtonTitle("Szukaj");
                _searchDialog.Build(_carRepository.GetAllCar().Select(x => x.WIN).ToArray(), SearchAction, false);
                _searchDialog.Show();
            }
            else if (id == Resource.Id.nav_slideshow)
            {
            }
            else if (id == Resource.Id.nav_manage)
            {
            }
            else if (id == Resource.Id.nav_share)
            {
            }
            else if (id == Resource.Id.nav_send)
            {
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Ejemplo n.º 4
0
        private async Task AddFormGalery()
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsPickPhotoSupported)
            {
                Toast.MakeText(this, "Brak uprawnień", ToastLength.Short).Show();
                return;
            }
            var file = await CrossMedia.Current.PickPhotoAsync();

            _file = new Java.IO.File(file.Path);
            _addFromGaleryDialog = new WinSelectDialog(this, "Dodaj z galeri", _activeCar?.WIN);
            _addFromGaleryDialog.SetButtonTitle("Dodaj");
            _addFromGaleryDialog.Build(_carRepository.GetAllCar().Select(x => x.WIN).ToArray(), AddFromGaleryOkAction);
            _addFromGaleryDialog.Show();
        }