Exemple #1
0
        public async Task <Attachment> AskForAttachment(string selectedOption)
        {
            string fileName = $"Attachment-{DateTime.Now.ToString("yyyyMMddHHmmss")}.jpg";

            string[]   options = { "Camera", "Gallery" };
            Attachment att     = null;

            if (selectedOption == options[0])
            {
                att = await SPUtility.TakePhotoAsync();

                if (att != null)
                {
                    Attachments.Add(att);
                }
            }
            else if (selectedOption == options[1])
            {
                att = await SPUtility.PicPhotoAsync();

                if (att != null)
                {
                    Attachments.Add(att);
                }
            }

            BindAttachments();

            return(att);
        }