Exemplo n.º 1
0
        private void AddNewPipeClass(NodeView nodeView)
        {
            AddEditPipeClassDialog dialog = new AddEditPipeClassDialog();
            dialog.Show();

            dialog.Closed += (s1, e1) =>
            {
                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    PipeClass pipeClass = dialog.PipeClass;
                    NodeView child = new NodeView(nodeView)
                    {
                        Id = pipeClass.Id,
                        Name = pipeClass.Name,
                        Description = pipeClass.Description,
                        Type = NodeType.PipeClassNode,
                        Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                        HasChildren = false,
                        SortField = pipeClass.Name
                    };
                    if (nodeView.ChildrenLoaded)
                    {
                        nodeView.Children.Add(child);
                        nodeView.Sort();
                    }
                }
            };
        }
Exemplo n.º 2
0
        private void EditPipeClass(NodeView nodeView)
        {
            AddEditPipeClassDialog dialog = new AddEditPipeClassDialog(nodeView.Id);
            dialog.Show();

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