示例#1
0
        /* Useful Functions */
        private void RefreshTabs()
        {
            ListViewView leftList  = leftTabControl.SelectedContent as ListViewView;
            ListViewView rightList = rightTabControl.SelectedContent as ListViewView;

            TreeListView leftTreeList  = leftTabControl.SelectedContent as TreeListView;
            TreeListView rightTreeList = rightTabControl.SelectedContent as TreeListView;


            if (leftList != null)
            {
                leftList.PathManager.RefreshList();
            }
            if (rightList != null)
            {
                rightList.PathManager.RefreshList();
            }
            if (leftTreeList != null)
            {
                leftTreeList.LoadFromPath(leftTreeList.Driver);
            }
            if (rightTreeList != null)
            {
                rightTreeList.LoadFromPath(rightTreeList.Driver);
            }
            UpdatePathDisplays();
        }
示例#2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (ListViewView.TryFindResource("ListViewViewSource") is CollectionViewSource view)
     {
         view.Filter += new FilterEventHandler(View_Filter);
     }
 }
示例#3
0
        /* Useful functions */
        void UpdateDisplayMode()
        {
            if (FocusedTabControl == null)
            {
                return;
            }

            string path = "C:\\";

            if (FocusedTabControl == leftTabControl && leftPartition.SelectedItem != null)
            {
                path = leftPartition.SelectedItem.ToString();
            }
            else if (rightPartition.SelectedItem != null)
            {
                path = rightPartition.SelectedItem.ToString();
            }

            TabItem      currentTab = (TabItem)FocusedTabControl.SelectedItem;
            ListViewView listView   = currentTab.Content as ListViewView;
            TreeListView treeView   = currentTab.Content as TreeListView;

            if (listView != null && IsTree)
            {
                currentTab.Content = null;
                currentTab.Content = new TreeListView(path);
            }
            else if (treeView != null && !IsTree)
            {
                currentTab.Content = null;
                currentTab.Content = new ListViewView(path);
            }
        }
示例#4
0
        private void ChangeButtonDisplay()
        {
            ListViewView leftList  = leftTabControl.SelectedContent as ListViewView;
            ListViewView rightList = rightTabControl.SelectedContent as ListViewView;

            TreeListView leftTreeList  = leftTabControl.SelectedContent as TreeListView;
            TreeListView rightTreeList = rightTabControl.SelectedContent as TreeListView;


            if (leftList != null && leftList == FocusedTabControl.SelectedContent)
            {
                if (leftList.MainListView.SelectedItem != null &&
                    (leftList.MainListView.SelectedItem as ListItem).Ext != "")
                {
                    SetButtonDisplayOnFile();
                }
                else
                {
                    SetButtonDisplayOnDirectory();
                }
            }
            if (rightList != null && rightList == FocusedTabControl.SelectedContent)
            {
                if (rightList.MainListView.SelectedItem != null &&
                    (rightList.MainListView.SelectedItem as ListItem).Ext != "")
                {
                    SetButtonDisplayOnFile();
                }
                else
                {
                    SetButtonDisplayOnDirectory();
                }
            }
            if (leftTreeList != null && leftTreeList == FocusedTabControl.SelectedContent)
            {
                if (leftTreeList.FolderView.SelectedItem != null &&
                    (leftTreeList.FolderView.SelectedItem as TreeViewItem).Header.ToString().Contains("."))
                {
                    SetButtonDisplayOnFile();
                }
                else
                {
                    SetButtonDisplayOnDirectory();
                }
            }
            if (rightTreeList != null && rightTreeList == FocusedTabControl.SelectedContent)
            {
                if (rightTreeList.FolderView.SelectedItem != null &&
                    (rightTreeList.FolderView.SelectedItem as TreeViewItem).Header.ToString().Contains("."))
                {
                    SetButtonDisplayOnFile();
                }
                else
                {
                    SetButtonDisplayOnDirectory();
                }
            }
        }
示例#5
0
        private void Unpack_Click(object sender, RoutedEventArgs e)
        {
            if (FocusedTabControl != null)
            {
                ListViewView listView = FocusedTabControl.SelectedContent as ListViewView;

                if (listView != null)
                {
                    listView.UnpackArchive();
                }
                RefreshTabs();
            }
        }
示例#6
0
        private void Pack_Click(object sender, RoutedEventArgs e)
        {
            if (FocusedTabControl != null)
            {
                ListViewView listView = FocusedTabControl.SelectedContent as ListViewView;

                if (listView != null)
                {
                    NewArchiveWindow archiveWindow = new NewArchiveWindow(listView);
                    archiveWindow.ShowDialog();
                    RefreshTabs();
                }
            }
        }
示例#7
0
        private void NewFolderButton_Click(object sender, RoutedEventArgs e)
        {
            ListViewView listView     = FocusedTabControl.SelectedContent as ListViewView;
            TreeListView treeListView = FocusedTabControl.SelectedContent as TreeListView;

            if (listView != null)
            {
                listView.NewFolder();
            }
            else
            {
                //treeListView.NewFolder();
            }
        }
示例#8
0
        private void CopyButton_Click(object sender, RoutedEventArgs e)
        {
            ListViewView listView     = FocusedTabControl.SelectedContent as ListViewView;
            TreeListView treeListView = FocusedTabControl.SelectedContent as TreeListView;

            if (listView != null)
            {
                listView.Copy();
            }
            else
            {
                treeListView.Copy();
            }
            RefreshTabs();
        }
示例#9
0
        private void UpdatePathDisplays()
        {
            ListViewView leftList  = leftTabControl.SelectedContent as ListViewView;
            ListViewView rightList = rightTabControl.SelectedContent as ListViewView;
            TabItem      tabItem   = FocusedTabControl.SelectedItem as TabItem;

            if (leftList != null)
            {
                LeftPathDisplay.Text = leftList.PathManager.Path;
                tabItem.Header       = StringAfter(LeftPathDisplay.Text, @"\");
            }
            if (rightList != null)
            {
                RightPathDisplay.Text = rightList.PathManager.Path;
                tabItem.Header        = StringAfter(RightPathDisplay.Text, @"\");
            }
        }
示例#10
0
        private void CompareByContent_Click(object sender, RoutedEventArgs e)
        {
            ListViewView leftListView  = leftTabControl.SelectedContent as ListViewView;
            ListViewView rightListView = rightTabControl.SelectedContent as ListViewView;
            TreeListView leftTreeList  = leftTabControl.SelectedContent as TreeListView;
            TreeListView rightTreeList = rightTabControl.SelectedContent as TreeListView;

            string leftPath = null, rightPath = null;
            string file1 = null, file2 = null;


            if (leftListView != null &&
                leftListView.SelectedItems.Count == 1 &&
                leftListView.SelectedItems.ElementAt(0).Ext == ".txt")
            {
                leftPath = leftListView.SelectedItems.ElementAt(0).Name;
                file1    = System.IO.Path.Combine(leftListView.PathManager.Path, leftPath);
            }
            else if (leftTreeList != null &&
                     leftTreeList.SelectedItems.Count == 1 &&
                     leftTreeList.SelectedItems.ElementAt(0).Header.ToString().Contains("."))
            {
                leftPath = leftTreeList.SelectedItems.ElementAt(0).Name;
                file1    = System.IO.Path.Combine(leftTreeList.Path, leftPath);
            }

            if (rightListView != null &&
                rightListView.SelectedItems.ElementAt(0).Ext == ".txt" &&
                rightListView.SelectedItems.Count == 1)
            {
                rightPath = rightListView.SelectedItems.ElementAt(0).Name;
                file2     = System.IO.Path.Combine(rightListView.PathManager.Path, rightPath);
            }
            else if (rightTreeList != null &&
                     rightTreeList.SelectedItems.Count == 1 &&
                     rightTreeList.SelectedItems.ElementAt(0).Header.ToString().Contains("."))
            {
                rightPath = rightTreeList.SelectedItems.ElementAt(0).Name;
                file2     = System.IO.Path.Combine(rightTreeList.Path, rightPath);
            }

            CompareFilesWindow compareWindow = new CompareFilesWindow(file1, file2);

            compareWindow.ShowDialog();
        }
示例#11
0
        /* Buttons */
        private void ViewButton_Click(object sender, RoutedEventArgs e)
        {
            ListViewView listView     = FocusedTabControl.SelectedContent as ListViewView;
            TreeListView treeListView = FocusedTabControl.SelectedContent as TreeListView;

            if (listView != null)
            {
                var currentItem = (listView.MainListView.SelectedItem as ListItem);
                var path        = System.IO.Path.Combine(listView.PathManager.Path, currentItem.Name);
                MessageBox.Show(path + "\n" +
                                "Total space occupied:" + GetDirectorySize(path) + "bytes \n" +
                                currentItem.Date + "\n" +
                                currentItem.Size);
            }
            else if (treeListView != null)
            {
                MessageBox.Show(treeListView.Path + "\n" +
                                "Total space occupied:" + GetDirectorySize(treeListView.Path) + "bytes");
            }
        }
 public NewArchiveWindow(ListViewView window)
 {
     InitializeComponent();
     listView = window;
 }
示例#13
0
 public NewFolderWindow(ListViewView window)
 {
     InitializeComponent();
     listView = window;
 }