示例#1
0
        private void InitializeFields()
        {
            RegisterField(PropertyType.Page, labelPageOrder, textPageOrder,
                          opts => opts.SupportsPageOrder,
                          post => textPageOrder.Text = post.PageOrder,
                          post => post.PageOrder     = textPageOrder.Text);

            RegisterField2(PropertyType.Page, labelPageParent, comboPageParent,
                           opts => opts.SupportsPageParent,
                           (ctx, opts) =>
            {
                PostIdAndNameField none     = new PostIdAndNameField(Res.Get(StringId.PropertiesNoPageParent));
                PostIdAndNameField parent   = ctx.BlogPost.PageParent;
                BlogPageFetcher pageFetcher = new BlogPageFetcher(_blogId, 10000);
                if (!parent.Equals(PostIdAndNameField.Empty))
                {
                    comboPageParent.Initialize(new object[] { none, parent }, parent, pageFetcher);
                }
                else
                {
                    comboPageParent.Initialize(none, pageFetcher);
                }
            },
                           post => post.PageParent = comboPageParent.SelectedItem as PostIdAndNameField);

            RegisterField(PropertyType.Post, labelCategory, categoryDropDown,
                          opts => opts.SupportsCategories,
                          post => { },
                          post => { });

            RegisterField2(PropertyType.Post, labelTags, textTags,
                           opts => opts.SupportsKeywords,
                           (ctx, opts) => textTags.Text = ctx.BlogPost.Keywords,
                           post => post.Keywords        = textTags.TextValue);

            RegisterField(PropertyType.Post, labelPublishDate, datePublishDate,
                          opts => opts.SupportsCustomDate,
                          post =>
            {
                if (post.HasDatePublishedOverride)
                {
                    DatePublishedOverride    = post.DatePublishedOverride;
                    HasDatePublishedOverride = true;
                }
                else
                {
                    HasDatePublishedOverride = false;
                }
            },
                          post => post.DatePublishedOverride = HasDatePublishedOverride ? DatePublishedOverride : DateTime.MinValue);
        }
        private void InitializeFields()
        {
            RegisterField(PropertyType.Page, labelPageOrder, textPageOrder,
              opts => opts.SupportsPageOrder,
              post => textPageOrder.Text = post.PageOrder,
              post => post.PageOrder = textPageOrder.Text);

            RegisterField2(PropertyType.Page, labelPageParent, comboPageParent,
                          opts => opts.SupportsPageParent,
                          (ctx, opts) =>
                          {
                              PostIdAndNameField none = new PostIdAndNameField(Res.Get(StringId.PropertiesNoPageParent));
                              PostIdAndNameField parent = ctx.BlogPost.PageParent;
                              BlogPageFetcher pageFetcher = new BlogPageFetcher(_blogId, 10000);
                              if (!parent.Equals(PostIdAndNameField.Empty))
                              {
                                  comboPageParent.Initialize(new object[] { none, parent }, parent, pageFetcher);
                              }
                              else
                              {
                                  comboPageParent.Initialize(none, pageFetcher);
                              }
                          },
                          post => post.PageParent = comboPageParent.SelectedItem as PostIdAndNameField);

            RegisterField(PropertyType.Post, labelCategory, categoryDropDown,
                          opts => opts.SupportsCategories,
                          post => { },
                          post => { });

            RegisterField2(PropertyType.Post, labelTags, textTags,
                          opts => opts.SupportsKeywords,
                          (ctx, opts) => textTags.Text = ctx.BlogPost.Keywords,
                          post => post.Keywords = textTags.TextValue);

            RegisterField(PropertyType.Post, labelPublishDate, datePublishDate,
                          opts => opts.SupportsCustomDate,
                          post =>
                          {
                              if (post.HasDatePublishedOverride)
                              {
                                  DatePublishedOverride = post.DatePublishedOverride;
                                  HasDatePublishedOverride = true;
                              }
                              else
                              {
                                  HasDatePublishedOverride = false;
                              }
                          },
                          post => post.DatePublishedOverride = HasDatePublishedOverride ? DatePublishedOverride : DateTime.MinValue);

        }