using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CtrEditor.ObjetosSim.Extraccion_Datos;
using CtrEditor.ObjetosSim;
using CtrEditor;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace CtrEditor.PopUps
{
///
/// Interaction logic for SelectPages.xaml
///
public partial class SelectPages : Window
{
public SelectPages()
{
InitializeComponent();
}
}
}
public partial class SelectPagesViewModel : ObservableObject
{
private MainViewModel _mainViewModel;
private Window _window;
private ObservableCollection _imagenesSeleccionadas;
private bool _closeOK;
[ObservableProperty]
private ObservableCollection listaImagenes;
[ObservableProperty]
private ObservableCollection selectedImagenes;
public SelectPagesViewModel() { }
public void Initialize(MainViewModel mainViewModel, Window window, ref ObservableCollection ImagenesSeleccionadas)
{
_mainViewModel = mainViewModel;
_window = window;
_imagenesSeleccionadas = ImagenesSeleccionadas;
ListaImagenes = _mainViewModel.ListaImagenes;
SelectedImagenes = ImagenesSeleccionadas;
}
[RelayCommand]
private void AssignImages()
{
_closeOK = true;
_window.Close();
}
[RelayCommand]
private void TBSelectAll()
{
SelectedImagenes.Clear();
foreach (var img in ListaImagenes)
{
SelectedImagenes.Add(img);
}
}
[RelayCommand]
private void TBUnSelectAll()
{
SelectedImagenes.Clear();
}
public bool CloseOK => _closeOK;
}