Ejemplo n.º 1
0
        private void AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            fileExplorer.AfterLabelEdit -= AfterLabelEdit;

            if (e.Node.Parent != null)
            {
                var parentPath = e.Node.Parent.Tag.ToString();

                var oldFileFullPath = Path.Combine(parentPath, e.Node.Text);

                if (e.Label != null)
                {
                    var newFullPath = Path.Combine(parentPath, e.Label);

                    if (oldFileFullPath != newFullPath)
                    {
                        _filesystem.RenameDirectory(oldFileFullPath, newFullPath);

                        e.Node.Text = e.Label;
                        e.Node.Tag  = newFullPath;
                    }
                }
            }

            e.Node.EndEdit(true);
            EditFinished(this, new EventArgs());
        }