Пример #1
0
 public CopyOperation(IDirectoryViewItem[] items, string destPath, FileSystemBase sourceFileSystem, FileSystemBase destFileSystem)
     : base(items, sourceFileSystem)
 {
     DestinationPath = destPath;
     DestFileSystem = destFileSystem;
     ProcessedItems = new List<IDirectoryViewItem>(items.Length);
     SizeInBytes = ItemsSize.ToBytes();
 }
 public DirectorySynchronizeOperation(DirectorySynchronizeResult syncRes, IDirectoryViewItem[] items, FileSystemBase leftSystem, FileSystemBase rightSystem)
     : base(items, leftSystem)
 {
     SyncResult = syncRes;
     LeftSystem = leftSystem;
     RightSystem = rightSystem;
     OperationName = "Synchronizacja katalogów";
 }
Пример #3
0
 public RenameOperation(IDirectoryViewItem objectToRename, string newName, FileSystemBase fileSystem)
     : base(fileSystem)
 {
     ObjectToRename = objectToRename;
     OldName = ObjectToRename.Name;
     OldPath = ObjectToRename.FullName;
     NewName = newName;
     NewPath = PathExt.Combine(PathExt.GetDirectoryName(ObjectToRename.FullName, ObjectToRename.IsWindowsFile), NewName, ObjectToRename.IsWindowsFile);
     OperationName = "Zmiana nazwy z " + OldName + " na " + NewName;
 }
Пример #4
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="items">Items to work on</param>
        public MultiFileOperation(IDirectoryViewItem[] items, FileSystemBase fileSystem)
            : base(fileSystem)
        {
            //TODO: Files in folders should be diffirent objects
            ItemsSize = FileSize.Empty;

            System.Diagnostics.Debug.Assert(items.Length > 0, "Empty operation!");
            Items = items;
            //CurrentItem = items[0];

            CountSize();
        }
Пример #5
0
        public ThreeColumnView()
        {
            InitializeComponent();
            fileSystem1 = new WindowsFileSystem();
            fileSystem2 = new WindowsFileSystem();
            fileSystem3 = new WindowsFileSystem();
            history = new History<IDirectoryViewItem>();

            Binding bind2 = new Binding("Items");//bind to second(middle) ListBox
            bind2.Source = FileSystem;
            lbContent2.SetBinding(ListBox.ItemsSourceProperty, bind2);

            lbContent2.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged);
        }
        private void AddNewTab(IDirectoryView view, FileSystemBase fileSystem)
        {
            //create new TabItem & apply style
            TabItem ti = new TabItem();
            ti.Style = (Style)Resources["CloseableTabItem"];

            UserControl viewCtrl = (UserControl)view;
            viewCtrl.Height = double.NaN;//same as Auto in XAML
            viewCtrl.VerticalAlignment = VerticalAlignment.Stretch;
            viewCtrl.Width = double.NaN;
            viewCtrl.HorizontalAlignment = HorizontalAlignment.Stretch;

            //events
            view.ItemExecuted += ActiveView_ItemExecuted;

            //set file system
            if (fileSystem != null)
                view.ChangeFileSystem(fileSystem);

            //set content listview as content of tabitem
            ti.Content = view;

            //add tabitem to tabcontrol
            tcViews.Items.Insert(tcViews.Items.Count - 1, ti);
            tcViews.SelectedIndex = tcViews.Items.Count - 2;//QSTN: Why new tab must be selected, to gain header?

            //bind header
            Binding bind = new Binding("FileSystem.DirectoryName");
            bind.Source = view;
            ti.SetBinding(TabItem.HeaderProperty, bind);
        }
 public void ChangeFileSystem(FileSystemBase fileSystem)
 {
     DisableSimpleSearch();
     ActiveView.ChangeFileSystem(fileSystem);
 }
 private void CommenceCopy(string destPath, FileSystemBase sourceFS, FileSystemBase destFS)
 {
     if (IsWindowsCopy())
         ((WindowsFile)CurrentItem).SimpleCopyTo(destPath);
     else if (sourceFS.IsWindowsFileSystem && !destFS.IsWindowsFileSystem)
         ((FTPFileSystem)destFS).Upload((WindowsFile)CurrentItem);
     else if (!sourceFS.IsWindowsFileSystem && destFS.IsWindowsFileSystem)
         ((FTPFileSystem)sourceFS).Download((FTPFile)CurrentItem, destPath);
     else
         System.Diagnostics.Debug.Assert(true, "Not supported copy");
 }
Пример #9
0
 public void ChangeFileSystem(FileSystemBase fileSystem)
 {
     DisableSearch();
     FileSystem.Dispose();
     FileSystem = fileSystem;
     LoadDirectory(FileSystem.CurrentPlace.FullName);
 }
Пример #10
0
 //OPT: Make this ctor in more elegant way
 public MultiRenameOperation(IEnumerable<MultiRenameItem> mrItems, IDirectoryViewItem[] dvItems, FileSystemBase fileSystem)
     : base(dvItems, fileSystem)
 {
     MRItems = mrItems;
     OperationName = string.Format("Zmiana nazwy {0} obiektów", mrItems.Count());
 }
Пример #11
0
        public void ChangeFileSystem(FileSystemBase fileSystem)
        {
            fileSystem1 = fileSystem.GetCopy();
            fileSystem2 = fileSystem;
            fileSystem3 = fileSystem.GetCopy();

            //set up binding for second column
            Binding bind2 = new Binding("Items");//bind to  ListBox
            bind2.Source = FileSystem;
            lbContent2.SetBinding(ListBox.ItemsSourceProperty, bind2);

            //loading files into first column
            lbContent1.ItemsSource = null;//clear items
            if (!FileSystem.IsRootPath(FileSystem.CurrentPlace.FullName))
            {
                fileSystem1.LoadDirectory(PathExt.GetDirectoryName(FileSystem.CurrentPlace.FullName, FileSystem.IsWindowsFileSystem));
                lbContent1.ItemsSource = fileSystem1.Items;
            }

            //third column is loaded by selecting items in second

            //save in history
            HistoryGlobal.AddItem(FileSystem.CurrentPlace);
            history.AddItem(FileSystem.CurrentPlace, false);

            dirChanged = true;
            //SetFocusOnContent();
            OnPropertyChanged("FileSystem");
        }
Пример #12
0
 public NewFolderOperation(string folderPath, FileSystemBase fileSystem)
     : base(fileSystem)
 {
     FolderPath = folderPath;
     OperationName = "Tworzenie folderu " + Path.GetFileName(FolderPath);
 }
Пример #13
0
 public DeleteOperation(FileSystemBase fileSystem, IDirectoryViewItem[] items)
     : base(items, fileSystem)
 {
 }
Пример #14
0
 /// <summary>
 /// Ctor
 /// </summary>
 public OperationBase(FileSystemBase fileSystem)
 {
     IsCanceled = false;
     IsFinished = false;
     FileSystem = fileSystem;
 }