You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.4 KiB
C#

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Business;
using SlnMesnac.Model.domain;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.WPF.ViewModel
* 06dea146-4bed-4f74-9aac-01f8ea91d6bf
*
* WenJY
*
* 2024-10-09 8:50:06
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.WPF.ViewModel
{
public partial class LogInfoViewModel: ObservableObject
{
private readonly LogInfoBusiness logInfoBusiness;
public LogInfoViewModel()
{
logInfoBusiness = App.ServiceProvider.GetService<LogInfoBusiness>();
}
public ComboBoxItem _logLevel = null;
public ComboBoxItem LogLevel
{
get => _logLevel;
set => SetProperty(ref _logLevel, value);
}
public DateTime _beginTime = DateTime.Now;
public DateTime BeginTime
{
get => _beginTime;
set => SetProperty(ref _beginTime, value);
}
public DateTime _endTime = DateTime.Now.AddDays(1);
public DateTime EndTime
{
get => _endTime;
set => SetProperty(ref _endTime, value);
}
private ObservableCollection<BaseLog> _scanItems = new ObservableCollection<BaseLog>();
public ObservableCollection<BaseLog> ScanItems
{
get => _scanItems;
set => SetProperty(ref _scanItems, value);
}
[RelayCommand]
private void Query()
{
string logLevel = _logLevel == null ? string.Empty : _logLevel.Content.ToString();
logInfoBusiness.QueryLogInfo(logLevel, _beginTime, _endTime, out List<BaseLog> info);
ScanItems = new ObservableCollection<BaseLog>(info);
}
}
}