private void Button_Click(object sender, RoutedEventArgs e) { bool result = UserCreator.CreateUser(Text1.Text, Text3.Text, Text2.Text); UserCreator.Deposit("kil1", 100); UserCreator.Withdraw("kil", 20); if (result) { GoodLogin.Visibility = Visibility.Visible; mainwin.Effect = null; Button obj = (Button)mainwin.FindName("login"); obj.Visibility = Visibility.Hidden; Button obj2 = (Button)mainwin.FindName("Profile"); obj2.Visibility = Visibility.Visible; auth.Close(); } else { BadLogin.Visibility = Visibility.Visible; } }