MenuSetting.xaml.cs 2.36 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2
using MultiLayout.UiModule;
using System;
潘栩锋's avatar
潘栩锋 committed
3 4 5 6 7 8 9 10 11 12 13 14 15
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
潘栩锋's avatar
潘栩锋 committed
16
using Unity;
潘栩锋's avatar
潘栩锋 committed
17

潘栩锋's avatar
潘栩锋 committed
18
namespace FLY.IBC.UI.Client.UiModule
潘栩锋's avatar
潘栩锋 committed
19 20 21 22
{
    /// <summary>
    /// MenuSelect.xaml 的交互逻辑
    /// </summary>
潘栩锋's avatar
潘栩锋 committed
23
    public partial class MenuSetting : UserControl
潘栩锋's avatar
潘栩锋 committed
24
    {
潘栩锋's avatar
潘栩锋 committed
25 26
        IUnityContainer container;
        public MenuSetting()
潘栩锋's avatar
潘栩锋 committed
27 28 29 30
        {
            InitializeComponent();
        }

潘栩锋's avatar
潘栩锋 committed
31 32
        [InjectionMethod]
        public void Init(IUnityContainer container)
潘栩锋's avatar
潘栩锋 committed
33
        {
潘栩锋's avatar
潘栩锋 committed
34
            this.container = container;
潘栩锋's avatar
潘栩锋 committed
35 36
        }

潘栩锋's avatar
潘栩锋 committed
37 38 39 40 41
        private void btnMenuClick(object sender, RoutedEventArgs e)
        {
            PgMenu p = new PgMenu();
            container.BuildUp(p);
            MultiLayout.FlyLayoutManager.NavigationService.Navigate(p);
潘栩锋's avatar
潘栩锋 committed
42 43
        }
    }
潘栩锋's avatar
潘栩锋 committed
44
    public class UiModule2_MenuSetting : IUiModule2
潘栩锋's avatar
潘栩锋 committed
45 46 47 48 49
    {
        /// <summary>
        /// 控件标题
        /// 它的值取决于culture
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
50 51 52
        public string Title=>"IBC菜单";
        public ComponentType Type => ComponentType.Menu;
        public bool IsUnique => true;
潘栩锋's avatar
潘栩锋 committed
53 54 55 56 57 58
        /// <summary>
        /// 控件
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
潘栩锋's avatar
潘栩锋 committed
59
        public FrameworkElement GetComponent(int id, IUnityContainer container)
潘栩锋's avatar
潘栩锋 committed
60
        {
潘栩锋's avatar
潘栩锋 committed
61 62
            MenuSetting graph = new MenuSetting();
            container.BuildUp(graph);
潘栩锋's avatar
潘栩锋 committed
63 64 65 66 67 68 69 70 71
            return graph;
        }

        /// <summary>
        /// 控件缩略图,用于编辑界面时,大致看看
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
潘栩锋's avatar
潘栩锋 committed
72
        public FrameworkElement GetThumbnail()
潘栩锋's avatar
潘栩锋 committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86
        {
            return new System.Windows.Controls.Grid();
        }


        /// <summary>
        /// 给出全部控件ID, 控件自行删除没有的参数
        /// </summary>
        /// <param name="IDs"></param>
        public void MatchParam(int[] IDs)
        {
        }
    }
}