Advertisement
andrzejiwaniuk

[Napisz sam] Prosty formularz logowania - programowanie w ję

May 24th, 2013
2,619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15.  
  16. namespace LogowanieForm
  17. {
  18.     /// <summary>
  19.     /// Logika interakcji dla klasy MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.        
  24.        
  25.         public MainWindow()
  26.         {
  27.             InitializeComponent();
  28.         }
  29.  
  30.         private void zalogujBt_Click(object sender, RoutedEventArgs e)
  31.         {
  32.             string uzytkownik = this.nazwaUzytktxt.Text;
  33.             string haslo = this.hasloUzyttxt.Password;
  34.  
  35.             if (SprawdzNazweiHaslo(uzytkownik, haslo))
  36.             {
  37.                 //MessageBox.Show("Jest w systemie", "Zaalogowano");
  38.                 logowanieFrm.Hide();
  39.                 // dalej tutaj mozecie tworzyc nowe formularze i dalsza czesc programu ...
  40.                 GlowneOkno fr = new GlowneOkno();
  41.                 fr.Show();
  42.                 //logowanieFrm.Close();
  43.             }
  44.             else
  45.             {
  46.                 MessageBox.Show("Niepoprawna nazwa użytkownika lub hasło","Błąd logowania");
  47.                 return;
  48.             }
  49.         }
  50.         public bool SprawdzNazweiHaslo(string uzytkownik, string haslo)
  51.         {
  52.             if (uzytkownik == "Andrzej" & haslo == "andrzej")
  53.                 return true;
  54.             else
  55.                 return false;
  56.  
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement