void OnWindowClosed(object sender, EventArgs e) { if (windows.Count == 1) { ActiveDocument = null; } UnsubscribeWindow(WindowProxy.GetWindowSurrogate(sender)); }
public void WindowProxyTest() { Window w = new Window(); var ws1 = WindowProxy.GetWindowSurrogate(w); var ws2 = WindowProxy.GetWindowSurrogate(w); Assert.AreSame(ws1, ws2); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(ActualWindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; InitializeDocumentContainer(window.RealWindow, Window.ContentProperty, WindowStyle); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; if (AllowSetWindowOwner && AssociatedObject != null) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } return(window); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; if (SetWindowOwner) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } Style windowStyle = GetDocumentContainerStyle(window.RealWindow, view, WindowStyle, WindowStyleSelector); InitializeDocumentContainer(window.RealWindow, Window.ContentProperty, windowStyle); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; return(window); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType ?? DefaultWindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; window.RealWindow.Style = WindowStyle; #if !SILVERLIGHT window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; if (AllowSetWindowOwner && AssociatedObject != null) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } #endif return(window); }
protected virtual IWindowSurrogate CreateWindow(object view) { IWindowSurrogate window = WindowProxy.GetWindowSurrogate(Activator.CreateInstance(WindowType)); UpdateThemeName(window.RealWindow); window.RealWindow.Content = view; #if SILVERLIGHT window.RealWindow.Style = WindowStyle; #else if (SetWindowOwner) { window.RealWindow.Owner = Window.GetWindow(AssociatedObject); } window.RealWindow.Style = GetDocumentContainerStyle(window.RealWindow, view, WindowStyle, WindowStyleSelector); window.RealWindow.WindowStartupLocation = this.WindowStartupLocation; #endif return(window); }
//private const int WS_EX_COMPOSITED = 0x02000000; //protected override CreateParams CreateParams //{ // get // { // CreateParams cp = base.CreateParams; // cp.ExStyle |= WS_EX_COMPOSITED; // return cp; // } //} private Browser() { //by default browser is a parent control for all other controls, windows, iframes, canvases, etc. Size = _defaultSize; Visible = true; SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); Name = "Browser"; _window = new WindowProxy(); _window.innerHeight = Size.Width; _window.innerWidth = Size.Height- 25; _window.Left = 0; _window.Top = 0; //BackColor = Color.Green; (_window.GetRealObject() as UserControl).BackColor = Color.White; Controls.Add(_window.GetRealObject() as UserControl); }
public virtual MessageBoxResult ShowDialog() { return(ConvertDialogResult(WindowProxy.GetWindowSurrogate(Target).ShowDialog())); }
/// <summary> /// Add child node to the object /// </summary> /// <param name="child"></param> public void appendChild(object child) { UserControl control = null; if (child is UserControl) { control = (UserControl) child; } if (child is ICanvasProxy) { control = ((ICanvasProxy) child).RealObject as UserControl; } if(child is IFrame) { IFrame frame = (IFrame)child; WindowProxy wndProxy = new WindowProxy(); wndProxy.innerHeight = frame.getAttribute<int>("height"); wndProxy.innerWidth = frame.getAttribute<int>("width"); //todo: add coordinates parameters to the ad/iframe wndProxy.Left = 0; wndProxy.Top = 0; //reference to pagead.dll //todo: pass canvas_ad_client - reference to specific ad assembly var adPath = frame.getAttribute<string>("canvas_ad_client"); //window.onload = new LoadAssemblyHandler(delegate() // { // //Uri uri = new Uri(adPath); // //AssemblyLoader assemblyLoader = new AssemblyLoader(uri); // //assemblyLoader.Load(); // //todo: get loaded assembly and find startPoint class, create isntance of it, initialize document and window props // }); wndProxy.parentWindow = frame.ParentWindow; wndProxy.src = frame.getAttribute<string>("src"); control = wndProxy.GetRealObject() as UserControl; } if (control != null) { //(control as UserControl).BackColor = colors[i++]; Controls.Add(control); //keep internal childNodes collection up to date. if (control is INode) { _childNodes.Add((INode)control); } if (control is IHTMLElementBase) { ((IHTMLElementBase)control).SetParent(this); if (control is IHTMLCanvasElement) { int newIndex = 999 - ((IHTMLCanvasElement) control).style.zIndex; int normalizedIndex = Browser.Instance.GetRelativeZIndex(newIndex); this.SuspendLayout(); this.Controls.SetChildIndex(control, normalizedIndex); this.ResumeLayout(true); this.Refresh(); } } } }
public object createElement(string tagName) { tagName = tagName.ToUpper(); object element; switch (tagName) { case "CANVAS": { element = new CanvasProxy(); //CloneEvents(element, this._events); break; } case "WINDOW": { element = new WindowProxy(this); break; } case "IFRAME": { element = new IFrame(this._parentWindow); break; } default: { element = new HTMLElement(tagName, this); ((HTMLElement)element).SetParent(this); //this.appendChild((HTMLElement)element); break; } } return element; }