예제 #1
0
        /// <summary>
        /// 重命名
        /// </summary>
        protected override void OnAfterLabelEdit(NodeLabelEditEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Label))
            {
                e.CancelEdit = true;
                return;
            }

            e.Node.Text = e.Label.Replace(" ", "");
            SdsiteXmlDocument sdsiteDoc = Service.Sdsite.CurrentDocument;

            if (((ElementNode)e.Node).Element.CanNewFileName(e.Label))
            {
                sdsiteDoc.ChangeTitle(((ElementNode)e.Node).Element.Id, e.Label);
            }
            else
            {
                e.CancelEdit = true;
                MessageService.Show("文件名重复或不合法!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                RenameNode();
                return;
            }

            base.OnAfterLabelEdit(e);
        }