1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using System;
- using System.Collections.Generic;
- 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.Navigation;
- using System.Windows.Shapes;
- using Aitex.Core.Util;
- namespace Aitex.Core.UI.View.Frame
- {
- /// <summary>
- /// Interaction logic for CenterTabView.xaml
- /// </summary>
- public partial class CenterTabView : UserControl
- {
- UserControl _uc;
- private Dictionary<string, ViewItem> _lstTabs = new Dictionary<string, ViewItem>();
- public CenterTabView()
- {
- InitializeComponent();
- }
- public void Add(ViewItem item, UserControl view)
- {
- _uc = view;
- TabContainer.Items.Add(new TabItem()
- {
- Content = view,
- Header = item.Name,
- IsSelected = false,
- Tag = item.Id,
- });
- _lstTabs[item.Id] = item;
- }
- public UserControl GetContentView()
- {
- return _uc;
- }
- public UserControl FindView(string id)
- {
- foreach (TabItem item in TabContainer.Items)
- if (item.Tag.ToString() == id)
- return (UserControl)item.Content;
- return null;
- }
- public TabItem FindTab(string id)
- {
- foreach (TabItem item in TabContainer.Items)
- if (item.Tag.ToString() == id)
- return item;
- return null;
- }
- public void SetCulture(string culture)
- {
- foreach (TabItem item in TabContainer.Items)
- {
- ViewItem info = _lstTabs[item.Tag.ToString()];
- if (info.GlobalName.ContainsKey(culture))
- item.Header = info.GlobalName[culture];
- }
- }
- }
- }
|