Esempio n. 1
0
        private void backButton_Click(object sender, RoutedEventArgs e)
        {
            var win = new Window7();

            win.Show();
            this.Close();
        }
Esempio n. 2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            int    height;
            double currentWeight;
            double goalWeight;

            try
            {
                height        = Int32.Parse(heightTextBox.Text);
                currentWeight = Double.Parse(currentWeightTextBox.Text);
                goalWeight    = Double.Parse(goalWeightTextBox.Text);
            }
            catch
            {
                MessageBox.Show("Please enter valid data! Error");
                return;
            }
            if (HelperFunctions.validateHeight(height) &&
                HelperFunctions.validateWeight(currentWeight) &&
                HelperFunctions.validateWeight(goalWeight))
            {
                Data.newUserHeight        = height;
                Data.newUserCurrentWeight = currentWeight;
                Data.newUserGoalWeight    = goalWeight;
                HelperFunctions.signUpNewUser();

                Window7 w = new Window7();
                w.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Please enter valid data! Non valid");
            }
        }
Esempio n. 3
0
        private void insert_Click(object sender, RoutedEventArgs e)
        {
            Window7 winTool = new Window7();

            //Назначение текущего окна владельцем.
            winTool.Owner = this;
            //Отображение окна, принадлежащего окну-владельцу.
            winTool.Show();
            this.Hide();
        }
Esempio n. 4
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            String oldUsername = Data.currentUser.Name;
            String name        = nameTextBox.Text;

            if (HelperFunctions.validateUsername(name))
            {
                Data.currentUser.Name = name;
            }
            try
            {
                int height = Int32.Parse(heightTextBox.Text);
                if (HelperFunctions.validateHeight(height))
                {
                    Data.currentUser.Height = height;
                }
            } catch { }
            Gender?gender = null;

            if ((bool)maleRadioButton.IsChecked)
            {
                gender = Gender.male;
            }
            if ((bool)femaleRadioButton.IsChecked)
            {
                gender = Gender.female;
            }
            if (gender != null)
            {
                Data.currentUser._gender = (Gender)gender;
            }

            DateTime?birthday = birthdayDatePicker.SelectedDate;

            if (birthday != null)
            {
                Data.currentUser.Birthday = (DateTime)birthday;
            }

            HelperFunctions.serUsers();
            Window7 w = new Window7();

            w.Show();
            this.Close();
        }
Esempio n. 5
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            String name     = nameTextBox.Text;
            String password = passwordBox.Password;

            foreach (User user in Data.users)
            {
                if (user.Name == name && user.shouldLogin(password))
                {
                    Data.currentUser = user;
                    Window7 w = new Window7();
                    w.Show();
                    this.Close();
                    return;
                }
            }
            MessageBox.Show("No such user with such password!");
        }
Esempio n. 6
0
        private void button_Click_1(object sender, RoutedEventArgs e)
        {
            var  mealName = mealsCombo.SelectedValue;
            Meal meal     = null;

            foreach (var m in Data.meals)
            {
                if (m.Name == (string)mealName)
                {
                    meal = m;
                    break;
                }
            }
            int amount = 0;

            try
            {
                //MessageBox.Show(amountsCombo.SelectedValue.ToString());
                amount = int.Parse(amountsCombo.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("Pick an amount!");
                return;
            }
            DateTime date;

            try
            {
                date = (DateTime)datePicker.SelectedDate;
            } catch { MessageBox.Show("Pick a date!"); return; }

            meal.amountConsumed = amount;
            meal.dateConsumed   = date;

            Data.currentUser.history.Add(meal);
            HelperFunctions.serUsers();
            MessageBox.Show("Added to your history");

            var win = new Window7();

            win.Show();
            this.Close();
        }
Esempio n. 7
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Window7 w = new Window7();

            w.Show();
        }