private void wnd_main_KeyDown(object sender, KeyEventArgs e) { if (counter < AdminCode.Count() - 1) { if (e.Key == AdminCode[counter]) { counter++; } else { counter = 0; } } else { /// Admin Code activated AdminWindow adminwnd = new AdminWindow(this); adminwnd.Show(); } }
public MainWindow() { InitializeComponent(); setAdminCode(); AdminWindow outputWindow = new AdminWindow(this); for (int i = 0; i < 5; i++) { CurrentGroup.Members.Add(new Person("P" + i, "P" + i, "P" + i)); } try { localConnection.Open(); Console.WriteLine("Connected to -" + localConnection.Database + "- Database"); } catch (Exception e) { Console.WriteLine(e.ToString()); } // TODO load all people SQLCommandBuilder SQLCmd = new SQLCommandBuilder(localConnection); SQLCmd.buildSQLStatement ( SQLCommandType.Select, "Person" ); using (SqlDataReader reader = SQLCmd.Command.ExecuteReader()) { CurrentGroup.Members.Clear(); while (reader.Read()) { CurrentGroup.Members.Add(new Person(reader.GetString(1), reader.GetString(2), reader.GetString(3))); } } //connectDataView(); }