alielie
2025-03-03 1fca2167068e9ef2c079ec742f20313fc6697ab1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using HMI.Base;
using HMI.Core.Api;
using log4net;
 
namespace HMI.SettingControl
{
    /// <summary>
    /// UserControl1.xaml 的交互逻辑
    /// </summary>
    public partial class SettingControl : PluginControl
    {
        #region 属性
        private ObservableCollection<TabItem> tabItems;
 
        public ObservableCollection<TabItem> TabItems
        {
            get { return tabItems; }
            set { Set(ref tabItems, value); }
        }
        #endregion
 
        public SettingControl()
        {
            DataContext = this;
            InitializeComponent();
        }
 
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            TabItems = new ObservableCollection<TabItem>() {
                new TabItem
                {
                    Header = "系统设置",
                    Content = new SystemConfig()
                }
            };
            foreach (var d in PluginLoader.Instance.Plugins)
            {
                if (d.SettingControl == null) continue;
                TabItems.Add(new TabItem
                {
                    Header = d.Name,
                    Tag = d,
                    Content = d.SettingControl
                });
            }
            Loaded -= UserControl_Loaded;
        }
    }
}