예제 #1
0
        protected async Task <Intent> Present(Intent intent)
        {
            _temporaryFilePath = Path.Combine(_context.LocalStorage, "temp_from_camera");

            intent.PutExtra(MediaStore.ExtraOutput, CreateTempFile());

            BaseScreen.ActivityResult result = await Activity.StartActivityForResultAsync(intent);

            if (result.Result == Result.Ok)
            {
                return(result.Data);
            }
            return(null);
        }
예제 #2
0
        public async Task <bool> SendReport(IReport report)
        {
            var email = new Intent(Intent.ActionSend);

            email.PutExtra(Intent.ExtraSubject, EmailTitle);
            email.PutExtra(Intent.ExtraText, report.Body);
            email.PutExtra(Intent.ExtraEmail, new[] { _settings.DevelopersEmail });

            IOContext.Current.CreateDirectory(BitBrowserApp.Temp);

            string path = Path.Combine(BitBrowserApp.Temp, "info.xml");

            using (var stream = new FileStream(path, FileMode.OpenOrCreate
                                               , FileAccess.ReadWrite, FileShare.None))
                using (var writer = new StreamWriter(stream))
                    writer.Write(report.Attachment);

            email.PutExtra(Intent.ExtraStream, Uri.Parse("file://" + path));
            email.SetType("plain/text");

            BaseScreen.ActivityResult result = await _activity.StartActivityForResultAsync(email);

            return(result.Result == Result.Ok);
        }