private void Cls() { if (!_active) { return; } Opfer.Clear(); _isAtEnd = true; }
private void AppendLine(string line) { if (!_active) { return; } Opfer.AppendText(line); Opfer.AppendText(Environment.NewLine); if (_isAtEnd) { ScrollV.ScrollToEnd(); } }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { _active = true; var vm = DataContext as OutputVM; if (vm == null) { return; } lock (vm) { Opfer.AppendText(vm.GetCurrentBufferedOutput()); vm.OutputReceived += OutputReceived; vm.OutputCleared += OutputCleared; ScrollV.ScrollToEnd(); _isAtEnd = true; } }
private static List <Opfer> CollectVictims(ConsoleLogger logger, MySqlConnection connection) { List <Opfer> victims = new List <Opfer>(); MySqlCommand command = new MySqlCommand("SELECT opfer_id, strasse, hausnummer, geburtsort FROM tbl_st_opfer;", connection); using (MySqlDataReader reader = command.ExecuteReader()) { int col1 = reader.GetOrdinal("opfer_id"); int col2 = reader.GetOrdinal("strasse"); int col3 = reader.GetOrdinal("hausnummer"); int col4 = reader.GetOrdinal("geburtsort"); int counter = 0; while (reader.Read()) { object obj1 = reader.GetValue(col1); object obj2 = reader.GetValue(col2); object obj3 = reader.GetValue(col3); object obj4 = reader.GetValue(col4); int val1 = Convert.ToInt32(obj1); string val2 = obj2 == DBNull.Value ? null : (string)obj2; string val3 = obj3 == DBNull.Value ? null : (string)obj3; string val4 = obj4 == DBNull.Value ? null : (string)obj4; Opfer opfer = new Opfer() { ID = val1, Strasse = val2, Hausnummer = val3, Geburtsort = val4 }; logger.Log($"[{counter}] {opfer.ToString()}"); victims.Add(opfer); counter += 1; } } return(victims); }