Remote shell refactor

This commit is contained in:
d3agle 2015-09-05 12:16:10 -05:00
parent 6c582ff763
commit 567d9dc2f5
2 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,9 @@ public static class NativeMethodsHelper
private const int LVM_FIRST = 0x1000; private const int LVM_FIRST = 0x1000;
private const int LVM_SETITEMSTATE = LVM_FIRST + 43; private const int LVM_SETITEMSTATE = LVM_FIRST + 43;
private const int WM_VSCROLL = 277;
private const int SB_PAGEBOTTOM = 7;
public static int MakeLong(int wLow, int wHigh) public static int MakeLong(int wLow, int wHigh)
{ {
int low = (int)IntLoWord(wLow); int low = (int)IntLoWord(wLow);
@ -31,5 +34,10 @@ public static void SetItemState(IntPtr handle, int itemIndex, int mask, int valu
}; };
NativeMethods.SendMessageLVItem(handle, LVM_SETITEMSTATE, itemIndex, ref lvItem); NativeMethods.SendMessageLVItem(handle, LVM_SETITEMSTATE, itemIndex, ref lvItem);
} }
public static void ScrollToBottom(IntPtr handle)
{
NativeMethods.SendMessage(handle, WM_VSCROLL, SB_PAGEBOTTOM, 0);
}
} }
} }

View File

@ -3,7 +3,6 @@
using System.Drawing; using System.Drawing;
using xServer.Core.Helper; using xServer.Core.Helper;
using xServer.Core.Networking; using xServer.Core.Networking;
using xServer.Core.Utilities;
namespace xServer.Forms namespace xServer.Forms
{ {
@ -44,7 +43,7 @@ private void FrmRemoteShell_FormClosing(object sender, FormClosingEventArgs e)
private void txtConsoleOutput_TextChanged(object sender, EventArgs e) private void txtConsoleOutput_TextChanged(object sender, EventArgs e)
{ {
NativeMethods.SendMessage(txtConsoleOutput.Handle, 277, 7, 0); NativeMethodsHelper.ScrollToBottom(txtConsoleOutput.Handle);
} }
private void txtConsoleInput_KeyDown(object sender, KeyEventArgs e) private void txtConsoleInput_KeyDown(object sender, KeyEventArgs e)