Exemplo n.º 1
0
 public UserInformationWindow(BirthdayCalculator birthdayCalculator, InputWindow inputWindow)
 {
     InitializeComponent();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     _inputWindow          = inputWindow;
     birthdayCalculator.CalculateAgeAndZodiacSign();
     AgeTextBlock.Text        = birthdayCalculator.Age.ToString();
     ZodiacSignTextBlock.Text = birthdayCalculator.ZodiacSignName;
     ZodiacSignImage.Source   =
         new BitmapImage(
             new Uri("/ZodiacWpfApplication;component/Assets/" + birthdayCalculator.ZodiacSignName + ".jpg",
                     UriKind.Relative));
     Show();
 }
Exemplo n.º 2
0
        private void DateTextBox_OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }

            var date = VerifyBirthDate(DateTextBox.Text);

            if (date.Length == 0)
            {
                MessageBox.Show("Please, try again.", "Incorrect data format...", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
            var birthdayCalculator = new BirthdayCalculator(date[0], date[1], date[2]);

            this.Visibility = Visibility.Collapsed;
            var userWindow = new UserInformationWindow(birthdayCalculator, this);
        }