protected override void WndProc(ref Message m) { switch (m.Msg) { case Win32FunctionHelper.MouseMove.WM_MOVING: case Win32FunctionHelper.MouseMove.WM_SIZING: { if (this.Visible) { RECT prc = (RECT)m.GetLParam(typeof(RECT)); if (this.m_isMiniMode == true && this.m_isUsingSystemTrayMode == false) { Screen currentScreen = Screen.FromPoint(this.Location); int currentLeft = currentScreen.WorkingArea.Right - 64; Win32FunctionHelper.SetWindowPos(m.HWnd, (IntPtr)Win32FunctionHelper.CmdShow.HWND_TOP, currentLeft, prc.Top, 64, prc.Bottom - prc.Top, 0); } else { Win32FunctionHelper.SetWindowPos(m.HWnd, (IntPtr)Win32FunctionHelper.CmdShow.HWND_TOP, prc.Left, prc.Top, prc.Right - prc.Left, prc.Bottom - prc.Top, 0); } } } break; default: break; } base.WndProc(ref m); }
void TickIdleTimer(object sender, EventArgs e) { this.m_idleCount++; if (m_idleCount > 10) { if (this.m_usedEmptyWorkingSetCheck) { return; } Win32FunctionHelper.EmptyWorkingSet(); m_usedEmptyWorkingSetCheck = true; } if (m_idleCount > 5) { if (m_usedRecuceMemoryCheck) { return; } Win32FunctionHelper.ReduceMemory(); m_usedRecuceMemoryCheck = true; } else if (m_firstReduceMemoryCheck == false) { Win32FunctionHelper.ReduceMemoryAtFirstTime(); m_firstReduceMemoryCheck = true; } }
private void BIStatusBar_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button.Equals(MouseButtons.Left)) { Win32FunctionHelper.ReleaseCapture(); Win32FunctionHelper.SendMessage(Handle, Win32FunctionHelper.MouseMove.WM_NCLBUTTONDOWN, Win32FunctionHelper.MouseMove.HT_CAPTION, 0); } }
public static void ReduceMemory() { GC.Collect(); GC.WaitForPendingFinalizers(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { IntPtr handle = System.Diagnostics.Process.GetCurrentProcess().Handle; Win32FunctionHelper.SetProcessWorkingSetSize(handle, 6 * 1024 * 1024, 30 * 1024 * 1024); } }
public static void EmptyWorkingSet() { GC.Collect(); GC.WaitForPendingFinalizers(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { IntPtr handle = System.Diagnostics.Process.GetCurrentProcess().Handle; Win32FunctionHelper.EmptyWorkingSet(handle); } }
//@} #region The shadowed Show() public new void Show() { if (this.Handle == IntPtr.Zero) base.CreateControl(); Win32FunctionHelper.SetParent(base.Handle, IntPtr.Zero); Win32FunctionHelper.ShowWindow( base.Handle, Win32FunctionHelper.CmdShow.SW_SHOWNOACTIVATE); this.Visible = true; }
public void InvisibleShow() { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(this.InvisibleShow)); } else { Win32FunctionHelper.ShowWindow( base.Handle, Win32FunctionHelper.CmdShow.SW_HIDE); } }
//@} #region The shadowed Show() /// <summary> /// The shadowed Show() method. /// In order to be compatible with some softwares, we must apply some /// extra property to the candidate window to let the canidate window /// could be able to be on the top of other windows. For example, /// Yahoo! Messanger and Yahoo! Widget may take over the focus and /// cover the candidate window. /// </summary> public new void Show() { if (base.Visible == true) { return; } if (this.InvokeRequired) { this.Invoke(new MethodInvoker(this.Show)); } else { if (this.m_isSetAlwaysOnTop == false) { Win32FunctionHelper.ShowWindowTopMost(base.Handle); this.m_isSetAlwaysOnTop = true; } base.Visible = true; } }
protected override void WndProc(ref Message m) { switch (m.Msg) { case Win32FunctionHelper.MouseMove.WM_MOVING: case Win32FunctionHelper.MouseMove.WM_SIZING: { if (this.Visible) { RECT prc = (RECT)m.GetLParam(typeof(RECT)); Win32FunctionHelper.SetWindowPos(m.HWnd, (IntPtr)Win32FunctionHelper.CmdShow.HWND_TOP, prc.Left, prc.Top, prc.Right - prc.Left, prc.Bottom - prc.Top, 0); } } break; default: break; } base.WndProc(ref m); }
/// <summary> /// The shadowed Show() /// </summary> public new void Show() { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(this.Show)); return; } BIServerConnector callback = BIServerConnector.SharedInstance; if (callback != null) { // Get the color schema of the canidate window. if (callback.hasLoaderConfigKey("HighlightColor")) { string colorString = callback.stringValueForLoaderConfigKey("HighlightColor"); if (colorString.Equals("Green")) { this.m_hilightColor = Color.Green; this.m_hilightEndColor = Color.DarkGreen; } else if (colorString.Equals("Yellow")) { this.m_hilightColor = Color.Yellow; this.m_hilightEndColor = Color.DarkOrange; } else if (colorString.Equals("Red")) { this.m_hilightColor = Color.Red; this.m_hilightEndColor = Color.DarkRed; } else if (colorString.StartsWith("Color ")) { string aString = colorString.Remove(0, 6); Color aColor = Color.FromArgb(Int32.Parse(aString)); this.m_hilightColor = aColor; this.m_hilightEndColor = aColor; } else { this.m_hilightColor = Color.FromArgb(140, 91, 156); this.m_hilightEndColor = Color.FromArgb(140, 91, 156); } } if (callback.hasLoaderConfigKey("BackgroundColor")) { string colorString = callback.stringValueForLoaderConfigKey("BackgroundColor"); if (colorString.Equals("White")) { this.m_backgroundColor = Color.White; this.m_patternColor = Color.LightGray; } else if (colorString.StartsWith("Color ")) { string aString = colorString.Remove(0, 6); Color aColor = Color.FromArgb(Int32.Parse(aString)); this.m_backgroundColor = aColor; int r = aColor.R - 32; if (r < 0) { r = 0; } int g = aColor.G - 32; if (g < 0) { g = 0; } int b = aColor.B - 32; if (b < 0) { b = 0; } this.m_patternColor = Color.FromArgb(r, g, b); } else { this.m_backgroundColor = Color.Black; this.m_patternColor = Color.FromArgb(32, 32, 32); } } if (callback.hasLoaderConfigKey("TextColor")) { string colorString = callback.stringValueForLoaderConfigKey("TextColor"); if (colorString.Equals("Black")) { this.m_foregroundColor = Color.Black; } else if (colorString.StartsWith("Color ")) { string aString = colorString.Remove(0, 6); Color aColor = Color.FromArgb(Int32.Parse(aString)); this.m_foregroundColor = aColor; } else { this.m_foregroundColor = Color.White; } } if (callback.hasLoaderConfigKey("BackgroundPattern")) { string patternString = callback.stringValueForLoaderConfigKey("BackgroundPattern"); if (patternString.Equals("true")) { this.m_usePattern = true; } else { this.m_usePattern = false; } } else { this.m_usePattern = false; } } // The Candidate Window should be always on top. Win32FunctionHelper.ShowWindowTopMost(base.Handle); base.Visible = true; }