将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using XP.App.ViewModels;
|
||||
using XP.Common.Logging.Interfaces;
|
||||
using XP.Hardware.Plc.Abstractions;
|
||||
using XP.Hardware.Plc.Services;
|
||||
using XP.Hardware.PLC.Configs;
|
||||
|
||||
namespace XP.App.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ISignalDataService DEMO 窗口
|
||||
/// </summary>
|
||||
public partial class SignalDataDemoWindow : Window
|
||||
{
|
||||
public SignalDataDemoWindow(
|
||||
PlcService plcService,
|
||||
ISignalDataService signalService,
|
||||
ConfigLoader configLoader,
|
||||
ILoggerService logger)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var vm = new SignalDataDemoViewModel(plcService, signalService, configLoader, logger);
|
||||
DataContext = vm;
|
||||
|
||||
if (Application.Current?.MainWindow != null)
|
||||
Icon = Application.Current.MainWindow.Icon;
|
||||
|
||||
// 日志自动滚动
|
||||
vm.LogEntries.CollectionChanged += (s, e) =>
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add && vm.LogEntries.Count > 0)
|
||||
{
|
||||
Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
LogListBox.ScrollIntoView(vm.LogEntries[vm.LogEntries.Count - 1]);
|
||||
}, System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user