Beispiel #1
0
        protected void Initialize(string xmlResourceName)
        {
            using (Stream stream = new ResourceResolver(typeof(SopClassLegacyConfigurationElementCollection).Assembly).OpenResource(xmlResourceName))
            {
                XmlDocument document = new XmlDocument();
                document.Load(stream);
                foreach (XmlElement sopClass in document.SelectNodes("//sop-class"))
                {
                    Add(sopClass.Attributes["uid"].InnerText, sopClass.Attributes["description"].InnerText);
                }

                stream.Close();
            }
        }
Beispiel #2
0
        public List <StoredDisplaySetCreationSetting> GetStoredSettings()
        {
            XmlDocument document = this.DisplaySetCreationSettingsXml;

            if (document == null)
            {
                document = new XmlDocument();
                Stream stream = new ResourceResolver(this.GetType(), false).OpenResource("DisplaySetCreationSettingsDefaults.xml");
                document.Load(stream);
                stream.Close();
            }

            XmlNodeList settingsNodes = document.SelectNodes("//display-set-creation-settings/setting");

            if (settingsNodes == null || settingsNodes.Count == 0)
            {
                document = new XmlDocument();
                Stream stream = new ResourceResolver(this.GetType(), false).OpenResource("DisplaySetCreationSettingsDefaults.xml");
                document.Load(stream);
                stream.Close();
                settingsNodes = document.SelectNodes("//display-set-creation-settings/setting");
            }

            List <string> missingModalities = new List <string>(StandardModalities.Modalities);
            List <StoredDisplaySetCreationSetting> storedDisplaySetSettings = new List <StoredDisplaySetCreationSetting>();

            foreach (XmlElement settingsNode in settingsNodes)
            {
                XmlAttribute attribute = settingsNode.Attributes["modality"];
                string       modality  = "";
                if (attribute != null)
                {
                    modality = attribute.Value ?? "";
                    missingModalities.Remove(modality);
                }

                if (!String.IsNullOrEmpty(modality))
                {
                    XmlNodeList optionNodes = settingsNode.SelectNodes("options/option");
                    StoredDisplaySetCreationSetting setting = new StoredDisplaySetCreationSetting(modality);
                    SetOptions(setting, optionNodes);
                    storedDisplaySetSettings.Add(setting);

                    XmlNode presentationIntentNode = settingsNode.SelectSingleNode("presentation-intent");
                    if (presentationIntentNode != null)
                    {
                        attribute = presentationIntentNode.Attributes["show-grayscale-inverted"];
                        if (attribute != null)
                        {
                            setting.ShowGrayscaleInverted = (attribute.Value == "True");
                        }
                    }
                }
            }

            foreach (string missingModality in missingModalities)
            {
                storedDisplaySetSettings.Add(new StoredDisplaySetCreationSetting(missingModality));
            }

            return(storedDisplaySetSettings);
        }