private ConsoleWindow() { this.Width = AppRoot.MainWindowWidth; this.Height = AppRoot.MainWindowHeight; InitializeComponent(); this.Loaded += (sender, e) => { _thisWindowHandle = new WindowInteropHelper(this).Handle; IntPtr console = NTMinerConsole.GetOrAlloc(); SafeNativeMethods.SetWindowLong(console, SafeNativeMethods.GWL_STYLE, SafeNativeMethods.WS_VISIBLE); SafeNativeMethods.SetParent(console, _thisWindowHandle); hwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; hwndSource.AddHook(new HwndSourceHook(WndProc)); if (AppUtil.IsHotKeyEnabled) { HotKeyUtil.RegHotKey = (key) => { if (!RegHotKey(key, out string message)) { VirtualRoot.Out.ShowError(message, autoHideSeconds: 4); return(false); } else { VirtualRoot.Out.ShowSuccess($"热键Ctrl + Alt + {key.ToString()} 设置成功"); return(true); } }; } }; // 延迟展示从而避免不需要展示红字的时候看到红字 VirtualRoot.AddOnecePath <HasBoot1SecondEvent>("启动一会后显式指引解决WindowsZoomBug的一行红字", LogEnum.None, action: message => { LbtnWindowsZoomBug.Visibility = Visibility.Visible; }, pathId: PathId.Empty, this.GetType()); }
private ConsoleWindow() { this.Width = AppRoot.MainWindowWidth; this.Height = AppRoot.MainWindowHeight; InitializeComponent(); this.Loaded += (sender, e) => { _thisWindowHandle = new WindowInteropHelper(this).Handle; IntPtr console = NTMinerConsole.GetOrAlloc(); SafeNativeMethods.SetWindowLong(console, SafeNativeMethods.GWL_STYLE, SafeNativeMethods.WS_VISIBLE); SafeNativeMethods.SetParent(console, _thisWindowHandle); hwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; hwndSource.AddHook(new HwndSourceHook(Win32Proc.WindowProc)); }; }
private ConsoleWindow() { this.Width = AppRoot.MainWindowWidth; this.Height = AppRoot.MainWindowHeight; InitializeComponent(); this.Loaded += (sender, e) => { _thisWindowHandle = new WindowInteropHelper(this).Handle; IntPtr console = NTMinerConsole.GetOrAlloc(); SafeNativeMethods.SetWindowLong(console, SafeNativeMethods.GWL_STYLE, SafeNativeMethods.WS_VISIBLE); SafeNativeMethods.SetParent(console, _thisWindowHandle); hwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; hwndSource.AddHook(new HwndSourceHook(Win32Proc.WindowProc)); }; // 延迟展示从而避免不需要展示红字的时候看到红字 VirtualRoot.AddOnecePath <HasBoot1SecondEvent>("启动一会后显式指引解决WindowsZoomBug的一行红字", LogEnum.None, action: message => { LbtnWindowsZoomBug.Visibility = Visibility.Visible; }, pathId: PathId.Empty, this.GetType()); }
private ConsoleWindow() { this.Width = AppRoot.MainWindowWidth; this.Height = AppRoot.MainWindowHeight; InitializeComponent(); this.Loaded += (sender, e) => { _thisWindowHandle = new WindowInteropHelper(this).Handle; IntPtr console = NTMinerConsole.GetOrAlloc(); SafeNativeMethods.SetWindowLong(console, SafeNativeMethods.GWL_STYLE, SafeNativeMethods.WS_VISIBLE); SafeNativeMethods.SetParent(console, _thisWindowHandle); hwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; hwndSource.AddHook(new HwndSourceHook(Win32Proc.WindowProc)); }; 2.SecondsDelay().ContinueWith(t => { UIThread.Execute(() => { this.TbDescription.Visibility = Visibility.Visible; }); }); }