Пример #1
0
 public ContextProxy(Graphics s, Bitmap bitmap, Pen stroke, IFill fill, bool visible, ICanvasProxy canvasElement)
     : base(Guid.NewGuid())
 {
     _target = new CanvasRenderingContext2D(s, bitmap, stroke, fill, visible, canvasElement);
     _target.OnPartialDraw += new OnPartialDrawHanlder(_target_OnPartialDraw);
     //////////
     // Add all members with dispids from the concrete type
     //////////
     base.AddIntrinsicMembers();
     _canvasElement = canvasElement;
 }
Пример #2
0
 public HTMLCanvasElement(ICanvasProxy proxy)
 {
     //by default timer for surface update is disabled
     timer.Enabled = false;
     Paint += HTMLCanvasElement_Paint;
     //Resize += HTMLCanvasElement_Resize;
     Name = "HTMLCanvasElement";
     _proxy = proxy;
     //style
     _style = new CSSStyleDeclaration(this);
     _style.StyleChanged += new StyleChangedHandler(OnStyleChanged);
 }
 public CanvasRenderingContext2D(Graphics s, Bitmap bitmap, Pen stroke, IFill fill, bool visible, ICanvasProxy canvasElement)
     : this(s, bitmap, stroke, fill, visible)
 {
     _canvasElement = canvasElement;
 }
Пример #4
0
 /// <summary>
 /// Factory method returns appropriate HTMLCanvasElement instance, dependent on loaded framework version
 /// </summary>
 /// <returns></returns>
 public IHTMLCanvasElement CreateCanvasElement(ICanvasProxy proxy)
 {
     Assembly assembly = GetAssembly();
     if (assembly != null)
     {
         if (_currentTypeFactory == null)
         {
             _currentTypeFactory = assembly.GetType(string.Format("{0}.HTMLCanvasElement", GetNamespace()));
             if (_currentTypeFactory == null) return null;
         }
         //TODO: make proxy optional?
         IHTMLCanvasElement element = Activator.CreateInstance(_currentTypeFactory, proxy) as IHTMLCanvasElement;
         return element;
     }
     return null;
 }
Пример #5
0
 public string GetElementId(ICanvasProxy canvasProxy)
 {
     if(canvasProxy is IReflect)
     {
         MemberInfo[] memberInfos = ((IReflect) canvasProxy).GetMember("id",
                                                                       BindingFlags.Public | BindingFlags.GetProperty |
                                                                       BindingFlags.GetField);
         if(memberInfos.Length > 0)
         {
             MemberInfo idInfo = memberInfos[0];
             if(idInfo is PropertyInfo)
             {
                 return (string)((PropertyInfo)idInfo).GetValue(canvasProxy, BindingFlags.Instance, null, null, null);
             }
         }
     }
     return string.Empty;
 }