/// <summary> /// Only write console screen /// </summary> /// <param name="text">Entered Value</param> /// <param name="consoleWriteType">Write Type</param> public static void WriteConsole(string text, ConsoleWriteType consoleWriteType) { switch (consoleWriteType) { case ConsoleWriteType.I: Console.Write(text); break; case ConsoleWriteType.N: Console.WriteLine(text); break; default: break; } }
/// <summary> /// a function for use with a delegate to print to console /// </summary> /// <param name="_output">the string to send out</param> /// <param name="_Type">the console to target</param> void _PrintBotStatusOut(string _output, ConsoleWriteType _Type = ConsoleWriteType.Basic) { // based on selected console(app has three) switch (_Type) { case ConsoleWriteType.BotStatus: //invoke a second delegate from this thread to avoid a cross thread violation to Append on a line Invoke(new Action(() => { _RTB_BotStatusOut.AppendText(_output + "\n"); })); break; case ConsoleWriteType.Basic: Invoke(new Action(() => { _RTB_ConsoleOut.AppendText(_output + "\n"); })); break; case ConsoleWriteType.ServerInfo: Invoke(new Action(() => { _RTB_ServerInfoOut.AppendText(_output + "\n"); })); break; } }
/// <summary> /// a function for use with a delegate to clear a console /// </summary> /// <param name="_Type">the type of console to use</param> void _ClearConsole(ConsoleWriteType _Type = ConsoleWriteType.Basic) { // based on selected console(app has three) switch (_Type) { case ConsoleWriteType.BotStatus: //invoke a second delegate from this thread to avoid a cross thread violation to clear Invoke(new Action(() => { _RTB_BotStatusOut.Clear(); })); break; case ConsoleWriteType.Basic: Invoke(new Action(() => { _RTB_ConsoleOut.Clear(); })); break; case ConsoleWriteType.ServerInfo: Invoke(new Action(() => { _RTB_ServerInfoOut.Clear(); })); break; } }
/// <summary> /// Clears a console /// </summary> /// <param name="_type">the console to clear</param> void ClearConsole(ConsoleWriteType _type = ConsoleWriteType.Basic) { _ControlPannel?.ClearConsole?.Invoke(_type); }
/////////////////////////////////////////////////////////////////////////////utility////////////////////////////////////////////////////////// /// <summary> /// writes to a console /// </summary> /// <param name="_output">the string to put out</param> /// <param name="_Type">the console to actually write to</param> void ConsoleWrite(string _output = "", ConsoleWriteType _Type = ConsoleWriteType.Basic) { _ControlPannel?.ConsoleWrite?.Invoke(_output, _Type); }