Пример #1
0
        public ImagingObservationWpfControl(AimTemplateTreeImagingObservationNode imagingObservation)
        {
            ImagingObservation = imagingObservation;
            InitializeComponent();

            _originalBackground = Background;
            ChildControls       = new List <IValidTreeControl>();

            // Hide the allowed terms control that is not being used
            if (MaxNumberOfAnswers > 1)
            {
                _comboBox.Visibility = Visibility.Hidden;
                _comboBox.Height     = 0;

                var cardinalityString = String.Empty;

                if (ImagingObservation.MinCardinality > 0 && ImagingObservation.MaxCardinality >= ImagingObservation.AllowedTerms.Count)
                {
                    cardinalityString = "Select at least " + ImagingObservation.MinCardinality;
                }
                else if (ImagingObservation.MaxCardinality < ImagingObservation.AllowedTerms.Count && ImagingObservation.MinCardinality <= 0)
                {
                    cardinalityString = "Select less than " + (ImagingObservation.MaxCardinality + 1);
                }
                else if (ImagingObservation.MinCardinality > 0 && ImagingObservation.MaxCardinality < ImagingObservation.AllowedTerms.Count)
                {
                    cardinalityString = "Select at least " + ImagingObservation.MinCardinality + " and less than " +
                                        (ImagingObservation.MaxCardinality + 1);
                }

                if (!String.IsNullOrEmpty(cardinalityString))
                {
                    ((TextBlock)_label.Content).Text += Environment.NewLine + cardinalityString;
                }
            }
            else
            {
                _itemsControl.Visibility = Visibility.Hidden;
                _itemsControl.Height     = 0;
            }

            // Add confidence control
            if (ImagingObservation.ShouldDisplay && ImagingObservation.HasConfidence)
            {
                NodeConfidenceWpfControl = new NodeConfidenceWpfControl(ImagingObservation);
                _stackPanel.Children.Add(NodeConfidenceWpfControl);
            }

            var groupedNodes = new List <AimTemplateTreeNode>();

            foreach (var characteristic in imagingObservation.ImagingObservationCharacteristicTreeNodes)
            {
                // Start or add to group label control
                if (!String.IsNullOrEmpty(characteristic.GroupLabel))
                {
                    if (groupedNodes.Count > 0 && characteristic.GroupLabel == groupedNodes[0].GroupLabel)
                    {
                        groupedNodes.Add(characteristic);
                    }
                    else
                    {
                        // Finish and add the group label control
                        if (groupedNodes.Count > 0)
                        {
                            var groupLabel = new GroupLabelWpfControl(groupedNodes)
                            {
                                Header = groupedNodes[0].GroupLabel
                            };
                            _stackPanel.Children.Add(groupLabel);
                            ChildControls.Add(groupLabel);
                        }

                        groupedNodes = new List <AimTemplateTreeNode> {
                            characteristic
                        };
                    }
                }
                else
                {
                    // Finish and add the group label control
                    if (groupedNodes.Count > 0)
                    {
                        var groupLabel = new GroupLabelWpfControl(groupedNodes)
                        {
                            Header = groupedNodes[0].GroupLabel
                        };
                        groupedNodes.Clear();
                        _stackPanel.Children.Add(groupLabel);
                        ChildControls.Add(groupLabel);
                    }

                    var characteristicControl = new ImagingObservationCharacteristicWpfControl(characteristic);
                    _stackPanel.Children.Add(characteristicControl);
                    ChildControls.Add(characteristicControl);
                }
            }

            // Finish and add the group label control
            if (groupedNodes.Count > 0)
            {
                var groupLabel = new GroupLabelWpfControl(groupedNodes)
                {
                    Header = groupedNodes[0].GroupLabel
                };
                _stackPanel.Children.Add(groupLabel);
                ChildControls.Add(groupLabel);
            }

            Loaded += ImagingObservationWpfControlLoaded;

            ImagingObservation.SelectedAllowedTermsChanged += SelectedAllowedTermsCollectionChanged;
            CheckBoxControls = new Dictionary <AimTemplateTreeAllowedTerm, CheckBox>();

            if (!ImagingObservation.ShouldDisplay)
            {
                _label.Visibility        = Visibility.Hidden;
                _label.Height            = 0;
                _itemsControl.Visibility = Visibility.Hidden;
                _itemsControl.Height     = 0;
                _comboBox.Visibility     = Visibility.Hidden;
                _comboBox.Height         = 0;
                if (imagingObservation.ImagingObservationCharacteristicTreeNodes.TrueForAll(item => !item.ShouldDisplay))
                {
                    Visibility = Visibility.Hidden;
                    Height     = 0;
                }
            }
        }
        public ImagingObservationWpfControl(AimTemplateTreeImagingObservationNode imagingObservation)
        {
            ImagingObservation = imagingObservation;
            InitializeComponent();

            _originalBackground = Background;
            ChildControls = new List<IValidTreeControl>();

            // Hide the allowed terms control that is not being used
            if (MaxNumberOfAnswers > 1)
            {
                _comboBox.Visibility = Visibility.Hidden;
                _comboBox.Height = 0;

                var cardinalityString = String.Empty;

                if (ImagingObservation.MinCardinality > 0 && ImagingObservation.MaxCardinality >= ImagingObservation.AllowedTerms.Count)
                    cardinalityString = "Select at least " + ImagingObservation.MinCardinality;
                else if (ImagingObservation.MaxCardinality < ImagingObservation.AllowedTerms.Count && ImagingObservation.MinCardinality <= 0)
                    cardinalityString = "Select less than " + (ImagingObservation.MaxCardinality + 1);
                else if (ImagingObservation.MinCardinality > 0 && ImagingObservation.MaxCardinality < ImagingObservation.AllowedTerms.Count)
                    cardinalityString = "Select at least " + ImagingObservation.MinCardinality + " and less than " +
                                        (ImagingObservation.MaxCardinality + 1);

                if (!String.IsNullOrEmpty(cardinalityString))
                    ((TextBlock)_label.Content).Text += Environment.NewLine + cardinalityString;
            }
            else
            {
                _itemsControl.Visibility = Visibility.Hidden;
                _itemsControl.Height = 0;
            }

            // Add confidence control
            if (ImagingObservation.ShouldDisplay && ImagingObservation.HasConfidence)
            {
                NodeConfidenceWpfControl = new NodeConfidenceWpfControl(ImagingObservation);
                _stackPanel.Children.Add(NodeConfidenceWpfControl);
            }

            var groupedNodes = new List<AimTemplateTreeNode>();

            foreach (var characteristic in imagingObservation.ImagingObservationCharacteristicTreeNodes)
            {
                // Start or add to group label control
                if (!String.IsNullOrEmpty(characteristic.GroupLabel))
                {
                    if (groupedNodes.Count > 0 && characteristic.GroupLabel == groupedNodes[0].GroupLabel)
                        groupedNodes.Add(characteristic);
                    else
                    {
                        // Finish and add the group label control
                        if (groupedNodes.Count > 0)
                        {
                            var groupLabel = new GroupLabelWpfControl(groupedNodes)
                            {
                                Header = groupedNodes[0].GroupLabel
                            };
                            _stackPanel.Children.Add(groupLabel);
                            ChildControls.Add(groupLabel);
                        }

                        groupedNodes = new List<AimTemplateTreeNode> { characteristic };
                    }
                }
                else
                {
                    // Finish and add the group label control
                    if (groupedNodes.Count > 0)
                    {
                        var groupLabel = new GroupLabelWpfControl(groupedNodes)
                        {
                            Header = groupedNodes[0].GroupLabel
                        };
                        groupedNodes.Clear();
                        _stackPanel.Children.Add(groupLabel);
                        ChildControls.Add(groupLabel);
                    }

                    var characteristicControl = new ImagingObservationCharacteristicWpfControl(characteristic);
                    _stackPanel.Children.Add(characteristicControl);
                    ChildControls.Add(characteristicControl);
                }
            }

            // Finish and add the group label control
            if (groupedNodes.Count > 0)
            {
                var groupLabel = new GroupLabelWpfControl(groupedNodes)
                {
                    Header = groupedNodes[0].GroupLabel
                };
                _stackPanel.Children.Add(groupLabel);
                ChildControls.Add(groupLabel);
            }

            Loaded += ImagingObservationWpfControlLoaded;

            ImagingObservation.SelectedAllowedTermsChanged += SelectedAllowedTermsCollectionChanged;
            CheckBoxControls = new Dictionary<AimTemplateTreeAllowedTerm, CheckBox>();

            if (!ImagingObservation.ShouldDisplay)
            {
                _label.Visibility = Visibility.Hidden;
                _label.Height = 0;
                _itemsControl.Visibility = Visibility.Hidden;
                _itemsControl.Height = 0;
                _comboBox.Visibility = Visibility.Hidden;
                _comboBox.Height = 0;
                if (imagingObservation.ImagingObservationCharacteristicTreeNodes.TrueForAll(item => !item.ShouldDisplay))
                {
                    Visibility = Visibility.Hidden;
                    Height = 0;
                }
            }
        }
Пример #3
0
        public GroupLabelWpfControl(List <AimTemplateTreeNode> treeNodes)
        {
            TreeNodes = treeNodes;

            NodeControls = new List <IValidTreeControl>();

            InitializeComponent();

            var visible = false;

            foreach (var treeNode in TreeNodes)
            {
                if (treeNode.ShouldDisplay)
                {
                    visible = true;
                }

                if (treeNode is AimTemplateTreeAnatomicEntityNode)
                {
                    var anatomicEntityControl =
                        new AnatomicEntityWpfControl((AimTemplateTreeAnatomicEntityNode)treeNode);
                    _stackPanel.Children.Add(anatomicEntityControl);
                    NodeControls.Add(anatomicEntityControl);
                }
                if (treeNode is AimTemplateTreeImagingObservationNode)
                {
                    var imagingObservationControl =
                        new ImagingObservationWpfControl((AimTemplateTreeImagingObservationNode)treeNode);
                    _stackPanel.Children.Add(imagingObservationControl);
                    NodeControls.Add(imagingObservationControl);
                }
                if (treeNode is AimTemplateTreeInferenceNode)
                {
                    var inferenceControl =
                        new InferenceWpfControl((AimTemplateTreeInferenceNode)treeNode);
                    _stackPanel.Children.Add(inferenceControl);
                    NodeControls.Add(inferenceControl);
                }
                if (treeNode is AimTemplateTreeGeometricShapeNode)
                {
                    var geometricShapeControl =
                        new GeometricShapeWpfControl((AimTemplateTreeGeometricShapeNode)treeNode);
                    _stackPanel.Children.Add(geometricShapeControl);
                    NodeControls.Add(geometricShapeControl);
                }
                if (treeNode is AimTemplateTreeCalculationNode)
                {
                    var calculationControl =
                        new CalculationWpfControl((AimTemplateTreeCalculationNode)treeNode);
                    _stackPanel.Children.Add(calculationControl);
                    NodeControls.Add(calculationControl);
                }
                if (treeNode is AimTemplateTreeAnatomicEntityCharacteristicNode)
                {
                    var aecControl =
                        new AnatomicEntityCharacteristicWpfControl(
                            (AimTemplateTreeAnatomicEntityCharacteristicNode)treeNode);
                    _stackPanel.Children.Add(aecControl);
                    NodeControls.Add(aecControl);
                }
                if (treeNode is AimTemplateTreeImagingObservationCharacteristicNode)
                {
                    var iocControl =
                        new ImagingObservationCharacteristicWpfControl(
                            (AimTemplateTreeImagingObservationCharacteristicNode)treeNode);
                    _stackPanel.Children.Add(iocControl);
                    NodeControls.Add(iocControl);
                }
            }

            if (!visible)
            {
                Visibility = Visibility.Hidden;
                Height     = 0;
            }
        }
        public GroupLabelWpfControl(List<AimTemplateTreeNode> treeNodes)
        {
            TreeNodes = treeNodes;

            NodeControls = new List<IValidTreeControl>();

            InitializeComponent();

            var visible = false;

            foreach (var treeNode in TreeNodes)
            {
                if (treeNode.ShouldDisplay)
                    visible = true;

                if (treeNode is AimTemplateTreeAnatomicEntityNode)
                {
                    var anatomicEntityControl =
                        new AnatomicEntityWpfControl((AimTemplateTreeAnatomicEntityNode)treeNode);
                    _stackPanel.Children.Add(anatomicEntityControl);
                    NodeControls.Add(anatomicEntityControl);
                }
                if (treeNode is AimTemplateTreeImagingObservationNode)
                {
                    var imagingObservationControl =
                        new ImagingObservationWpfControl((AimTemplateTreeImagingObservationNode)treeNode);
                    _stackPanel.Children.Add(imagingObservationControl);
                    NodeControls.Add(imagingObservationControl);
                }
                if (treeNode is AimTemplateTreeInferenceNode)
                {
                    var inferenceControl =
                        new InferenceWpfControl((AimTemplateTreeInferenceNode)treeNode);
                    _stackPanel.Children.Add(inferenceControl);
                    NodeControls.Add(inferenceControl);
                }
                if (treeNode is AimTemplateTreeGeometricShapeNode)
                {
                    var geometricShapeControl =
                        new GeometricShapeWpfControl((AimTemplateTreeGeometricShapeNode)treeNode);
                    _stackPanel.Children.Add(geometricShapeControl);
                    NodeControls.Add(geometricShapeControl);
                }
                if (treeNode is AimTemplateTreeCalculationNode)
                {
                    var calculationControl =
                        new CalculationWpfControl((AimTemplateTreeCalculationNode)treeNode);
                    _stackPanel.Children.Add(calculationControl);
                    NodeControls.Add(calculationControl);
                }
                if (treeNode is AimTemplateTreeAnatomicEntityCharacteristicNode)
                {
                    var aecControl =
                        new AnatomicEntityCharacteristicWpfControl(
                            (AimTemplateTreeAnatomicEntityCharacteristicNode) treeNode);
                    _stackPanel.Children.Add(aecControl);
                    NodeControls.Add(aecControl);
                }
                if (treeNode is AimTemplateTreeImagingObservationCharacteristicNode)
                {
                    var iocControl =
                        new ImagingObservationCharacteristicWpfControl(
                            (AimTemplateTreeImagingObservationCharacteristicNode)treeNode);
                    _stackPanel.Children.Add(iocControl);
                    NodeControls.Add(iocControl);
                }
            }

            if (!visible)
            {
                Visibility = Visibility.Hidden;
                Height = 0;
            }
        }