示例#1
0
        /*
         * When a ListView item is selected, the corresponding node in the treeview will also get selected
         */
        private void lstEmptyTags_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstEmptyTags.SelectedItems.Count > 0)
            {
                MyListViewItem selItem = (MyListViewItem)lstEmptyTags.SelectedItems[0];
                MyTreeNode     selNode = (MyTreeNode)treeDSResult.SelectedNode;

                try
                {
                    if ((selNode != null) && (selNode.m_Element != null))
                    {
                        if (!(selItem.m_Element.Tag == selNode.m_Element.Tag))

                        {
                            treeDSResult.SelectNodeByElement(selItem.m_Element);
                        }
                    }
                    else
                    {
                        treeDSResult.SelectNodeByElement(selItem.m_Element);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
示例#2
0
        /*
         * Parses through the data set, finds the mandatory type 1 elements, and adds them
         *   to the ListView.
         */
        public void Update(MyDicomDataSet ds, DicomClassType nClass)
        {
            try
            {
                if (ds == null)
                {
                    return;
                }

                MyListViewItem currentItem;
                string         strTag  = "";
                string         strDesc = "";

                DicomElement element;
                element = ds.GetFirstEmptyElementType1(nClass, ref strTag, ref strDesc);
                while (element != null)
                {
                    currentItem      = new MyListViewItem();
                    currentItem.Text = strTag;
                    currentItem.SubItems.Add(strDesc);
                    currentItem.SubItems.Add("");
                    currentItem.m_Element  = element;
                    currentItem.ImageIndex = (int)MyIconIndex.Missing;

                    MyTreeNode treeNode = m_TreeView.FindNodeByElement(element, null, null);
                    if (treeNode != null)
                    {
                        m_TreeView.FindNodeByElement(element, null, null).ImageIndex         = (int)MyIconIndex.Missing;
                        m_TreeView.FindNodeByElement(element, null, null).SelectedImageIndex = (int)MyIconIndex.Missing;
                        Items.Add(currentItem);
                    }

                    element = ds.GetNextEmptyElementType1(element, nClass, ref strTag, ref strDesc);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }