using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
using System.Collections;
using System.Windows.Controls;

namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing
{
    /// <summary>
    /// Interaction logic for HomePageCompressDialog
    /// </summary>
    public partial class HomePageCompressDialog : UserControl
    {
        public HomePageCompressDialog()
        {
            InitializeComponent();
        }
        private void Menu_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            menuPop1.IsOpen = true;
        }

        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IList list = listView.SelectedItems;
            var lists = listView.Items;
            System.Data.DataRowView a;
            ((HomePageCompressDialogViewModel)this.DataContext).fileNamesView.Clear();
            foreach (var item in list)
            {
                a = (System.Data.DataRowView)item;
                ((HomePageCompressDialogViewModel)this.DataContext).fileNamesView.Add(lists.IndexOf(a));
            }
            if (((HomePageCompressDialogViewModel)this.DataContext).fileNamesView.Count > 0)
            {
                ((HomePageCompressDialogViewModel)this.DataContext).RemoveIsEnable = "True";
            }
            else
            {
                ((HomePageCompressDialogViewModel)this.DataContext).RemoveIsEnable = "False";
            }

        }

        private void RemoveFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ((HomePageCompressDialogViewModel)this.DataContext).removepdffile();
        }

        private void OpenFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ((HomePageCompressDialogViewModel)this.DataContext).openfiledialog();
        }

    }
}
