public TeacherLogIn()
 {
     this.username     = new NoneLogin();
     this.password     = new NoneLogin();
     this.loginVisitor = new TheVisitor <string>();
     this.InitializeComponent();
 }
Example #2
0
 public void OnUsername(IClassicOption <string> typedInUsername)
 {
     foreach (var item in this.givenUsernameAndPassword)
     {
         if (item.Key.LambdaVisit(() => true, _ => false, _ => false))
         {
             this.givenUsernameAndPassword = new Dictionary <IClassicOption <string>, IClassicOption <string> >()
             {
                 { typedInUsername, item.Value }
             };
         }
     }
 }
Example #3
0
 public void OnPassword(IClassicOption <string> typedInPassword)  //Checks if the given password is not empty (0 length)
 {
     foreach (var item in this.givenUsernameAndPassword)
     {
         if (item.Value.LambdaVisit(() => true, _ => false, _ => false))
         {
             this.givenUsernameAndPassword = new Dictionary <IClassicOption <string>, IClassicOption <string> >()
             {
                 { item.Key, typedInPassword }
             };
             //Updates the dictionary
         }
     }
 }
 private void logInButton_Click(object sender, RoutedEventArgs e)
 {
     if (UsernameTypeBox.Text.ToString().Length > 0)
     {
         username = new SomeUsernameLogin(UsernameTypeBox.Text.ToString()); //Username is now a Some because it's not empty
         username.ClassicVisit(loginVisitor);                               //Username calls it's visit method
     }
     else
     {
         //TODO with the use of factory, make a label that says that the username is not filled in
     }
     if (passwordTypeBox.Text.ToString().Length > 0)
     {
         password = new SomePasswordLogin(passwordTypeBox.Text.ToString());
         password.ClassicVisit(loginVisitor);
     }
     loginVisitor.OnLoginCheck(); //The filled in username and password are now checked
     this.Frame.Navigate(typeof(MainMenu));
 }
Example #5
0
 IClassicOption <string> none;                                                            //To avoid creating null''s
 public TheVisitor()
 {
     none = new NoneLogin();
     this.givenUsernameAndPassword = new Dictionary <IClassicOption <string>, IClassicOption <string> >();
     this.givenUsernameAndPassword.Add(none, none);
 }