
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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_MainEditDynAreaComponent.xaml 的交互逻辑
    /// </summary>
    public partial class WdDynAreaConfig : FLY.ControlLibrary.WindowBigClose
    {
        ObservableCollection<MeFlyComponent> Items;
        int Idx;
        public WdDynAreaConfig()
        {
            InitializeComponent();
        }
        public void Init(ObservableCollection<MeFlyComponent> items, int idx, List<string> serviceNames)
        {
            Items = items;
            Idx = idx;
            cbServiceNames.ItemsSource = serviceNames;
            this.DataContext = Items[idx];
        }


        private void button_next_Click(object sender, RoutedEventArgs e)
        {
            if (Idx < Items.Count() - 1)
            {
                Items.Move(Idx, Idx + 1);
                Idx++;
            }
        }

        private void button_pre_Click(object sender, RoutedEventArgs e)
        {
            if (Idx > 0)
            {
                Items.Move(Idx, Idx - 1);
                Idx--;
            }
        }
    }
}
