/// <summary>
        /// Creates an edit interface for the property.
        /// </summary>
        public override void CreateEditControls()
        {
            SelectedContentProviders selectedContentProviders = PropertyData.Value as SelectedContentProviders ??
                                                                new SelectedContentProviders();

            if (selectedContentProviders.ContentProviderIds == null)
            {
                selectedContentProviders.ContentProviderIds = new List <Guid>();
            }

            SelectedValues = selectedContentProviders.ContentProviderIds.Select(current => current.ToString()).ToList();

            // add page count
            Label label = new Label {
                Text = "Page Count:&nbsp;"
            };

            Controls.Add(label);

            _pageCountTextBox = new TextBox {
                ID = "PageCount", Text = selectedContentProviders.PageCount.ToString()
            };
            Controls.Add(_pageCountTextBox);

            // add base multiple selection editing controls
            base.CreateEditControls();
        }
        private static bool EqualTo(SelectedContentProviders entity1, SelectedContentProviders entity2)
        {
            if (entity1 == null || entity2 == null)
            {
                return(false);
            }

            return(string.Equals(SerializationHelper.SerializeObject(entity1), SerializationHelper.SerializeObject(entity2)));
        }
        /// <summary>
        /// Applies changes for the posted data to the page's properties when the <see cref="P:EPiServer.Web.PropertyControls.PropertyDataControl.RenderType"/> property is set to <see cref="F:EPiServer.Core.RenderType.Edit"/>.
        /// </summary>
        public override void ApplyEditChanges()
        {
            base.ApplyEditChanges();

            int pageCount;

            if (!int.TryParse(_pageCountTextBox.Text, out pageCount) || pageCount < 0)
            {
                AddErrorValidator("You must enter a valid page count");
                return;
            }

            SelectedContentProviders selectedContentProviders = new SelectedContentProviders
            {
                PageCount          = pageCount,
                ContentProviderIds = SelectedValues.Select(current => new Guid(current)).ToList()
            };

            SerializationHelper.SerializeObject(selectedContentProviders);
            SetValue(selectedContentProviders);
        }
 public PropertyContentProviderSelection(SelectedContentProviders selectedContentProviders)
 {
     _selectedContentProviders = selectedContentProviders;
 }
 /// <summary>
 /// Sets the default value.
 /// </summary>
 protected override void SetDefaultValue()
 {
     ThrowIfReadOnly();
     _selectedContentProviders = new SelectedContentProviders();
 }