Exemple #1
0
        public void SendByEmail()
        {
            var email = new Intent(Android.Content.Intent.ActionSend);

            email.PutExtra(Android.Content.Intent.ExtraCc, "Testando 123");

            if (entrega.Image != null || entrega.ds_ImageUri != null)
            {
                imagefile = new Java.IO.File(entrega.ds_ImageUri);

                if (!imagefile.Exists())
                {
                    ByteHelper helper = new ByteHelper();
                    bitmap = helper.ByteArrayToImage(entrega.Image);

                    var stream = new FileStream(imagefile.AbsolutePath, FileMode.Create);
                    bitmap.Compress(Bitmap.CompressFormat.Png, 30, stream);
                    stream.Close();

                    Intent          mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
                    Android.Net.Uri uri             = Android.Net.Uri.FromFile(imagefile);
                    mediaScanIntent.SetData(uri);
                    SendBroadcast(mediaScanIntent);
                }
                else
                if (imagefile.Exists())
                {
                    ByteHelper helper = new ByteHelper();
                    bitmap = helper.ByteArrayToImage(entrega.Image);

                    var stream = new FileStream(imagefile.AbsolutePath, FileMode.Create);
                    bitmap.Compress(Bitmap.CompressFormat.Jpeg, 50, stream);
                    stream.Close();
                }

                Android.Net.Uri contentUri = JavaUri.FromFile(imagefile);
                email.PutExtra(Intent.ExtraStream, contentUri);
            }

            DefinirOcorrencia();
            email.PutExtra(Intent.ExtraSubject, "NFE: " + entrega.ds_NFE + "; Ocorrência: " + entrega.id_ocorrencia.ToString() + "; Data: " + DateTime.Parse(entrega.dt_entrega.ToString()));
            email.PutExtra(Intent.ExtraText, "NFe: " + entrega.ds_NFE +
                           "\nOcorrência: " + descricaoocorrencia +
                           "\nData de Inclusão: " + entrega.dt_inclusao +
                           "\nData de Entrega: " + entrega.dt_entrega +
                           "\nObservação: " + entrega.ds_observacao +
                           "\nGeoposicionamento: " + entrega.ds_geolocalizacao);
            email.SetType("application/image");
            Intent.CreateChooser(email, "Enviar Email Via");

            try
            {
                StartActivityForResult(email, 0);
            }
            catch (Exception e)
            {
                Toast.MakeText(this, "Email não enviado devido à um erro:" + e.Message, ToastLength.Long).Show();
            }
        }
Exemple #2
0
        private void BindViews()
        {
            if (entrega == null)
            {
                return;
            }

            txtCodigoNF.Text    = entrega.ds_NFE;
            spinOcorrencia      = entrega.id_ocorrencia.ToString();
            txtDataEntrega.Text = entrega.dt_entrega.Value.ToString("dd/MM/yyyy");
            txtHoraEntrega.Text = entrega.dt_entrega.Value.ToString("HH:mm");
            txtObservacao.Text  = entrega.ds_observacao.ToString();

            Substring_Helper sub = new Substring_Helper();

            lblCNPJ.Text     = "CNPJ Emissor: " + sub.Substring_CNPJ(entrega.ds_NFE);
            lblNumeroNF.Text = "Número NF: " + sub.Substring_NumeroNF(entrega.ds_NFE) + "/" + sub.Substring_SerieNota(entrega.ds_NFE);

            if (entrega.Image != null)
            {
                ByteHelper helper = new ByteHelper();
                bitmap = helper.ByteArrayToImage(entrega.Image);
                imageView.SetImageBitmap(bitmap);
            }

            if (entrega.fl_status == 0)
            {
                txtStatus.Text = "Não Sincronizado";
            }

            if (entrega.fl_status == 1)
            {
                txtStatus.Text = "Sincronizado";
            }

            if (entrega.ds_geolocalizacao == null || entrega.ds_geolocalizacao == "")
            {
                txtGeolocalizacao.Visibility = ViewStates.Gone;
                lblGeolocalizacao.Visibility = ViewStates.Gone;
            }
            else if (entrega.ds_geolocalizacao != null || entrega.ds_geolocalizacao != "")
            {
                lblGeolocalizacao.Visibility = ViewStates.Visible;
                txtGeolocalizacao.Visibility = ViewStates.Visible;
                txtGeolocalizacao.Text       = entrega.ds_geolocalizacao.ToString();
            }

            checkBoxGeolocalizacao.Visibility = ViewStates.Gone;
            lblStatus.Visibility = ViewStates.Visible;
            txtStatus.Visibility = ViewStates.Visible;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            Activity.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;

            var view = inflater.Inflate(Resource.Layout.Fragment_ImageView, container, false);

            this.Dialog.SetCanceledOnTouchOutside(false);
            imgView = view.FindViewById <ImageView>(Resource.Id.img);

            PhotoViewAttacher photoView = new PhotoViewAttacher(imgView);

            photoView.Update();

            byte[] imgPassed = Arguments.GetByteArray("imagem");

            ByteHelper helper = new ByteHelper();

            imgPassedBitmap = helper.ByteArrayToImage(imgPassed);
            imgView.SetImageBitmap(imgPassedBitmap);
            return(view);
        }