Esempio n. 1
0
        // call the filehelper module to get the user's files
        private async Task GetFiles()
        {
            var files = await _fileHelper.GetFilesAsync();

            foreach (DriveItem d in files.Children.CurrentPage)
            {
                if (d.File != null)
                {
                    var fileItem = new App.FileItem
                    {
                        name   = d.Name,
                        webUrl = d.WebUrl
                    };
                    fileItems.Add(fileItem);
                }
            }
        }
Esempio n. 2
0
        // on click call the mailhelper module to send mail
        private async void MailButton_Click(object sender, RoutedEventArgs e)
        {
            App.FileItem    selectedFile    = fileItems[FileCombo.SelectedIndex];
            App.ContactItem selectedContact = contactItems[ContactCombo.SelectedIndex];
            ProgressBar.Visibility = Visibility.Visible;
            MailStatus.Text        = string.Empty;
            try
            {
                await _mailHelper.ComposeAndSendMailAsync(ResourceLoader.GetForCurrentView().GetString("MailSubject"), ComposePersonalizedMail(selectedContact.name, selectedFile.webUrl), selectedContact.address);

                MailStatus.Visibility = Visibility.Visible;
                MailStatus.Text       = string.Format(ResourceLoader.GetForCurrentView().GetString("SendMailSuccess"), selectedContact.name);
            }
            catch (Exception)
            {
                MailStatus.Visibility = Visibility.Visible;
                MailStatus.Text       = ResourceLoader.GetForCurrentView().GetString("MailErrorMessage");
            }
            finally
            {
                ProgressBar.Visibility = Visibility.Collapsed;
            }
        }