/// <summary> /// Maintains performance while updating. /// </summary> /// <remarks> /// <para> /// It is recommended to call this method before doing /// any major updates that you do not wish the user to /// see. Remember to call EndUpdate when you are finished /// with the update. Nested calls are supported. /// </para> /// <para> /// Calling this method will prevent redrawing. It will /// also setup the event mask of the underlying richedit /// control so that no events are sent. /// </para> /// </remarks> public void BeginUpdate() { // Deal with nested calls. ++updating; if (updating > 1) return; // Prevent the control from raising any events. oldEventMask = Win32Helper.SendMessage(this.Handle.ToInt32(), Win32Helper.EM_SETEVENTMASK, 0, 0); // Prevent the control from redrawing itself. Win32Helper.SendMessage(this.Handle.ToInt32(), Win32Helper.WM_SETREDRAW, 0, 0); }
/// <summary> /// Processs the telnet. /// </summary> /// <param name="bytes">Bytes yo process</param> internal byte[] ProcessTelnet(byte[] bytes) { byte[] to = new byte[bytes.Length]; int i = 0; int pos = 0; while (i < bytes.Length) { byte b = bytes[i]; switch (b) { case BELL: { if (main.Config.BellSound != null) { Win32Helper.PlaySound(main.Config.BellSound); } else { Win32Helper.PlaySoundEvent("SystemAsterisk"); } ++i; break; } case IAC: { //MessageBox.Show("In IAC"); ++i; if (i < bytes.Length) { b = bytes[i]; switch (b) { case WILL: { ++i; if (i < bytes.Length) { b = bytes[i]; switch (b) { case TELOPT_ECHO: { //FIXME main.Echo = false; ++i; break; } } } break; } case WONT: { ++i; if (i < bytes.Length) { b = bytes[i]; switch (b) { case TELOPT_ECHO: { //FIX ME main.Echo = true; ++i; break; } } } break; } } } break; } //case IAC default: { to[pos++] = bytes[i++]; break; } } //switch(b) } //while return(to); }
/// <summary> /// Scrolls to the bottom. /// </summary> public void ScrollToBottom() { Win32Helper.SendMessage(this.Handle.ToInt32(), Win32Helper.WM_VSCROLL, Win32Helper.SB_BOTTOM, 1); }
private void btnPlay_Click(object sender, EventArgs e) { Win32Helper.PlaySound(txtBellSound.Text); }