예제 #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");
            }
        }
예제 #12
0
 public NewArchiveWindow(ListViewView window)
 {
     InitializeComponent();
     listView = window;
 }
예제 #13
0
 public NewFolderWindow(ListViewView window)
 {
     InitializeComponent();
     listView = window;
 }