private int pwcheck(int i)
        {
            username = textBox_username.Text;
            Boolean logindaten = false, busername = false, bpassword = false;
            try
            {
                using (MD5 md5Hash = MD5.Create())
                {
                    password = GetMd5Hash(md5Hash, passwordBox.Password);
                    da = new MySqlDataAdapter("select * from logindaten where Benutzername='" + username + "' and Passwort='" + password + "' ", connection);
                    da.Fill(dt);
                    if (dt.Rows.Count <= 0)
                    {
                        busername = false;
                        bpassword = false;
                    }
                    else if (dt.Rows.Count > 0)
                    {
                        busername = true;
                        bpassword = true;
                    }
                    dt.Clear();

                    da = new MySqlDataAdapter("select * from logindaten where Benutzername='" + username + "' ", connection);
                    da.Fill(dt);
                    if (logindaten == false)
                        if (dt.Rows.Count <= 0)
                            busername = false;
                        else
                            busername = true;
                    dt.Clear();
                }

                for (int j = 0; j < 1;)
                {
                    if (i < 4)
                    {
                        if (busername == true && bpassword == true)
                        {
                            logindaten = true;
                            j++;
                        }
                        else if (busername == true && bpassword == false)
                        {
                            if (i == 1)
                            {
                                label.Content= "Passwort ist falsch!\nNur noch " + (3 - i) + " versuch.\nBitte erneut eingeben.";
                                textBox_username.Clear();
                                j++;
                            }
                            else if (i == 3)
                            {
                                j++;
                            }
                            else
                            {
                                label.Content = "Passwort ist falsch!\n Nur noch " + (3 - i) + " versuche.\nBitte erneut eingeben.";
                                textBox_username.Clear();
                                j++;
                            }
                            i++;
                        }
                        else if (busername == false)
                        {
                            MessageBox.Show("Benutzername ist nicht bekannt");
                            textBox_username.Clear();
                            passwordBox.Clear();
                            textBox_username.Focus();
                            j++;
                        }
                    }
                }
                if (logindaten == true)
                {
                    MainWindow mw = new MainWindow();
                    mw.Show();
                    this.Close();
                    i = 0;
                }
                else if (i == 4)
                {
                    button_login.IsEnabled = false;
                    button.IsEnabled = false;
                    label.Content = "Passwort zu oft\nfalsch eingegeben!\nIn 2min erneut versuchen!";
                    Timer();
                    i = 0;
                    passwordBox.Clear();
                }
                else
                {
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException)
            {
                MessageBox.Show("Leider ist keine Verbindung\n zum Loginserver möglich :(");
            }
            catch (Exception)
            {
                MessageBox.Show("ERROR 404:\n\nEin unerwarteter Fehler ist \naufgetreten bitte starten sie das Programm erneut \nfalls diese Meldung schon das zweite Mal erscheint \nsetzen sie sich bitte mit dem Entwickler in Kontakt!");
            }
            return i;

        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.WebBot = ((WebBot.MainWindow)(target));
                return;

            case 2:
                this.tabControl = ((System.Windows.Controls.TabControl)(target));
                return;

            case 3:
                this.tabOLD = ((System.Windows.Controls.TabItem)(target));
                return;

            case 4:
                this.label_city = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.comboBox_city = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 6:
                this.label1 = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.label_mission = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.comboBox_mission = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 9:
                this.label3 = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.browser = ((System.Windows.Controls.WebBrowser)(target));

            #line 165 "..\..\MainWindow.xaml"
                this.browser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(this.browser_LoadCompleted);

            #line default
            #line hidden
                return;

            case 11:
                this.button_fill = ((System.Windows.Controls.Button)(target));

            #line 166 "..\..\MainWindow.xaml"
                this.button_fill.Click += new System.Windows.RoutedEventHandler(this.button_fill_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.label_loggedinas = ((System.Windows.Controls.Label)(target));
                return;

            case 13:
                this.btn_settings = ((System.Windows.Controls.Button)(target));

            #line 168 "..\..\MainWindow.xaml"
                this.btn_settings.Click += new System.Windows.RoutedEventHandler(this.button1_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.additem = ((System.Windows.Controls.TabItem)(target));

            #line 171 "..\..\MainWindow.xaml"
                this.additem.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.TabItem_MouseLeftButtonUp);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     MainWindow mw = new MainWindow();
     mw.Show();
     this.Close();
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.WebBot = ((WebBot.MainWindow)(target));
     return;
     case 2:
     this.tabControl = ((System.Windows.Controls.TabControl)(target));
     return;
     case 3:
     this.tabOLD = ((System.Windows.Controls.TabItem)(target));
     return;
     case 4:
     this.label_city = ((System.Windows.Controls.Label)(target));
     return;
     case 5:
     this.comboBox_city = ((System.Windows.Controls.ComboBox)(target));
     return;
     case 6:
     this.label1 = ((System.Windows.Controls.Label)(target));
     return;
     case 7:
     this.label_mission = ((System.Windows.Controls.Label)(target));
     return;
     case 8:
     this.comboBox_mission = ((System.Windows.Controls.ComboBox)(target));
     return;
     case 9:
     this.label3 = ((System.Windows.Controls.Label)(target));
     return;
     case 10:
     this.browser = ((System.Windows.Controls.WebBrowser)(target));
     
     #line 165 "..\..\MainWindow.xaml"
     this.browser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(this.browser_LoadCompleted);
     
     #line default
     #line hidden
     return;
     case 11:
     this.button_fill = ((System.Windows.Controls.Button)(target));
     
     #line 166 "..\..\MainWindow.xaml"
     this.button_fill.Click += new System.Windows.RoutedEventHandler(this.button_fill_Click);
     
     #line default
     #line hidden
     return;
     case 12:
     this.label_loggedinas = ((System.Windows.Controls.Label)(target));
     return;
     case 13:
     this.btn_settings = ((System.Windows.Controls.Button)(target));
     
     #line 168 "..\..\MainWindow.xaml"
     this.btn_settings.Click += new System.Windows.RoutedEventHandler(this.button1_Click);
     
     #line default
     #line hidden
     return;
     case 14:
     this.additem = ((System.Windows.Controls.TabItem)(target));
     
     #line 171 "..\..\MainWindow.xaml"
     this.additem.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.TabItem_MouseLeftButtonUp);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }