protected virtual void CreateCallback(IntPtr window, IntPtr view) { _windowHandle = window; _viewHandle = view; var createdEvent = new CreatedEventArgs(_windowHandle, _viewHandle); HostCreated?.Invoke(this, createdEvent); _isInitialized = true; }
///<summary> ///</summary> ///<param name="port"></param> ///<param name="virtualPath"></param> ///<param name="physicalPath"></param> ///<param name="requireAuthentication"></param> ///<param name="disableDirectoryListing"></param> public Server(int port, string virtualPath, string physicalPath, bool requireAuthentication, bool disableDirectoryListing) { try { Assembly.ReflectionOnlyLoad("Common.Logging"); _useLogger = true; } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { } _ipAddress = IPAddress.Loopback; _requireAuthentication = requireAuthentication; _disableDirectoryListing = disableDirectoryListing; _lockObject = new object(); _port = port; _virtualPath = virtualPath; _physicalPath = Path.GetFullPath(physicalPath); var dirSeparator = Path.DirectorySeparatorChar.ToString(); _physicalPath = _physicalPath.EndsWith(dirSeparator, StringComparison.Ordinal) ? _physicalPath : _physicalPath + dirSeparator; ProcessConfiguration(); string uniqueAppString = string.Concat(virtualPath, physicalPath, ":", _port.ToString()).ToLowerInvariant(); _appId = (uniqueAppString.GetHashCode()).ToString("x", CultureInfo.InvariantCulture); ObtainProcessToken(); _appHosts = new AppHosts(this, _virtualPath, _physicalPath); _appHosts.HostCreated += (s, e) => { if (HostCreated != null) { HostCreated.Invoke(s, e); } }; _appHosts.HostRemoved += (s, e) => { if (HostRemoved != null) { HostRemoved.Invoke(s, e); } }; #if NET40 //m_projMonitor = new HostWatchManager(); //m_projMonitor.AddSolution(@"D:\Users\mantasi\Documents\Visual Studio 2010\Projects\Core\Core.sln"); #endif }
protected virtual void OnRealized(IntPtr window) { try { _xid = GetNativeHandle(); if (_xid == IntPtr.Zero) { throw new Exception("Window XID is invalid"); } var createdEvent = new CreatedEventArgs(window, _xid); HostCreated?.Invoke(this, createdEvent); _isInitialized = true; } catch (Exception exception) { Logger.Instance.Log.LogError("Error in LinuxGtk3Host::OnRealized"); Logger.Instance.Log.LogError(exception); } }
private Host CreateHost(string physicalPath, string virtualPath) { Host host = new Host(); host.Configure(this, Server.Port, virtualPath, physicalPath, Server.RequireAuthentication, Server.DisableDirectoryListing); var output = new KeepAliveTextWriter(OutputWriter ?? Console.Out); var applicationManager = ApplicationManager.GetApplicationManager(); host = CreateWorkerAppDomainWithHost(host); host.SetConsoleOut(output); if (HostCreated != null) { HostCreated.Invoke(this, new HostCreatedEventArgs(virtualPath, physicalPath)); } Console.WriteLine("Host created {0}", virtualPath); return(host); }
protected virtual IntPtr WndProc(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam) { WM wmMsg = (WM)message; switch (wmMsg) { case WM.NCCREATE: { NativeInstance = this; _handle = hWnd; PreCreated(hWnd); break; } case WM.CREATE: { OnCreated(hWnd); var createdEvent = new CreatedEventArgs(_handle, _handle); HostCreated?.Invoke(this, createdEvent); _isInitialized = true; break; } case WM.ERASEBKGND: return(new IntPtr(1)); case WM.NCHITTEST: if (_options.WindowFrameless) { return((IntPtr)HT.CAPTION); } break; case WM.MOVING: case WM.MOVE: { HostMoving?.Invoke(this, new MovingEventArgs()); return(IntPtr.Zero); } case WM.SIZING: case WM.SIZE: { var size = GetClientSize(); OnSizeChanged(size.Width, size.Height); break; } case WM.GETMINMAXINFO: { if (HandleMinMaxSizes(lParam)) { return(IntPtr.Zero); } break; } case WM.CLOSE: { if (_handle != IntPtr.Zero && _isInitialized) { HostClose?.Invoke(this, new CloseEventArgs()); } DetachHooks(); DestroyWindow(_handle); break; } case WM.DESTROY: { if (_options.UseOnlyCefMessageLoop) { CefRuntime.QuitMessageLoop(); } PostQuitMessage(0); break; } default: break; } return(DefWindowProcW(hWnd, wmMsg, wParam, lParam)); }
protected virtual IntPtr WndProc(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam) { WM wmMsg = (WM)message; switch (wmMsg) { case WM.NCCREATE: { NativeInstance = this; _handle = hWnd; PreCreated(hWnd); break; } case WM.CREATE: { OnCreated(hWnd); var createdEvent = new CreatedEventArgs(_handle, _handle); HostCreated?.Invoke(this, createdEvent); _isInitialized = true; break; } case WM.ERASEBKGND: return(new IntPtr(1)); case WM.NCHITTEST: if (_options.WindowFrameless) { return((IntPtr)HT.CAPTION); } break; case WM.MOVING: { HostMoving?.Invoke(this, new MovingEventArgs()); return(IntPtr.Zero); } case WM.MOVE: { var position = new RECT((int)(short)Interop.PARAM.LOWORD(lParam), (int)(short)Interop.PARAM.HIWORD(lParam), 0, 0); var windowStyle = GetWindowStylePlacement(_options.WindowState); Interop.User32.AdjustWindowRectEx(ref position, (int)windowStyle.Styles, BOOL.FALSE, (int)windowStyle.ExStyles); HostMoved?.Invoke(this, new MovedEventArgs(position.X, position.Y)); return(IntPtr.Zero); } case WM.SIZE: { var innerSize = GetClientSize(); var outerSize = new RECT(0, 0, (int)(short)Interop.PARAM.LOWORD(lParam), (int)(short)Interop.PARAM.HIWORD(lParam)); var windowStyle = GetWindowStylePlacement(_options.WindowState); Interop.User32.AdjustWindowRectEx(ref outerSize, (int)windowStyle.Styles, BOOL.FALSE, (int)windowStyle.ExStyles); HandleSizeChanged(innerSize.Width, innerSize.Height, outerSize.Width, outerSize.Height); break; } case WM.GETMINMAXINFO: { if (HandleMinMaxSizes(lParam)) { return(IntPtr.Zero); } break; } case WM.CLOSE: { if (_handle != IntPtr.Zero && _isInitialized) { HostClose?.Invoke(this, new CloseEventArgs()); } DetachHooks(); DestroyWindow(_handle); break; } case WM.DESTROY: { if (_options.UseOnlyCefMessageLoop) { CefRuntime.QuitMessageLoop(); } PostQuitMessage(0); break; } default: break; } return(DefWindowProcW(hWnd, wmMsg, wParam, lParam)); }