public void AddComponent(FileSystemNodePlus<MyAddittionalData> Component,bool Selectionable=true,String OverrideName=null) { SingleFile s = new SingleFile(Component); s.Location = new Point(0, s.Height * Controls.Count); s.Width = Width; s.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; s.OnSingleFileDoubleClick += S_OnSingleFileDoubleClick; s.OnSingleFileRightClick += S_OnSingleFileRightClick; s.OnSingleFileSelectChange += S_OnSingleFileSelectChange; s.OnSingleFileMouseDown += S_OnSingleFileMouseDown; s.OnSingleFileMouseUp += S_OnSingleFileMouseUp; s.OnSingleFileMouseMove += S_OnSingleFileMouseMove; s.OnSingleFileNodoChangeName += S_OnSingleFileNodoChangeName; s.OnSingleFileKeyDown += S_OnSingleFileKeyDown; if(OverrideName!=null) s.ShowedName = OverrideName; if (_Status == FileBrowserStatus.browsing) s.sc.ShowCheckBox = false; else if (_Status == FileBrowserStatus.Select) s.sc.ShowCheckBox = true; s.sc.Selectionable = Selectionable; Controls.Add(s); }
private void S_OnSingleFileDoubleClick(SingleFile Sender,FileSystemNodePlus<MyAddittionalData> Nodo) { if (Nodo.Type == FileSystemNodePlusType.Directory) { if (Sender.ShowedName == "..") { String s = CurrentNode.Name; LoadNode(Nodo); ScrollTo("^" + s); } else { LoadNode(Nodo); } } }
private void S_OnSingleFileMouseMove(SingleFile SF) { }
private void S_OnSingleFileMouseUp(SingleFile SF) { if (Type == FileBrowserType.Playlist) { Cursor.Current = Cursors.Default; if (DownNode != SF.Nodo) { if (SF.Nodo.Type == FileSystemNodePlusType.Directory) { String path = CurrentNode.GetFullPath(); MyFileSystemPlus Clo = currentFileSystem.Clone(); FileSystemNodePlus<MyAddittionalData> nn = Clo.GetNodeFromPath(path); MyFileSystemPlus temp = new MyFileSystemPlus(); temp.Root = nn; temp = temp.FindPreserveTree((x) => { return x.AddittionalData.Selezionato; }, FileSystemNodePlusControlType.Pre); CurrentNode.Remove((t) => { return t.Type == FileSystemNodePlusType.File && t.AddittionalData.Selezionato; }, FileSystemNodePlusLevelType.AllNode, FileSystemNodePlusControlType.Pre); CurrentNode.Remove((t) => { return t.Type == FileSystemNodePlusType.Directory && t.ChildCount == 0 && t.AddittionalData.Selezionato; }, FileSystemNodePlusLevelType.AllNode, FileSystemNodePlusControlType.Post); temp.DeselectAll(); SF.Nodo.Merge(temp.Root); SF.Selected = false; ReloadNode(); if (PlaylistChanged != null) PlaylistChanged(currentFileSystem); } } DownNode = null; } }
private void S_OnSingleFileMouseDown(SingleFile SF) { if (Type == FileBrowserType.Playlist) { DownSingleFile = SF; DownNode = SF.Nodo; Cursor.Current = Cursors.Cross; } }
private void S_OnSingleFileNodoChangeName(SingleFile Sender, FileSystemNodePlus<MyAddittionalData> Nodo, string NewName) { if (Nodo.Parent == null) Sender.Status = SingleFileStatus.Normal; else { FileSystemNodePlus<MyAddittionalData> parent = Nodo.Parent; FileSystemNodePlus<MyAddittionalData> nt = Nodo.Clone(NewName); parent.Remove((x) => { return x == Nodo; }, FileSystemNodePlusLevelType.FirstLevel, FileSystemNodePlusControlType.Pre); parent.Add(nt); ReloadNode(); if (PlaylistChanged != null) PlaylistChanged(currentFileSystem); } }