| | |
| | | using HMI.Core.Util; |
| | | using HMI.UI.Util; |
| | | using HMI.Util.Alarm; |
| | | using log4net; |
| | | using Panuon.WPF.UI; |
| | | using System; |
| | | using System.Collections.ObjectModel; |
| | | using System.ComponentModel; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | | using System.Windows.Media.Imaging; |
| | |
| | | /// </summary> |
| | | public partial class PanuonWindow : WindowX, IPluginContainer, IAlarmShow |
| | | { |
| | | private ILog log = LogManager.GetLogger("MainWindow"); |
| | | public PanuonWindow() |
| | | { |
| | | this.Loaded += PanuonWindow_Loaded; |
| | | SoftwareVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
| | | } |
| | | |
| | | private UserInfo currentUser; |
| | |
| | | get => Alarms?.Count ?? 0; |
| | | } |
| | | |
| | | private string softwareVersion; |
| | | public string SoftwareVersion |
| | | { |
| | | get => softwareVersion; |
| | | set |
| | | { |
| | | Set(ref softwareVersion, value); |
| | | } |
| | | } |
| | | |
| | | private string pluginVersion; |
| | | public string PluginVersion |
| | | { |
| | | get => pluginVersion; |
| | | set |
| | | { |
| | | Set(ref pluginVersion, value); |
| | | } |
| | | } |
| | | |
| | | public ListBox sb |
| | | { |
| | | get; set; |
| | |
| | | |
| | | private void PanuonWindow_Loaded(object sender, RoutedEventArgs e) |
| | | { |
| | | DataContext = this; |
| | | RefrshConfig(); |
| | | InitializeComponent(); |
| | | AlarmShowHelper.Register(this); |
| | | var sb = WindowXCaption.GetHeaderTemplate(this); |
| | | //sb.FindName("list",this.Con); |
| | | try |
| | | { |
| | | DataContext = this; |
| | | RefrshConfig(); |
| | | InitializeComponent(); |
| | | AlarmShowHelper.Register(this); |
| | | |
| | | WelcomeTitle = this.lang("App.Welcome", UserInfo.User.Name); |
| | | ShowMenu = false; |
| | | Application.Current.MainWindow = this; |
| | | SystemSetting.SystemSettingChanged += SystemSetting_SystemSettingChanged; |
| | | WelcomeTitle = this.lang("App.Welcome", UserInfo.User.Name); |
| | | ShowMenu = false; |
| | | Application.Current.MainWindow = this; |
| | | SystemSetting.SystemSettingChanged += SystemSetting_SystemSettingChanged; |
| | | |
| | | if (Environment.Is64BitProcess) |
| | | { |
| | | Task.Run(() => |
| | | { |
| | | ResourceListener.Instance.RefreshEvent += this.resourceUI.Refresh; |
| | | ResourceListener.Instance.Start(); |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.Error("Window Loaded Error.", ex); |
| | | } |
| | | } |
| | | |
| | | private void RefrshConfig() |
| | |
| | | { |
| | | try |
| | | { |
| | | ResourceListener.Instance.Stop(); |
| | | AlarmUtil.Release(); |
| | | PluginLoader.Reset(); |
| | | UserInfo.Logout(); |
| | |
| | | { |
| | | |
| | | } |
| | | Application.Current.Shutdown(); |
| | | Application.Current.Shutdown(0); |
| | | } |
| | | |
| | | private void Button_Click(object sender, RoutedEventArgs e) |
| | |
| | | Alarms?.Clear(); |
| | | } |
| | | |
| | | private void menuTab_TabChanged(object sender, Controls.TabChangedEventArg e) |
| | | { |
| | | Dispatcher.BeginInvoke(() => |
| | | { |
| | | if (e.newValue == null) |
| | | { |
| | | PluginVersion = string.Empty; |
| | | } |
| | | else |
| | | { |
| | | PluginVersion = e.newValue.GetType().Assembly.GetName().Version.ToString(); |
| | | } |
| | | }, System.Windows.Threading.DispatcherPriority.Normal); |
| | | } |
| | | |
| | | //private void BaseWindow_Loaded(object sender, RoutedEventArgs e) |
| | | //{ |
| | | // var s = (Style)this.Resources["WindowButton"]; |