WdGageTabItemConfig.xaml.cs 1.67 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
潘栩锋's avatar
潘栩锋 committed
4
using System.ComponentModel;
潘栩锋's avatar
潘栩锋 committed
5 6 7 8 9 10 11 12 13 14 15
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;

潘栩锋's avatar
潘栩锋 committed
16
namespace MultiLayout.MainEdit
潘栩锋's avatar
潘栩锋 committed
17 18
{
    /// <summary>
潘栩锋's avatar
潘栩锋 committed
19
    /// Window_MainEditGraphTabItem.xaml 的交互逻辑
潘栩锋's avatar
潘栩锋 committed
20
    /// </summary>
潘栩锋's avatar
潘栩锋 committed
21
    public partial class WdGageTabItemConfig : FLY.ControlLibrary.WindowBigClose
潘栩锋's avatar
潘栩锋 committed
22
    {
潘栩锋's avatar
潘栩锋 committed
23
        ObservableCollection<GageTabItem> Items;
潘栩锋's avatar
潘栩锋 committed
24
        int Idx;
潘栩锋's avatar
潘栩锋 committed
25 26

        public WdGageTabItemConfig()
潘栩锋's avatar
潘栩锋 committed
27 28 29
        {
            InitializeComponent();
        }
潘栩锋's avatar
潘栩锋 committed
30 31 32 33 34 35 36 37
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="items">全部设备</param>
        /// <param name="idx">设备序号</param>
        /// <param name="serviceNames">服务容器列表</param>
        public void Init(ObservableCollection<GageTabItem> items, int idx, List<string> serviceNames)
潘栩锋's avatar
潘栩锋 committed
38 39 40
        {
            Items = items;
            Idx = idx;
潘栩锋's avatar
潘栩锋 committed
41 42
            cbServiceNames.ItemsSource = serviceNames;
            this.DataContext = Items[Idx];
潘栩锋's avatar
潘栩锋 committed
43 44 45 46 47 48 49 50 51
        }
        private void button_pre_Click(object sender, RoutedEventArgs e)
        {
            if (Idx > 0)
            {
                Items.Move(Idx, Idx - 1);
                Idx--;
            }
        }
潘栩锋's avatar
潘栩锋 committed
52 53 54 55 56 57 58 59 60
        private void button_next_Click(object sender, RoutedEventArgs e)
        {
            if (Idx < Items.Count()-1)
            {
                Items.Move(Idx, Idx + 1);
                Idx++;
            }
        }

潘栩锋's avatar
潘栩锋 committed
61 62
    }
}