Ejemplo n.º 1
0
        /// <summary>
        /// method for insert files
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuInsert_Click(object sender, RoutedEventArgs e)
        {
            ListViewItem item = (ListViewItem)this.LVInfo.SelectedItem;

            if (item != null)
            {
                try
                {
                    DirectoryInfo dir = (DirectoryInfo)item.Tag;
                    this.copyContent.In = dir.Parent;
                }
                catch (Exception ex)
                {
                    FileInfo file = (FileInfo)item.Tag;
                    this.copyContent.In = file.Directory;
                }
            }
            else
            {
                this.copyContent.In = this.saveRott;
            }
            var answer = MessageBox.Show("Are you sure you want to copy this content?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (answer == MessageBoxResult.Yes)
            {
                WInProgressBar pb = new WInProgressBar();
                MediatorProgressBar.ActCopy(this.copyContent);
                MediatorProgressBar.Root(this.saveRott);
                pb.Show();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// method for delete files
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuDelete_Click(object sender, RoutedEventArgs e)
        {
            if (this.LVInfo.SelectedIndex == -1)
            {
                return;
            }
            List <DirectoryInfo> content = new List <DirectoryInfo>();

            foreach (ListViewItem item in this.LVInfo.SelectedItems)
            {
                try
                {
                    DirectoryInfo dir = (DirectoryInfo)item.Tag;
                    content.Add(dir);
                }
                catch (Exception ex)
                {
                    FileInfo file = (FileInfo)item.Tag;
                    content.Add(new DirectoryInfo(file.FullName));
                }
            }
            MessageBoxResult answer = new MessageBoxResult();

            answer = MessageBox.Show("Are you sure you want to delete this content?", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Question);
            if (answer == MessageBoxResult.Yes)
            {
                WInProgressBar pb = new WInProgressBar();
                MediatorProgressBar.Items(content, true);
                MediatorProgressBar.Root(this.saveRott);
                this.element.DeletePath(content);
                pb.ShowDialog();
                this.view[this.indexView](this.saveRott, null);
            }
        }