123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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
- {
- /// <summary>
- /// 主界面
- /// </summary>
- 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);
- }
- /// <summary>
- /// 切换页面
- /// </summary>
- 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();
- }
- }
- }
- }
|