public enum RichTextBoxCommand
{
AppendText,
ScrollToCaret
}
public delegate void DelegateRichTextBox(RichTextBox rebTextBox, RichTextBoxCommand command, String sAppendText);
public DelegateRichTextBox dgRichText;
public void SetRichTextBox(RichTextBox rebTextBox, RichTextBoxCommand command, String sAppendText)
{
switch (command)
{
case RichTextBoxCommand.AppendText:
rebTextBox.AppendText(sAppendText);
break;
case RichTextBoxCommand.ScrollToCaret:
rebTextBox.ScrollToCaret();
break;
default:
break;
}
rebTextBox.ScrollToCaret();
}
public void MoveTextBoxScroll()
{
txtChatBox.ScrollToCaret();
}
public enum ListBoxCommand
{
Add,
AddRange,
Remove,
Clear
}
public delegate void DelegateListItem(ListBox lstListBox, ListBoxCommand command, String sItem, String[] arrItems);
public DelegateListItem ListItemDelegate;
public void SetListBox(ListBox lstListBox, ListBoxCommand command, String sItem, String[] arrItems)
{
switch (command)
{
case ListBoxCommand.Add:
lstListBox.Items.Add(sItem);
break;
case ListBoxCommand.AddRange:
lstListBox.Items.Clear();
lstListBox.Items.AddRange(arrItems);
lstListBox.Items.RemoveAt(lstListBox.Items.Count - 1);
break;
case ListBoxCommand.Remove:
lstListBox.Items.Remove(sItem);
break;
case ListBoxCommand.Clear:
lstListBox.Items.Clear();
break;
default:
break;
}
}