Пример #1
0
            public string this[string propertyName]
            {
                get
                {
                    return(_projectConfiguration.Properties.GetValueOrDefault(propertyName)?.Value);
                }
                set
                {
                    IProjectProperty property;

                    if (!_projectConfiguration.Properties.TryGetValue(propertyName, out property) || (property == null))
                    {
                        if (string.IsNullOrEmpty(value)) // do not create empty entries.
                        {
                            return;
                        }

                        property = _projectConfiguration.CreateProperty(propertyName);
                    }

                    if (property == null)
                    {
                        throw new ArgumentException("Unable to create property: " + propertyName, nameof(propertyName));
                    }

                    property.Value = value;
                }
            }
Пример #2
0
            public string this[string propertyName]
            {
                get
                {
                    return(_projectConfiguration.Properties.GetValueOrDefault(propertyName)?.Value);
                }
                set
                {
                    IProjectProperty property;

                    if (!_projectConfiguration.Properties.TryGetValue(propertyName, out property) || (property == null))
                    {
                        if (string.IsNullOrEmpty(value)) // do not create empty entries.
                        {
                            return;
                        }

                        property = _projectConfiguration.CreateProperty(propertyName);
                    }

                    if (property == null)
                    {
                        throw new ArgumentException(@"Unable to create property: " + propertyName, nameof(propertyName));
                    }

                    property.Value = value ?? string.Empty;

                    // Defer property change notifications, else bulk operations on data grid will fail...
                    Dispatcher.CurrentDispatcher.BeginInvoke(() => _projectConfiguration.OnPropertyChanged(nameof(PropertyValue)));
                }
            }