コード例 #1
0
        private void AddPropertyEditor(Control container, ContentItem item, PropertyInfo propertyInfo)
        {
            // Add a label.

            string displayName = propertyInfo.Name;

            var attributes = (ContentAttribute[])propertyInfo.GetCustomAttributes(typeof(ContentAttribute), true);

            if (attributes != null && attributes.Length > 0)
            {
                displayName = attributes[0].DisplayName;
            }

            Label label = CreateLabel(displayName);

            // Create an appropriate property editor.

            IContentEditor editor = GetContentEditor(item, propertyInfo.Name);

            _propertyEditors.Add(editor);

            Control panel = CreatePanel();

            editor.AddControls(panel);

            // Add teh combination.

            AddProperty(container, label, panel);
        }
コード例 #2
0
 private void CreateEditor()
 {
     _editor = CreateContentEditor(_item);
     if (_editor != null)
     {
         Controls.Clear();
         _editor.AddControls(this);
     }
 }
コード例 #3
0
        public CanvasForm()
        {
            InitializeComponent();

            factory = new ContentEditorFactory();
            factory.Initialize(@"SOFTWARE\Microsoft\Windows Live\Test Canvas", new CanvasLogger(), new CanvasTarget(), new CanvasSettingsProvider());
            editor = factory.CreateEditor(new CanvasSite(panelCanvas), null, "<html><head></head><body><div>{post-body}</div></body></html>", MshtmlOptions.DEFAULT_DLCTL);
            editor.DisableSpelling();

            panelCanvas.SizeChanged += new EventHandler(panelCanvas_SizeChanged);
        }
コード例 #4
0
        public CanvasForm()
        {
            InitializeComponent();

            factory = new ContentEditorFactory();
            factory.Initialize(@"SOFTWARE\Microsoft\Windows Live\Test Canvas", new CanvasLogger(), new CanvasTarget(), new CanvasSettingsProvider());
            editor = factory.CreateEditor(new CanvasSite(panelCanvas), null, "<html><head></head><body><div>{post-body}</div></body></html>", MshtmlOptions.DEFAULT_DLCTL);
            editor.DisableSpelling();

            panelCanvas.SizeChanged += new EventHandler(panelCanvas_SizeChanged);
        }
コード例 #5
0
        private void loadEditor()
        {
            int editorID          = int.Parse(contentEditorList.SelectedValue);
            ContentEditorInfo cei = Dury.SiteFoundry.Article.ContentEditors.GetContentEditorInfo(editorID);
            IContentEditor    ic  = (IContentEditor)Page.LoadControl("~/nodeTemplates/articleContentEditors/" + cei.Src);

            ic.Height = cei.Height;
            ic.Width  = cei.Width;
            ic.Text   = "hello";
            contentHolder.Controls.Clear();
            contentHolder.Controls.Add((System.Web.UI.UserControl)ic);
        }
コード例 #6
0
ファイル: PipelineHelper.cs プロジェクト: marsat02/engenious
        public static ContentEditorWrapper GetContentEditor(string extension, Type inputType, Type outputType)
        {
            string key = extension + "$" + inputType.FullName + "$" + outputType.FullName;
            ContentEditorWrapper editorWrap = null;

            if (editorsByType.TryGetValue(key, out editorWrap))
            {
                return(editorWrap);
            }
            Type genericType = typeof(IContentEditor <,>).MakeGenericType(inputType, outputType);

            foreach (var type in editors)
            {
                var attribute =
                    (ContentEditorAttribute)type.GetCustomAttributes(typeof(ContentEditorAttribute), true).First();
                if (attribute == null)
                {
                    continue;
                }
                if (attribute.SupportedFileExtensions.Contains(extension) && genericType.IsAssignableFrom(type))
                {
                    IContentEditor editor = (IContentEditor)Activator.CreateInstance(type);
                    if (editor == null)
                    {
                        continue;
                    }
                    var methodInfo = genericType.GetMethod("Open");
                    if (methodInfo == null)
                    {
                        continue;
                    }
                    var inputOArg  = Expression.Parameter(typeof(object));
                    var outputOArg = Expression.Parameter(typeof(object));


                    var openMethod = Expression.Lambda <Action <object, object> >(
                        Expression.Call(Expression.Constant(editor), methodInfo,
                                        Expression.Convert(inputOArg, inputType), Expression.Convert(outputOArg, outputType)),
                        inputOArg, outputOArg).Compile();

                    editorWrap = new ContentEditorWrapper(editor, openMethod);
                    foreach (var ext in attribute.SupportedFileExtensions)
                    {
                        editorsByType[ext + "$" + inputType.FullName + "$" + outputType.FullName] = editorWrap;
                    }
                }
            }

            return(editorWrap);
            //editorsByType[key] =
        }
コード例 #7
0
        private void AddPropertyEditor(Control container, ContentItem item, PropertyInfo propertyInfo, string displayName)
        {
            // Add a label.

            Label label = CreateLabel(displayName);

            // Create an appropriate property editor.

            IContentEditor editor = GetContentEditor(item, propertyInfo);

            _propertyEditors.Add(editor);

            Control panel = CreatePanel();

            editor.AddControls(panel);

            // Add the combination.

            AddProperty(container, label, panel);
        }
コード例 #8
0
ファイル: ContentEditor.cs プロジェクト: formist/LinkMe
        protected static IContentEditor CreateEditor(Type type, object instance, PropertyInfo propertyInfo)
        {
            if (type == null)
            {
                return(null);
            }

            // If the item has a editor then use that.

            IContentEditor editor = ContentManager.GetEditor(type, instance, propertyInfo);

            if (editor != null)
            {
                return(editor);
            }

            // Cannot display.

            return(null);
        }
コード例 #9
0
ファイル: ContentEditor.cs プロジェクト: formist/LinkMe
        public static IContentEditor CreateEditor(ContentItem item)
        {
            if (item == null)
            {
                return(null);
            }

            // If the item has a editor then use that.

            IContentEditor editor = ContentManager.GetEditor(item);

            if (editor != null)
            {
                return(editor);
            }

            // Create an editor for all of the editable properties of the item's type.

            return(new PropertiesContentEditor(item));
        }
コード例 #10
0
	private void SelectContentEditor()
	{
		string editor = Request.QueryString["editor"] ?? BXOptionManager.GetOptionString("main", "EditorDefaultPageEditor", "text");
		if (editor.Equals("visual", StringComparison.InvariantCultureIgnoreCase) && isAspx)
		{
			//prepare visual editor
			Content.ActiveViewIndex = 1;
			contentEditor = new VisualContentEditor(VisualEditor, this);
		}
		else
		{
			//prepare text editor
			Content.ActiveViewIndex = 0;
			contentEditor = new TextBoxContentEditor(TextEditor, this);
		}
	}
コード例 #11
0
 public ContentEditorWrapper(IContentEditor editor, Action <object, object> open)
 {
     Editor = editor;
     Open   = open;
 }