예제 #1
0
        /// <summary>
        /// Создание новой папки в работе
        /// </summary>
        /// <param name="parentNode">Родитель</param>
        /// <param name="newFolderName">Имя новой папки</param>
        /// <returns>Новая папка</returns>
        public static WorkFolderNode CreateNewFolder(WorkFolderNode parentNode, string newFolderName)
        {
            if (parentNode != null)
            {
                try
                {
                    int result = Environment.FolderData.New(parentNode.ID, newFolderName);
                    if (result != 0)
                    {
                        var newNode = new WorkFolderNode(result, newFolderName, parentNode.Emp);

                        parentNode.Nodes.Add(newNode);
                        newNode.RemoveBold();
                        newNode.EnsureVisible();
                        return(newNode);
                    }
                }
                catch (Exception ex)
                {
                    Lib.Win.Data.Env.WriteToLog(ex);
                }
            }

            return(parentNode);
        }
예제 #2
0
        private void NewItemDialog_DialogEvent(object source, Kesco.Lib.Win.DialogEventArgs e)
        {
            Kesco.Lib.Win.Document.EnterStringDialog dialog = e.Dialog as Kesco.Lib.Win.Document.EnterStringDialog;
            if (dialog == null || dialog.DialogResult != DialogResult.OK)
            {
                return;
            }

            string folderName = dialog.Input;
            int    result     = Environment.FolderData.New(ID, folderName);

            if (result != 0)
            {
                var newNode = new WorkFolderNode(result, folderName, Emp);

                Nodes.Add(newNode);
                newNode.RemoveBold();
                newNode.EnsureVisible();
                TreeView.SelectedNode = newNode;
            }
        }