Exemplo n.º 1
0
        private void foodRecipeImageContainer_Click(object sender, RoutedEventArgs e)
        {
            var              selectedButton     = (Button)sender;
            StepImage        selectedImage      = null;
            var              selectedStep       = 0;
            var              selectedIndex      = 0;
            List <StepImage> selectedStepImages = new List <StepImage>();

            for (int i = 0; i < _recipe.IMAGES_LIST_FOR_BINDING.Count; i++)
            {
                if (_recipe.IMAGES_LIST_FOR_BINDING[i].LINK_IMAGES == selectedButton.Tag.ToString())
                {
                    selectedStep  = _recipe.IMAGES_LIST_FOR_BINDING[i].NO_STEP;
                    selectedImage = _recipe.IMAGES_LIST_FOR_BINDING[i];
                    break;
                }
            }

            foreach (var image in _recipe.IMAGES_LIST_FOR_BINDING)
            {
                if (image.NO_STEP == selectedStep)
                {
                    selectedStepImages.Add(image);
                }
            }

            selectedIndex = selectedStepImages.IndexOf(selectedImage);

            youtubeThumbnail.Visibility = Visibility.Hidden;
            carouselDialog.ShowDialog(selectedStepImages, selectedIndex);
        }
Exemplo n.º 2
0
        private void addStepButton_Click(object sender, RoutedEventArgs e)
        {
            if (detailStepTextBox.Text.Length == 0)
            {
                notiMessageSnackbar.MessageQueue.Enqueue("Không được bỏ trống chi tiết thực hiện", "Cancel", () => { });
            }
            else
            {
                messageNotFoundContainer.Visibility = Visibility.Collapsed;

                ++totalStep;

                Step step = new Step();

                step.NO_STEP = totalStep;

                if (step.NO_STEP < 10)
                {
                    step.NO_STEP_FOR_BINDING = $"0{step.NO_STEP}";
                }
                else
                {
                    step.NO_STEP_FOR_BINDING = $"{step.NO_STEP}";
                }

                step.DETAIL = detailStepTextBox.Text;

                foreach (var myImage in myImages)
                {
                    StepImage stepImage = new StepImage();

                    stepImage.NO_STEP     = step.NO_STEP;
                    stepImage.LINK_IMAGES = myImage.ImageSource;

                    step.StepImages.Add(stepImage);
                }

                step.STEP_IMAGES_LIST_FOR_BINDING = step.StepImages.ToList();

                recipe.Steps.Add(step);

                stepsPreviewListView.ItemsSource = recipe.Steps.ToList();

                relativeImageStepListView.ItemsSource = null;

                detailStepTextBox.Text = "";

                relativeImageStepListView.Visibility = Visibility.Collapsed;
            }
        }