/// <summary> /// Обработчик события, создаёт контекстное меню проводника для выделенных элементов /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lvFileList_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { ListView lstFiles = (ListView)sender; var selItems = lstFiles.SelectedItems; //List<System.IO.FileSystemInfoEx> list = new List<FileSystemInfoEx>(); List <FileSystemInfo> list = new List <FileSystemInfo>(); // Point mousePoint = e.GetPosition(lstFiles); // lstFiles. foreach (var itm in selItems) { CustomFileSystemCover cc = (CustomFileSystemCover)itm; list.Add(cc.FileSystemElement); } System.Drawing.Point dPoint = new System.Drawing.Point(); Point point = lstFiles.PointToScreen(new Point()); dPoint.X = Convert.ToInt32(point.X); dPoint.Y = Convert.ToInt32(point.Y); //System.IO.Tools.ContextMenuWrapper cmw = new System.IO.Tools.ContextMenuWrapper(); //cmw.Popup(list.ToArray(), dPoint); ExplorerNet.Tools.ShellContextMenu scm = new Tools.ShellContextMenu(); scm.ShowContextMenu(list.ToArray(), dPoint); }
private void NoteView_Click(object sender, EventArgs e) { NoteView noteView = sender as NoteView; CustomFileSystemCover cover = noteView.Tag as CustomFileSystemCover; ExplorerNet.MVVM.View.NoteWindow nw = new MVVM.View.NoteWindow(); nw.txtDescription.Text = noteView.Description; Point p = noteView.PointToScreen(new Point()); nw.Top = p.Y; nw.Left = p.X; // отобжараем окно заметок //nw.WindowStartupLocation = WindowStartupLocation.CenterScreen; nw.ShowDialog(); if (nw.DialogAnswer == true) { if (string.IsNullOrEmpty(nw.txtDescription.Text)) { cover.Description = null; } else { cover.Description = nw.txtDescription.Text; } noteView.Description = cover.Description; } //noteView.so }
private void StarView_Click(Object sender, EventArgs e) { StarView starView = sender as StarView; CustomFileSystemCover cover = starView.Tag as CustomFileSystemCover; cover.Star = starView.StarLevel; }
//Метод, вызывает диалог удаления файла public void DeleteFilesDialog() { List <FileSystemInfo> list = new List <FileSystemInfo>(); foreach (var itm in lvFileList.SelectedItems) { if (itm.GetType() != typeof(ParentDirectoryCover)) { CustomFileSystemCover fsi = (CustomFileSystemCover)itm; list.Add(fsi.FileSystemElement); } } DeleteWindow dw = new DeleteWindow(list); dw.ShowDialog(); }
public void SetData(CustomFileSystemCover fsCover) { if (fsCover.GetType() == typeof(DirectoryCover)) { //txtSize.Text = LanguagesManager.GetCurrLanguage().SPDir; ccSize.SetResourceReference(ContentControl.ContentProperty, "SPDir"); btnSumCalculate.MinWidth = 20; btnSumCalculate.BorderThickness = new Thickness(4); btnSumCalculate.Visibility = System.Windows.Visibility.Visible; } else if (fsCover.GetType() == typeof(FileCover)) { FileInfo fi = (FileInfo)fsCover.FileSystemElement; //txtSize.Text = SizeFileInString.GetSizeInStr(fi.Length); ccSize.Content = SizeFileInString.GetSizeInStrWPF(fi.Length); btnSumCalculate.BorderThickness = new Thickness(0); btnSumCalculate.MinWidth = 0; btnSumCalculate.Width = 0; btnSumCalculate.Visibility = System.Windows.Visibility.Hidden; } }
public override int Compare(CustomFileSystemCover x, CustomFileSystemCover y) { if (x == null) { if (y == null) { // If x is null and y is null, they're // equal. return(0); } else { // If x is null and y is not null, y // is greater. return(-1); } } else { // If x is not null... // if (y == null) // ...and y is null, x is greater. { return(1); } else { if (x is ParentDirectoryCover) { if (y is ParentDirectoryCover) { return(0); } else if ((y is DirectoryCover) || (y is FileCover)) { return(-1); } } else if (x is DirectoryCover) { if (y is ParentDirectoryCover) { return(1); } else if (y is DirectoryCover) { int sc = StarCompare(x, y); if (sc == 0) { return(x.Name.CompareTo(y.Name)); } else { return(sc); } } else if (y is FileCover) { int sc = StarCompare(x, y); if (sc == 0) { return(-1); } else { return(sc); } } } else if (x is FileCover) { if ((y is ParentDirectoryCover)) { return(1); } else if (y is DirectoryCover) { int sc = StarCompare(x, y); if (sc == 0) { return(1); } else { return(sc); } } else if (y is FileCover) { int sc = StarCompare(x, y); if (sc == 0) { return(x.Name.CompareTo(y.Name)); } else { return(sc); } } } } } return(-1); }