Exemplo n.º 1
0
 private ModelPropertyBinder(string propertyName, Type modelPropertyBinderActionType, string selector, ModelPropertyBinder parent)
 {
     _propertyName = propertyName;
     _modelPropertyBinderActionType = modelPropertyBinderActionType;
     _selector = selector;
     _parent = parent;
     _childs = new List<ModelPropertyBinder>();
 }
Exemplo n.º 2
0
        public ModelPropertyBinder ModelBinder5()
        {
            ModelPropertyBinder child = null, mainBinder = null;

            ModelPropertyBinder binder = mainBinder = new ModelPropertyBinder();
            binder.SetDocument(new DomDocument(_sampleHtml));

            binder = binder.AddChildBinder(null, typeof(ModelPropertyBinderAction), "#_container");

            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#_MiddleMain");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.container_24");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#_Middle1_2.news-detail-content.turkiye-br");
            binder = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "#news-content-contain");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.content-area");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "h1");
            child.AddChildBinder("title", typeof(HtmlPropertyBinderAction), "");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.content-area");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "h5");
            child.AddChildBinder("summary", typeof(HtmlPropertyBinderAction), "");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#metin2");
            child = child.AddChildBinder("contentList", typeof(CollectionPropertyBinderAction), "p");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "");
            child.AddChildBinder("content", typeof(HtmlPropertyBinderAction), "");
            
            return mainBinder;
        }
Exemplo n.º 3
0
        public object ModelBinder4()
        {
            ModelPropertyBinder child = null, mainBinder = null;
            ModelPropertyBinder binder = mainBinder = new ModelPropertyBinder();
            binder.SetDocument(new DomDocument(_sampleHtml));

            binder = binder.AddChildBinder(null, typeof(ModelPropertyBinderAction), "#news-content-contain");

            child = binder.AddChildBinder("contentList", typeof(CollectionPropertyBinderAction), "div#metin2 p");
            child = child.AddChildBinder("", typeof(CollectionPropertyBinderAction), "strong");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "");
            child.AddChildBinder("content", typeof(HtmlPropertyBinderAction), "");

            mainBinder.Execute();

            return mainBinder.Model;
        }
Exemplo n.º 4
0
        public object ModelBinder2()
        {
            ModelPropertyBinder child = null;
            ModelPropertyBinder mainBinder = new ModelPropertyBinder();
            mainBinder.SetDocument(new DomDocument(_sampleHtml));

            ModelPropertyBinder binder = mainBinder.AddChildBinder(null, typeof(ModelPropertyBinderAction), "#news-content-contain");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div.content-area");
            child.AddChildBinder("title", typeof(HtmlPropertyBinderAction), "h1");
            child.AddChildBinder("summary", typeof(HtmlPropertyBinderAction), "h5");

            child = binder.AddChildBinder("", typeof(ModelPropertyBinderAction), "div#metin2");
            child = child.AddChildBinder("contentList", typeof(CollectionPropertyBinderAction), "p");
            child = child.AddChildBinder("", typeof(ModelPropertyBinderAction), "");
            child.AddChildBinder("content", typeof(HtmlPropertyBinderAction), "");

            mainBinder.Execute();

            return binder.Model;
        }
Exemplo n.º 5
0
 internal void SetParentDetail(ModelPropertyBinder parent)
 {
     _parent = parent;
     _parentDomElement = parent.DomElement;
     _parentModel = parent.Model;
 }
Exemplo n.º 6
0
 private ModelPropertyBinder(string propertyName, Type modelPropertyBinderActionType, string selector, string attribute, ModelPropertyBinder parent) : this(propertyName, modelPropertyBinderActionType, selector, parent)
 {
     _attribute = attribute;
 }
Exemplo n.º 7
0
 private ModelPropertyBinder(string propertyName, Type modelPropertyBinderActionType, string selector, string attribute, ModelPropertyBinder parent, List<ModelPropertyBinder> childs, IDomElement parentDomElement) : this(propertyName, modelPropertyBinderActionType, selector, attribute, parent)
 {
     _parentDomElement = parentDomElement;
     _childs = childs;
 }
Exemplo n.º 8
0
 public ModelPropertyBinder AddChildBinder(string propertyName, Type modelPropertyBinderActionType, string selector, string attribute)
 {
     var childBinder = new ModelPropertyBinder(propertyName, modelPropertyBinderActionType, selector, attribute, this);
     _childs.Add(childBinder);
     return childBinder;
 }