using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
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 MultiLayout.MainEdit
{
    /// <summary>
    /// Window_MainEditGraphTabItem.xaml 的交互逻辑
    /// </summary>
    public partial class WdGraphTabItemConfig : FLY.ControlLibrary.WindowBigClose
    {
        ObservableCollection<MeGraphTabItem> Items;
        int Idx;
        GraphTabItem_RC ItemRC;
        public WdGraphTabItemConfig()
        {
            InitializeComponent();
        }
        public void Init(ObservableCollection<MeGraphTabItem> items, int idx)
        {
            Items = items;
            Idx = idx;
            ItemRC = new GraphTabItem_RC();
            ItemRC.ColCnt = Items[Idx].ColCnt;
            ItemRC.RowCnt = Items[Idx].RowCnt;
            this.grid_graphTabItem.DataContext = Items[Idx];
            this.grid_RC.DataContext = ItemRC;
        }
        private void button_pre_Click(object sender, RoutedEventArgs e)
        {
            if (Idx > 0)
            {
                Items.Move(Idx, Idx - 1);
                Idx--;
            }
        }
        private void button_next_Click(object sender, RoutedEventArgs e)
        {
            if (Idx < Items.Count()-1)
            {
                Items.Move(Idx, Idx + 1);
                Idx++;
            }
        }

        private void button_apply_Click(object sender, RoutedEventArgs e)
        {
            Items[Idx].RefreshRC(ItemRC.RowCnt, ItemRC.ColCnt);
        }
    }
    public class GraphTabItem_RC : INotifyPropertyChanged
    {

        public int ColCnt { get; set; } = 1;


        public int RowCnt { get; set; } = 1;


        public event PropertyChangedEventHandler PropertyChanged;
    }
}
