public void SelectFolder(ClassicFolderBox folder) { if (_suspended) return; if (SelectedFolder == folder) return; SelectedFolder = folder; if (SelectedFolder.FormatState?.AllowMultiSelect != true) ResetLinks(); LastUpdate = DateTime.Now; SelectionChanged?.Invoke(this, new SelectionEventArgs(SelectionEventType.FolderSelected)); }
private void ProcessDragLeave(object sender, EventArgs e) { if (_draggedFolder == null && _draggedOverColumnIndex == -1) return; _draggedFolder = null; _draggedOverColumnIndex = -1; Refresh(); ProcessScrollOnDragLeave(sender, e); }
public void ProcessDragOver(object sender, DragEventArgs e) { if (!MainController.Instance.WallbinViews.FormatState.AllowEdit) return; var draggedFolder = _draggedFolder = e.Data != null ? e.Data.GetData(typeof(ClassicFolderBox)) as ClassicFolderBox : null; var draggedOverColumnIndex = -1; if (draggedFolder != null) { var point = PointToClient(new Point(e.X, e.Y)); var width = InnerWidth / 3; if (point.X <= width) draggedOverColumnIndex = 0; else if (point.X > width && point.X <= (width * 2)) draggedOverColumnIndex = 1; else if (point.X > (width * 2)) draggedOverColumnIndex = 2; e.Effect = DragDropEffects.Move; if (_draggedFolder != draggedFolder || _draggedOverColumnIndex != draggedOverColumnIndex) { _draggedFolder = draggedFolder; _draggedOverColumnIndex = draggedOverColumnIndex; Refresh(); } } else { e.Effect = DragDropEffects.None; ProcessDragLeave(sender, e); } ProcessScrollOnDragOver(sender, e); }
public void DeleteFolder(ClassicFolderBox folderBox) { var libraryFolder = folderBox.DataSource; _folderBoxes.Remove(folderBox); Controls.Remove(folderBox); folderBox.Dispose(); libraryFolder.Delete(PageContainer.Page.Library.Context); PageContainer.Page.Folders.RemoveItem(libraryFolder); UpdateFoldersSize(); OnFolderDataChanged(this, EventArgs.Empty); }
public void ProcessFolderMoving(ClassicFolderBox folderBox, int newColumnPosition, int newRowPosition) { PageContainer.Page.MoveFolderToPosition(folderBox.DataSource, newColumnPosition, newRowPosition); UpdateFoldersSize(); OnFolderDataChanged(this, EventArgs.Empty); }
private void LoadFolders() { _folderBoxes.AddRange( PageContainer.Page.Folders .Select(libraryFolder => { var folderBox = new ClassicFolderBox(libraryFolder); folderBox.BoxSizeChanged += OnFolderSizeChanged; folderBox.DataChanged += OnFolderDataChanged; Application.DoEvents(); return folderBox; }) .ToArray() ); Controls.AddRange(_folderBoxes.OfType<Control>().ToArray()); }