使用新框架与技术代替旧框架与技术,实现涂装车间后道标签扫码程序
This commit is contained in:
39
RIZO_Application.Modules.Base/ViewModels/PrintViewModel.cs
Normal file
39
RIZO_Application.Modules.Base/ViewModels/PrintViewModel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using RIZO_Application.Core;
|
||||
using RIZO_Application.Core.Mvvm;
|
||||
|
||||
namespace RIZO_Application.Modules.Base.ViewModels
|
||||
{
|
||||
public class PrintViewModel : RegionViewModelBase
|
||||
{
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private SubscriptionToken _token;
|
||||
|
||||
public PrintViewModel(
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator)
|
||||
: base(regionManager)
|
||||
{
|
||||
_eventAggregator = eventAggregator;
|
||||
// 订阅事件,使用UI线程处理,保持强引用
|
||||
_token = _eventAggregator.GetEvent<SystemLogEvent>().Subscribe(OnReceived, ThreadOption.UIThread, true);
|
||||
}
|
||||
|
||||
private void OnReceived(string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
_token?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user