Example #1
0
        public PresetVoiLutCollection Clone()
        {
            PresetVoiLutCollection clone = new PresetVoiLutCollection();

            foreach (PresetVoiLut preset in _presets)
            {
                clone.Add(preset.Clone());
            }

            return(clone);
        }
Example #2
0
        private void DeserializeGroupPresets(PresetVoiLutCollection presets, XmlNodeList presetNodes)
        {
            foreach (XmlElement presetNode in presetNodes)
            {
                string keyStrokeAttribute = presetNode.GetAttribute("keystroke");
                XKeys  keyStroke          = XKeys.None;
                if (!String.IsNullOrEmpty(keyStrokeAttribute))
                {
                    keyStroke = (XKeys)_xkeysConverter.ConvertFromInvariantString(keyStrokeAttribute);
                }

                string factoryName = presetNode.GetAttribute("factory");

                IPresetVoiLutOperationFactory factory = PresetVoiLutOperationFactories.GetFactory(factoryName);
                if (factory == null)
                {
                    continue;
                }

                PresetVoiLutConfiguration configuration = PresetVoiLutConfiguration.FromFactory(factory);

                XmlNodeList configurationItems = presetNode.SelectNodes("configuration/item");
                foreach (XmlElement configurationItem in configurationItems)
                {
                    configuration[configurationItem.GetAttribute("key")] = configurationItem.GetAttribute("value");
                }

                try
                {
                    IPresetVoiLutOperation operation = factory.Create(configuration);
                    PresetVoiLut           preset    = new PresetVoiLut(operation);
                    preset.KeyStroke = keyStroke;
                    presets.Add(preset);
                }
                catch (Exception e)
                {
                    Platform.Log(LogLevel.Error, e);
                    continue;
                }
            }
        }
Example #3
0
 public PresetVoiLutGroup(string modality)
 {
     Platform.CheckForEmptyString(modality, "modality");
     _modality = modality;
     _presets  = new PresetVoiLutCollection();
 }