コード例 #1
0
        private void AddParameter(AttributeParameter parameter, Boolean addToExistingSetParameters)
        {
            parameter.PropertyChanged += SetParameterPropertyChanged;

            if (addToExistingSetParameters)
            {
                using (ExistingSetParameters.AcquireLock())
                {
                    ExistingSetParameters.Add(parameter);
                }
            }
            else
            {
                using (NewSetParameters.AcquireLock())
                {
                    NewSetParameters.Add(parameter);
                }
            }
        }
コード例 #2
0
        public override XDocument GetCommand()
        {
            var doc  = new XDocument();
            var root = new XElement("AddSamples");

            doc.Add(root);

            if (AddToNewSet)
            {
                using (NewSetParameters.AcquireLock())
                {
                    var setElement = new XElement("Set");
                    root.Add(setElement);

                    foreach (var setParameter in NewSetParameters)
                    {
                        var element = new XElement("Field")
                        {
                            Value = setParameter.AsString
                        };
                        element.SetAttributeValue("Id", setParameter.Name);
                        setElement.Add(element);
                    }
                }
            }
            else
            {
                using (ExistingSetParameters.AcquireLock())
                {
                    foreach (var existingParameter in ExistingSetParameters)
                    {
                        var element = new XElement(existingParameter.Name)
                        {
                            Value = existingParameter.AsString
                        };
                        root.Add(element);
                    }
                }
            }

            using (Replicates.AcquireLock())
            {
                var replicatesElement = new XElement("Replicates");
                root.Add(replicatesElement);

                foreach (var replicate in Replicates)
                {
                    var replicateElement = new XElement("Replicate");
                    replicatesElement.Add(replicateElement);

                    using (replicate.Parameters.AcquireLock())
                    {
                        foreach (var repParameter in replicate.Parameters)
                        {
                            var element = new XElement("Field")
                            {
                                Value = repParameter.AsString
                            };
                            element.SetAttributeValue("Id", repParameter.Name);
                            replicateElement.Add(element);
                        }
                    }
                }
            }

            return(doc);
        }