Esempio n. 1
0
        private void AddNewPipeCategory(NodeView nodeView)
        {
            AddEditPipeCategoryDialog dialog = new AddEditPipeCategoryDialog();
            dialog.Show();
            dialog.Closed += (s1, e1) =>
            {
                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    PipeCategory pipeCategory = dialog.PipeCategory;
                    NodeView child = new NodeView(nodeView)
                    {
                        Id = pipeCategory.Id,
                        Name = pipeCategory.Name,
                        Description = pipeCategory.Description,
                        Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                        Type = NodeType.PipeCategoryNode,
                        HasChildren = false,
                        SortField = pipeCategory.Name
                    };

                    if (nodeView.ChildrenLoaded)
                    {
                        nodeView.Children.Add(child);
                        nodeView.Sort();
                    }
                }
            };
        }
Esempio n. 2
0
        private void EditPipeCategory(NodeView nodeView)
        {
            AddEditPipeCategoryDialog dialog = new AddEditPipeCategoryDialog(nodeView.Id);
            dialog.Show();

            dialog.Closed += (s1, e1) =>
            {
                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    PipeCategory pipeCategory = dialog.PipeCategory;
                    nodeView.Name = pipeCategory.Name;
                    nodeView.Description = pipeCategory.Description;
                    nodeView.SortField = pipeCategory.Name;
                    nodeView.Parent.Sort();
                }
            };
        }