53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using Aurora;
|
|
using Aurora.Api.Manager;
|
|
using Aurora.View;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
using WeldingCommon.Recipes;
|
|
using WeldingCommon.Utils;
|
|
|
|
namespace WeldingCommon.Views.Recipes.History
|
|
{
|
|
public class UCRecipeChangeHistoryViewModel : NotifyPropertyChangedBase
|
|
{
|
|
private readonly IRecipeManager _recipeManager;
|
|
public ICommand CMD_VisibleChanged { get; }
|
|
public ICommand CMD_Search { get; }
|
|
|
|
public DateTime StartDate { get => _StartDate; set => SetProperty(ref _StartDate, value); }
|
|
private DateTime _StartDate = DateTime.Today;
|
|
|
|
public DateTime EndDate { get => _EndDate; set => SetProperty(ref _EndDate, value); }
|
|
private DateTime _EndDate = DateTime.Today;
|
|
|
|
public ObservableCollection<RecipeHistory> Histories { get => _Histories; set => SetProperty(ref _Histories, value); }
|
|
private ObservableCollection<RecipeHistory> _Histories;
|
|
|
|
public UCRecipeChangeHistoryViewModel(IAuroraEnvironment aurora)
|
|
{
|
|
_recipeManager = aurora.RecipeManager;
|
|
CMD_VisibleChanged = new DelegateCommand(VisibleChanged);
|
|
CMD_Search = new DelegateCommand(Search);
|
|
}
|
|
|
|
private void VisibleChanged(object obj)
|
|
{
|
|
bool visible = (bool)obj;
|
|
if (visible) {
|
|
Histories = _recipeManager.RchHandler().FromStartToEndHistory(StartDate, EndDate);
|
|
}
|
|
}
|
|
|
|
private void Search(object commandParameter)
|
|
{
|
|
Histories = _recipeManager.RchHandler().FromStartToEndHistory(StartDate, EndDate);
|
|
}
|
|
}
|
|
}
|