﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Test.Util;

namespace Test
{
    public class MainWindowViewModel
    {
        public ImageSource ImageSource { get; set; }
        public string StringPath { get; set; }
        public List<string> Source { get; set; } = new List<string>() { "Hola", "Adios", "Hasta luego", "Qué tal" };

        public ICommand AddComboCommand { get; set; }

        public MainWindowViewModel()
        {
            StringPath = "pack://application:,,,/Resources/Miguel-Indurain-2.webp"; // Ruta relativa
            ImageSource = new BitmapImage(new Uri(StringPath));

            AddComboCommand = new RelayCommand<WrapPanel>(AddCombo, null);
        }

        private void AddCombo(WrapPanel o)
        {
            ComboBox newComboBox = new ComboBox
            {
                Width = 100,
                Margin = new Thickness(0, 0, 10, 0)
            };

            List<string> items = new List<string> { "Pepito", "Manolito", "Luisito" };
            foreach (var item in items)
            {
                newComboBox.Items.Add(item);
            }

            o.Children.Add(newComboBox);
        }
    }
}
