//update
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            var window = new UserSpace(_currentUser);

            this.Hide();
            window.Show();
            this.Close();
        }
Example #2
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Users user = await _repository.GetUsersByMailAndPassword(mail.Text, password.Password);

            if (user == default)
            {
                MessageBox.Show("Not Correct");
                return;
            }
            else
            {
                var window = new UserSpace(users: user);
                window.Show();
                this.Hide();
                this.Close();
            }
        }
        private async void Button_Click_3(object sender, RoutedEventArgs e)
        {
            try
            {
                Users addedUser = new Users
                {
                    Name     = name.Text,
                    Password = password.Password,
                    Surname  = surname.Text,
                    Birthday = birth.SelectedDate.Value,
                    Email    = mail.Text
                };

                if (_image != null)
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        JpegBitmapEncoder bitmapEncoder = new JpegBitmapEncoder();
                        bitmapEncoder.Frames.Add(BitmapFrame.Create(_image));
                        bitmapEncoder.Save(ms);
                        addedUser.Images = new Model.Images()
                        {
                            Date_added = DateTime.Now,
                            Image      = ms.ToArray()
                        };
                        addedUser.Images1.Add(addedUser.Images);
                    }
                }

                if (await _repository.AddUser(addedUser) != null)
                {
                    var window = new UserSpace(users: addedUser);
                    window.Show();
                    this.Hide();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }