using log4net; using NEIntelligentControl2.Models.Messages; using NEIntelligentControl2.Models.Pages; using NEIntelligentControl2.Models.Station; using System; using System.Collections.Generic; using System.Configuration; 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; namespace NEIntelligentControl2 { /// /// 主界面 /// public partial class MainWindow : Window { private IPageAction _IPageAction; // 页面动作 private Page _CurrentPage; // 当前页面 public MainWindow(IPageAction action) { InitializeComponent(); _IPageAction = action; SwitchPage("Home.PageWindturbineAGC"); } private void StatusBar_ItemClick(object sender, RoutedEventArgs e) { var ee = e as Views.MainWindow.MenuItemRoutedEventArgs; if (ee == null) return; _SBMain.IsMenuOpen = false; SwitchPage(ee.Tag); } /// /// 切换页面 /// private void SwitchPage(string tag) { var page = _IPageAction[tag]; if (page == _CurrentPage) return; _CurrentPage = page; _FrameMain.Navigate(page); if (!_FrameMain.NavigationService.CanGoBack) return; var en = _FrameMain.NavigationService.RemoveBackEntry(); while (en != null) { en = _FrameMain.NavigationService.RemoveBackEntry(); } } } }