Beispiel #1
0
        /// <summary>
        /// Inserts the data for sorting elements.
        /// </summary>
        /// <param name="item">Id of item to be decorated.</param>
        /// <param name="dataType">A type of item.</param>
        /// <param name="property">A type of the inserted data.</param>
        /// <param name="st">A panel where the data are supposed to be added.</param>
        void AddHoverableData(int item, ServerData dataType, PropertyData property, Panel st)
        {
            Thread thd = new Thread(new ThreadStart(() =>
            {
                Dispatcher.InvokeAsync(new Action(() => {
                    if (_proxy.GetItemPropertyAsync(item, dataType, property).Result != null)
                    {
                        StackPanel hor = new StackPanel {
                            Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch
                        };
                        hor.Children.Add(new Label {
                            Content = $"{property.ToString()}:", FontSize = 14, FontWeight = FontWeights.Bold
                        });

                        TextBlock label = new TextBlock {
                            Padding = new Thickness(5), Foreground = Brushes.DarkBlue, TextDecorations = TextDecorations.Underline, Tag = property.ToString(), Text = _proxy.GetItemPropertyAsync(item, dataType, property).Result
                        };
                        label.MouseDown  += ItemData_MouseDown;
                        label.MouseEnter += ItemData_MouseEnter;
                        label.MouseLeave += ItemData_MouseLeave;
                        hor.Children.Add(label);
                        st.Children.Add(hor);
                    }
                }));
            }))
            {
                IsBackground = true
            };

            thd.Start();
        }
Beispiel #2
0
        /// <summary>
        /// Creates an edit interface for the property.
        /// </summary>
        public override void CreateEditControls()
        {
            EditControlContainer = new Panel();
            EditControlContainer.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            EditControlContainer.Style.Add("float", "left");
            Controls.Add(EditControlContainer);

            EditControl           = new TextBox();
            EditControl.ID        = "EditControl";
            EditControl.MaxLength = 255;
            EditControl.Rows      = 4;
            EditControl.TextMode  = TextBoxMode.MultiLine;
            EditControl.Text      = PropertyData.ToString();

            Label editControlLabel = new Label();

            editControlLabel.Style.Add(HtmlTextWriterStyle.Display, "block");
            editControlLabel.Text = LanguageManager.Instance.Translate("/blog/propertyblogtags/selectedtagslabel");
            editControlLabel.AssociatedControlID = EditControl.ID;

            EditControlContainer.Controls.Add(editControlLabel);
            EditControlContainer.Controls.Add(EditControl);

            Category rootCategory = Category.Find(BlogUtility.RootCategoryName);

            if (rootCategory != null && rootCategory.Categories.Count != 0)
            {
                CreateExistingCategoryControl(rootCategory);
                AddCategoryControlScripts();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Describes static one-line property.
        /// </summary>
        /// <param name="content">The data to insert.</param>
        /// <param name="item">Id of the item to which this property belongs.</param>
        /// <param name="st">The panel where to insert.</param>
        /// <param name="dataType">The type of an item.</param>
        /// <param name="property">The type of property.</param>
        void AddStaticContent(int item, Panel st, ServerData dataType, PropertyData property)
        {
            Thread thd = new Thread(new ThreadStart(() =>
            {
                Dispatcher.InvokeAsync(new Action(() => {
                    if (_proxy.GetItemPropertyAsync(item, dataType, property).Result != null)
                    {
                        StackPanel hor = new StackPanel();
                        string header  = property.ToString();
                        switch (property)
                        {
                        case PropertyData.PastForm:
                            header = "Past form";
                            break;

                        case PropertyData.PastThForm:
                            header = "Past participle";
                            break;

                        case PropertyData.PluralForm:
                            header = "Plural";
                            break;
                        }
                        hor.Children.Add(new Label {
                            Content = $"{header}:", FontSize = 14, FontWeight = FontWeights.Bold
                        });
                        hor.Children.Add(new TextBlock {
                            Text = _proxy.GetItemPropertyAsync(item, dataType, property).Result, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Justify, Margin = new Thickness(5)
                        });
                        st.Children.Add(hor);
                    }
                }));
            }))
            {
                IsBackground = true
            };

            thd.Start();
        }
 public string Map(PageData pageData, PropertyData propertyData)
 {
     return propertyData.ToString();
 }
 public string Map(PageData pageData, PropertyData propertyData)
 {
     return string.Format("\"{0}\"", Utils.EscapeStringForJs(propertyData.ToString()));
 }
 public string Map(PageData pageData, PropertyData propertyData)
 {
     return propertyData.Value == null ? "-1" : propertyData.ToString();
 }