private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            short type   = (short)mealTypeComboBox.SelectedIndex;
            bool  result = RestClient.Instance.MakePostRequest("EatMeal", new MealData()
            {
                UserLogin  = RestClient.Instance.LoggedUserLogin,
                Weigth     = 1,
                MealType   = type,
                DishesList = addedDishes
            });
            string userResponse = result ? "Udało się dodać posiłek" : "Nie możemy dodać posiłku";

            if (result)
            {
                Window mainWindow = new MainAppWindow();
                App.Current.MainWindow = mainWindow;
                mainWindow.Show();
                this.Close();
            }

            MessageBox.Show(userResponse,
                            "Dodawanie posiłku",
                            MessageBoxButton.OK,
                            MessageBoxImage.Information);
        }
示例#2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool result = RestClient.Instance.MakePostRequest("TryCreateComponent", new Component()
            {
                Name                = nameTextBox.Text,
                Manufacturer        = manufacturerTextBox.Text,
                CaloriesIn100g      = Int32.Parse(CaloriesTextBox.Text),
                ProteinIn100g       = Int32.Parse(ProteinsTextBox.Text),
                FatsIn100g          = Int32.Parse(FatsTextBox.Text),
                CarbohydratesIn100g = Int32.Parse(CarbohydratesTextBox.Text)
            });
            string userResponse = result ? "Udało się dodać składnik" : "Nie możemy dodać wskazanego składnika";

            if (addOneMoreCheckBox.IsChecked.Equals(false))
            {
                Window mainWindow = new MainAppWindow();
                App.Current.MainWindow = mainWindow;
                mainWindow.Show();
                this.Close();
            }
            else
            {
                nameTextBox.Clear();
                manufacturerTextBox.Clear();
                CaloriesTextBox.Clear();
            }

            MessageBox.Show(userResponse,
                            "Dodawanie składnika",
                            MessageBoxButton.OK,
                            MessageBoxImage.Information);
        }
        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Window mainWindow = new MainAppWindow();

            App.Current.MainWindow = mainWindow;
            mainWindow.Show();
            this.Close();
        }
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            bool result = RestClient.Instance.MakePostRequest("TryCreateDish", new DishData()
            {
                UserLogin      = RestClient.Instance.LoggedUserLogin,
                Name           = nameTextBox.Text,
                ComponentsList = selectedComponentsList
            });
            string userResponse = result ? "Udało się dodać danie" : "Nie możemy dodać wskazanego dania";

            if (result)
            {
                Window mainWindow = new MainAppWindow();
                App.Current.MainWindow = mainWindow;
                mainWindow.Show();
                this.Close();
            }

            MessageBox.Show(userResponse,
                            "Dodawanie potrawy",
                            MessageBoxButton.OK,
                            MessageBoxImage.Information);
        }