using CommunicationSampleApp.Classes;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CommunicationSampleApp
{
    /// <summary>
    /// Interaction logic for DownloadAttachmentPopup.xaml
    /// </summary>
    public partial class DownloadAttachmentPopup : Window
    {
        public DownloadAttachmentPopup()
        {
            InitializeComponent();
        }
        private void downloadAttachmentBtn_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.FileName = MessagingServiceManager.SelectedAttachment.Name;
            if (saveFileDialog.ShowDialog() == true)
            {
                MessagingServiceManager.GetInstance().DownloadAttachment(saveFileDialog.FileName, MessagingServiceManager.SelectedAttachment);
            }
            this.Close();
        }

        private void cancelDownloadAttachmentBtn_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
