将NlogHelper,和NotificationHelper,改为服务的方式注入使用
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using DMS.Core.Helper;
|
||||
using DMS.WPF.Helper;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.Dialogs;
|
||||
@@ -23,7 +19,7 @@ public partial class DeviceDialog : ContentDialog
|
||||
|
||||
private void OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
|
||||
{
|
||||
//<2F>ĶԻ<C4B6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
||||
//<2F>ĶԻ<C4B6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
||||
var backgroundElementBorder = VisualTreeFinder.FindVisualChildByName<Border>(this, "BackgroundElement");
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxWidth;
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxHeight;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using DMS.Helper;
|
||||
using DMS.Services;
|
||||
using DMS.WPF.Helper;
|
||||
using DMS.WPF.Services;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using DMS.WPF.ViewModels.Items;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DMS.WPF.Views.Dialogs;
|
||||
|
||||
@@ -22,6 +23,8 @@ public partial class ImportOpcUaDialog : ContentDialog
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public ImportOpcUaDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -49,7 +52,8 @@ public partial class ImportOpcUaDialog : ContentDialog
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NotificationHelper.ShowError($"选择节点时发生了错误:{ex.Message}");
|
||||
var notificationService = App.Current.Services.GetRequiredService<NotificationService>();
|
||||
notificationService.ShowError($"选择节点时发生了错误:{ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Windows;
|
||||
using DMS.Core.Helper;
|
||||
using DMS.WPF.Services;
|
||||
using DMS.WPF.ViewModels;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
@@ -23,8 +22,7 @@ public partial class MainView : Window
|
||||
InitializeComponent();
|
||||
_viewModel = App.Current.Services.GetRequiredService<MainViewModel>();
|
||||
DataContext = _viewModel;
|
||||
NlogHelper.Info("主界面加载成功");
|
||||
|
||||
|
||||
// Set the NotifyIcon's DataContext to the ViewModel
|
||||
MyNotifyIcon.DataContext = _viewModel;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using DMS.Helper;
|
||||
using DMS.WPF.ViewModels;
|
||||
using DMS.WPF.Services;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -39,7 +39,8 @@ public partial class VariableTableView : UserControl
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
NotificationHelper.ShowError($"修改变量表启用,停用时发生了错误:{exception.Message}", exception);
|
||||
var notificationService = App.Current.Services.GetRequiredService<NotificationService>();
|
||||
notificationService.ShowError($"修改变量表启用,停用时发生了错误:{exception.Message}", exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +48,5 @@ public partial class VariableTableView : UserControl
|
||||
{
|
||||
IsLoadCompletion = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user