Beispiel #1
0
 public static ServerInterface GetInstance()
 {
     if (_instance == null)
     {
         lock (_instanceLock)
         {
             if (_instance == null)
             {
                 _instance = new ServerInterface();
             }
         }
     }
     return(_instance);
 }
Beispiel #2
0
        private void button_login_Click(object sender, EventArgs e)
        {
            string username = this.textBox_username.Text;
            string password = this.textBox_password.Text;

            if (username == "magie" && password == "wizard")
            {
                this.Hide();
                ServerInterface.GetInstance().SetUsername(username); // authenticated

                form_main mainWindow = new form_main();
                mainWindow.ShowDialog();

                ServerInterface.GetInstance().SetUsername(null); // not authenticated
                this.Show();
            }
            else
            {
                MessageBox.Show("Login fehlgeschlagen! Versuchs nochmal", "Login", MessageBoxButtons.OK);
            }
        }
Beispiel #3
0
 private void button_add_Click(object sender, EventArgs e)
 {
     ServerInterface.GetInstance().SendNewHomework(this.textBox_title.Text, this.textBox_content.Text, this.dateTimePicker_expire.Value);
     MessageBox.Show(this, "Neue Hausaufgaben an den Server gesendet", "Neue Hausaufgaben", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }