コード例 #1
0
        private void buttonZaloguj_Click(object sender, RoutedEventArgs e)
        {
            Profile profile = new Profile();
            bool    correct = false;

            for (int i = 0; i < profile.User.Length; i++)
            {
                if (profile.User[i] == TextLogin.Text && profile.Password[i] == Password.Password)
                {
                    correct = true;
                }
            }
            if (correct == true)
            {
                Main2 nowy2 = new Main2();
                nowy2.Show();
                Application.Current.Properties["Login"]           = TextLogin.Text;
                Application.Current.Properties["ConnectedStatus"] = "brak";
                nowy2.zalogowany.Text = Application.Current.Properties["Login"].ToString();
                Close();
            }
            else
            {
                KomH.Content = "Nieprawidłowy login lub hasło.";
            }
        }
コード例 #2
0
ファイル: Logowanie.xaml.cs プロジェクト: jakubmazu/ZWG
        private void buttonPubliczny_Click(object sender, RoutedEventArgs e)
        {
            //(new Main()).Show();
            // Main nowy = new Main();
            //nowy.Show();
            Main2 nowy2 = new Main2();

            nowy2.Show();

            Application.Current.Properties["Login"]           = "******";
            Application.Current.Properties["ConnectedStatus"] = "brak";
            nowy2.zalogowany.Text = Application.Current.Properties["Login"].ToString();

            if (Application.Current.Properties["Login"].ToString() == "admin")
            {
                nowy2.DodajKonto.IsEnabled = true;
            }
            else
            {
                nowy2.DodajKonto.IsEnabled = false;
            }


            //nowy.TextNazwaTestu.Text = Application.Current.Properties["Login"].ToString();
            //nowy.TextPolBaza.Text = Application.Current.Properties["ConnectedStatus"].ToString();

            Close();
        }