123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using OpenSEMI.Ctrlib.Window;
- using Prism.Regions;
- using System.Collections.Generic;
- using System.Windows;
- using Venus_Themes.CustomControls;
- using Venus_UI.Models;
- using Venus_UI.Themes.Attach;
- using Venus_Unity;
- using System.Linq;
- using System.Threading;
- using System;
- using Venus_MainPages.Views;
- using System.Windows.Controls;
- using Aitex.Core.UI.View.Frame;
- using System.Windows.Media;
- namespace Venus_UI.Views
- {
- /// <summary>
- /// ShellView.xaml 的交互逻辑
- /// </summary>
- public partial class ShellView : CustomWnd
- {
- IRegionManager m_regionManager;
- IRegionNavigationService m_regionNavigationService;
- List<VenusMenu> VenusMenu;
- List<TabControl> centerTabViews=new List<TabControl> ();
- List<Button> buttonList=new List<Button> ();
- public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
- {
- InitializeComponent();
- m_regionManager = regionManager;
- m_regionNavigationService = regionNavigationService;
- m_regionManager.RegisterViewWithRegion("TopRegion", typeof(Venus_MainPages.Views.TopView));
- }
- private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
- {
-
- VenusMenu= SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>("Config/VenusMenu.json");
- for (int i = 0; i < VenusMenu.Count; i++)
- {
- AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
- if (i == 0)
- {
- aduRadioButtonIcon.IsChecked = true;
- }
- IconElement.SetPathData(aduRadioButtonIcon,(Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
- aduRadioButtonIcon.Content = VenusMenu[i].Id;
- aduRadioButtonIcon.Click += AduRadioButtonIcon_Click;
- aduRadioButtonIcon.Tag = i;
- Bottom_Frame.Children.Add(aduRadioButtonIcon);
- TabControl tabControl = new TabControl();
- for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
- {
- if (VenusMenu[i].MenuItem[j].View == "")
- {
- break;
- }
- string className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
- Type t = Type.GetType($"{className},Venus_MainPages");
- tabControl.Items.Add(new TabItem() { Header= VenusMenu[i].MenuItem[j].Name, Content= Activator.CreateInstance(t)});
- }
- centerTabViews.Add(tabControl);
- }
- Main_Frame.Content = centerTabViews[0];
- }
- private void AduRadioButtonIcon_Click(object sender, RoutedEventArgs e)
- {
- var currentButton = sender as AduRadioButtonIcon;
- Main_Frame.Content = centerTabViews[Convert.ToInt32(currentButton.Tag)];
- }
- }
- }
|