private void _Initialize(FolderModel newFolder)
 {
     #region //Присваеваем анонимные функции коммандам
     SetRenameEnableCommand = new Command(arg => IsNameReadOnly = !Convert.ToBoolean(arg));
     SetRenameEnableCommand.CanExecuteDelegate = arg => this.GetType() == typeof(FolderViewModel);
     CreateSubFolderCommand = new Command(arg => {
         string name = FullName + "\\" + "Новая папка";
         string newName = name;
         for (int i = 1; Directory.Exists(newName); ++i)
             newName = name + " (" + i.ToString() + ")";
         FileSystem.CreateDirectory(newName);
     });
     DeleteCommand = new Command(arg => Task.Run(() => FileSystem.DeleteDirectory(FullName, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing)));
     CopyCommand = new Command(arg =>
     {
         foreach (var folder in DriveViewModel.CutedFolders)
             folder.IsCuted = false;
         DriveViewModel.CutedFolders.Clear();
         StringCollection folderPath = new StringCollection();
         folderPath.Add(FullName);
         Clipboard.SetFileDropList(folderPath);
         FileSystemViewModel.IsClipBoardItemsCuted = false;
     });
     CopyCommand.CanExecuteDelegate = arg => this.GetType() == typeof(FolderViewModel);
     CutCommand = new Command(arg =>
     {
         IsCuted = true;
         foreach (var folder in DriveViewModel.CutedFolders)
             folder.IsCuted = false;
         DriveViewModel.CutedFolders.Clear();
         StringCollection folderPath = new StringCollection();
         DriveViewModel.CutedFolders.Add(this);
         folderPath.Add(FullName);
         Clipboard.SetFileDropList(folderPath);
         FileSystemViewModel.IsClipBoardItemsCuted = true;
     });
     CutCommand.CanExecuteDelegate = new Predicate<object>(arg => this.GetType() == typeof(FolderViewModel));
     DeleteFilesCommand = new Command(arg => { foreach (var file in FolderFilesCollectionView.SelectedItems) file.Delete(); });
     DeleteCommand.CanExecuteDelegate = new Predicate<object>(arg => this.GetType() == typeof(FolderViewModel));
     OpenFilesCommand = new Command(arg => {
         foreach (var file in FolderFilesCollectionView.SelectedItems) file.Open();
     });
     CopyFilesCommand = new Command(arg =>
     {
         foreach (var file in DriveViewModel.CutedFiles)
             file.IsCuted = false;
         DriveViewModel.CutedFiles.Clear();
         StringCollection filePaths = new StringCollection();
         foreach (var file in FolderFilesCollectionView.SelectedItems)
             filePaths.Add(file.FullName);
         Clipboard.SetFileDropList(filePaths);
         FileSystemViewModel.IsClipBoardItemsCuted = false;
     });
     CutFilesCommand = new Command(arg =>
     {
         foreach (var file in DriveViewModel.CutedFiles)
             file.IsCuted = false;
         DriveViewModel.CutedFiles.Clear();
         StringCollection filePaths = new StringCollection();
         foreach (var file in FolderFilesCollectionView.SelectedItems)
         {
             DriveViewModel.CutedFiles.Add(file);
             file.IsCuted = true;
             filePaths.Add(file.FullName);
         }
         Clipboard.SetFileDropList(filePaths);
         FileSystemViewModel.IsClipBoardItemsCuted = true;
     });
     SortFilesCommand = new Command(arg =>
     {
         if (_ListSortDirection == ListSortDirection.Descending) _ListSortDirection = ListSortDirection.Ascending;
         else _ListSortDirection = ListSortDirection.Descending;
         if (arg.ToString() == "Size")
         {
             FolderFilesCollectionView.CustomSort = new FileSizeSorter(_ListSortDirection);
         }
         else if (arg.ToString() == "LastWriteTime")
         {
             FolderFilesCollectionView.CustomSort = new DateTimeSorter(_ListSortDirection);
         }
         else
         {
             FolderFilesCollectionView.SortDescriptions.Clear();
             FolderFilesCollectionView.CustomSort = null;
             FolderFilesCollectionView.SortDescriptions.Add(new SortDescription(arg.ToString(), _ListSortDirection));
         }
     });
     PasteCommand = new Command(arg => Paste(Clipboard.GetFileDropList(), FullName, FileSystemViewModel.IsClipBoardItemsCuted));
     PasteCommand.CanExecuteDelegate = arg => Clipboard.ContainsFileDropList();
     FindCommand = new Command(arg => FolderFilesCollectionView.Filter = new Predicate<object>(item =>
         (((FileViewModel)item).Name.ToLower() + ((FileViewModel)item).Extension.ToLower()).Contains(arg.ToString().ToLower())));
     RenameCommand = new Command(arg =>
     {
         if (arg.ToString() != Name)
             try { FileSystem.RenameDirectory(FullName, arg.ToString()); }
             catch (ArgumentException)
             {
                 NotifyPropertyChanged("Name");
                 IsWrongName = true;
             }
             catch (DirectoryNotFoundException) { }
     });
     #endregion
     _SubFoldersClearTimer.Elapsed += _OnSubFoldersClearTimerElapsed;
     Name = newFolder.DirInfo.Name;
     FullName = newFolder.DirInfo.FullName;
     SubFolders = new ObservableRangeCollection<FolderViewModel>();
     FolderFiles = new ObservableRangeCollection<FileViewModel>();
     try { if (Directory.GetDirectories(FullName).Length != 0) SubFolders.Add(null); }
     catch { }
     FolderFilesCollectionView = new MultiSelectCollectionView<FileViewModel>(FolderFiles);
 }
 public FolderViewModel(FolderModel newFolder)
 {
     _Initialize(newFolder);
 }