public static TWindow CreateExternalWindow <TWindow>(Func <TWindow> instanceCreator, string className, bool takeOwnership = true, string text = null, WindowStyles?styles = null, WindowExStyles?exStyles = null, int?x = null, int?y = null, int?width = null, int?height = null, IntPtr?hParent = null, IntPtr?hMenu = null, IntPtr?hInstance = null, IntPtr?extraParams = null, uint?controlStyles = null, IConstructionParams constructionParams = null) where TWindow : WindowCore { if (string.IsNullOrWhiteSpace(className)) { throw new ArgumentException("className is not valid"); } if (constructionParams == null) { constructionParams = new ConstructionParams(); } return(CreateExternalWindowCore( instanceCreator, takeOwnership, className, text, styles ?? constructionParams.Styles, exStyles ?? constructionParams.ExStyles, x ?? constructionParams.X, y ?? constructionParams.Y, width ?? constructionParams.Width, height ?? constructionParams.Height, hParent ?? constructionParams.ParentHandle, hMenu ?? constructionParams.MenuHandle, hInstance ?? Cache.Instance.ProcessHandle, extraParams ?? IntPtr.Zero, controlStyles ?? constructionParams.ControlStyles)); }
public TWindow CreateWindow <TWindow>(Func <TWindow> instanceCreator, string text = null, WindowStyles?styles = null, WindowExStyles?exStyles = null, int?x = null, int?y = null, int?width = null, int?height = null, IntPtr?hParent = null, IntPtr?hMenu = null, uint?controlStyles = null, IConstructionParams constructionParams = null) where TWindow : WindowCore { var win = instanceCreator(); return(this.CreateWindowInnerCore(win, text, styles, exStyles, x, y, width, height, hParent, hMenu, controlStyles, constructionParams)); }
/// <summary> /// Another helper for `Window` class, since its conceptually slightly special. /// This allows any TWindow type to be created, whether or not they implement the /// IConstructionParamsProvider to help with construction. This is purely a helper /// to facilitate such a scenario. /// </summary> public static TWindow CreateWith <TWindow>(IConstructionParams constructionParams = null, string text = null, WindowStyles?styles = null, WindowExStyles?exStyles = null, int?x = null, int?y = null, int?width = null, int?height = null, IntPtr?hParent = null, IntPtr?hMenu = null, WindowFactory factory = null, uint?controlStyles = null) where TWindow : WindowCore, new() { return((factory ?? ClassFactory.Value).CreateWindow(() => new TWindow(), text, styles, exStyles, x, y, width, height, hParent, hMenu, controlStyles, constructionParams)); }
private TWindow CreateWindowInnerCore <TWindow>(TWindow instance, string text, WindowStyles?styles, WindowExStyles?exStyles, int?x, int?y, int?width, int?height, IntPtr?hParent, IntPtr?hMenu, uint?controlStyles, IConstructionParams constructionParams) where TWindow : WindowCore { if (constructionParams == null) { constructionParams = new ConstructionParams(); } return(this.CreateWindowCoreFromInstance(instance, text, styles ?? constructionParams.Styles, exStyles ?? constructionParams.ExStyles, x ?? constructionParams.X, y ?? constructionParams.Y, width ?? constructionParams.Width, height ?? constructionParams.Height, hParent ?? constructionParams.ParentHandle, hMenu ?? constructionParams.MenuHandle, controlStyles ?? constructionParams.ControlStyles)); }