Exemple #1
0
        protected virtual void _listViewElement_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (_checkLocked)
            {
                return;
            }
            ListViewItem      item = this._listViewElement.Items[e.Index];
            IDicomMappingItem qr   = item.Tag as IDicomMappingItem;

            if (qr == null || qr.DPath.VR == DVR.Unknown)
            {
                e.NewValue = e.CurrentValue;
            }
            if (qr != null && qr.DPath.VR == DVR.SQ)
            {
                string strRoot = qr.DPath.Path;
                foreach (ListViewItem i in this._listViewElement.Items)
                {
                    IDicomMappingItem subqr = i.Tag as IDicomMappingItem;
                    if (subqr != null &&
                        subqr.DPath.Path.Length > strRoot.Length &&
                        subqr.DPath.Path.IndexOf(strRoot) == 0)
                    {
                        if (e.NewValue == CheckState.Unchecked)
                        {
                            i.Checked = false;
                        }
                        if (e.NewValue == CheckState.Checked)
                        {
                            i.Checked = true;
                        }
                    }
                }
            }
            if (/*_asQueryResult == false &&*/
                qr != null && qr.IsValid() == false)
            {
                e.NewValue = CheckState.Unchecked;
            }
        }
Exemple #2
0
        private ListViewItem GetListViewItem(ref string prefix, IDicomMappingItem qr)
        {
            if (qr == null)
            {
                return(null);
            }
            ListViewItem item = new ListViewItem();

            // prefix handler
            if (qr.DPath.VR == DVR.Unknown && qr.DPath.Type == DPathType.BeginItem)
            {
                prefix += PrefixChar;
            }

            // display value
            if (qr.IsValid())
            {
                item.Checked = qr.DPath.Enable;
            }
            if (((_isInbound && _asQueryResult) || (!_isInbound && !_asQueryResult)) &&
                qr.Translating.Type == TranslatingType.FixValue)
            {
                item.Text = "";
                item.SubItems.Add("");
                item.SubItems.Add("");
            }
            else
            {
                string strName = qr.DPath.GetTagName();
                string strG = qr.DPath.GetGroupString();
                string strE = qr.DPath.GetElementString();
                string strTag = "", strVR = "";
                if (qr.DPath.VR == DVR.Unknown)
                {
                    strTag    = prefix + qr.DPath.Path;
                    item.Text = strTag;
                }
                else
                {
                    strVR     = qr.DPath.VR.ToString();
                    strTag    = prefix + "(" + strG + "," + strE + ")";
                    item.Text = strTag;
                    item.SubItems.Add(strVR);
                    item.SubItems.Add(GetTagDisplayName(strName));
                }
            }

            // display color
            int depth     = prefix.Length;
            int luminance = 255 - 20 * depth;

            item.BackColor = Color.FromArgb(luminance, luminance, luminance);

            // prefix handler
            if (qr.DPath.VR == DVR.Unknown && qr.DPath.Type == DPathType.EndItem)
            {
                if (prefix.Length == 1)
                {
                    prefix = "";
                }
                if (prefix.Length > 1)
                {
                    prefix = prefix.Substring(1);
                }
            }

            GetGWDBField(item, qr);
            item.Tag = qr;

            if (qr.DPath.VR == DVR.Unknown)
            {
                return(null);
            }
            return(item);
        }