// present data private void show() { // clear screen clearScreen(); // show data int line = 0; foreach (var list in data) { Consolex.setXY(rootX + 5, rootY + line); foreach (var item in list) { // show all in one line Consolex.write(dirx.FileDirInfo.getLeastPath(item)); Consolex.write("\t"); } // next line Consolex.write("\n"); line++; } // remember last x,y lastX = Consolex.getX(); lastY = Consolex.getY(); // show cursor showCursor(); // go to last x,y Consolex.setXY(lastX, lastY + 1); }
private void clearScreen() { // Console.Clear(); // go to root x,y Consolex.setXY(rootX, rootY); // loop clear until reach last x,y for (int i = rootY; i < lastY; i++) { for (int j = 0; j < dirx.Config.json["maxClearCharacter"]; j++) { Consolex.write(" "); } } }
public SimpleGui() { // read data from config file // header title // init data data = new List <string[]>(); selectedIndex = -1; // get console rootX = Consolex.getX(); rootY = Consolex.getY(); lastX = rootX; lastY = rootY; // cursor cursorIndex = -1; }
private void showCursor() { // get cursor from config file string cursor = dirx.Config.json["cursor"]; // clear first if (isValidIndex(cursorIndex)) { Consolex.setXY(rootX, rootY + cursorIndex); for (int i = 0; i < cursor.Length; i++) { Consolex.write(" "); } } // show cursor Consolex.setXY(rootX, rootY + selectedIndex); Consolex.write(cursor); // save cursor index cursorIndex = selectedIndex; }
public void Dispose() { // move cursor to the end Consolex.setXY(lastX, lastY); }