using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualBasic; using NVelocity.Util.Introspection; using Prism.Events; using SlnMesnac.Serilog; using SlnMesnac.WPF.Attribute; using SlnMesnac.WPF.Event; using SlnMesnac.WPF.ViewModel.Base; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SlnMesnac.WPF.ViewModel.Index { [RegisterAsSingletonAttribute] public partial class IndexViewModel : BaseViewModel { public readonly SerilogHelper _logger; private readonly IEventAggregator _eventAggregator; public IndexViewModel(SerilogHelper logger, IEventAggregator eventAggregator) { _logger = logger; _eventAggregator = eventAggregator; } /// /// 加载产品信息 /// /// [RelayCommand] private void LoadProductInfo(string deviceCode) { string code = deviceCode as string; _eventAggregator.GetEvent().Publish(code); var mainWindow = App.ServiceProvider.GetService(); mainWindow.ControlOnClick("ProductInfo"); } } }