using Admin.Core.IService; using Admin.Core.Model; using Admin.Core.Model.ViewModels; using Admin.Core.Service; using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; /** * 老发泡线监控 * */ namespace Aucma.Core.BoxFoam.ViewModels { public partial class OldBoxFoamPageViewModel : ObservableObject { public readonly IOldBoxFoamDataServices? _oldBoxFoamDataServices; public OldBoxFoamPageViewModel() { _oldBoxFoamDataServices = App.ServiceProvider.GetService(); OnLoad(); } public async void OnLoad() { bool r= _oldBoxFoamDataServices.GetConnectionState(); List list = await _oldBoxFoamDataServices.QueryAsync(); if (list == null) return; foreach (var item in list) OldBoxFoamDataGrid.Add(item); } #region 初始化datagrid private ObservableCollection oldBoxFoamDataGrid = new ObservableCollection(); public ObservableCollection OldBoxFoamDataGrid { get { return oldBoxFoamDataGrid; } set { oldBoxFoamDataGrid = value; OnPropertyChanged();//属性通知 } } #endregion } }