using Aucma.Core.PrintTo.Models;
using Aucma.Core.PrintTo.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.Metrics;
using System.Drawing.Imaging;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
/*
* 首页信息
*
*/
namespace Aucma.Core.PrintTo.ViewModels
{
public partial class HomeWindowViewModel : ObservableObject
{
public HomeWindowViewModel()
{
LoadData();
}
#region 加载DataGrid数据
private void LoadData()
{
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-07", material_code = "2135556", material_name = "内胆" });
}
#endregion
#region 查询按钮
///
/// 查询
///
[RelayCommand]
private void QueryString(string queryStr)
{
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
if (!string.IsNullOrEmpty(queryStr))
{
Datalist.Clear();
//Datalist.Add(new OrderInfo() { OrderTime = "2023-10-06", material_code = "123456", material_name = "箱体", PrintName = queryStr });
}
else
{
Datalist.Clear();
LoadData();
}
//Datalist.Insert(0, Datalist[Datalist.Count - 1]);
//Datalist.RemoveAt(Datalist.Count - 1);
}));
}
#endregion
#region 打印
///
/// 打印
///
[RelayCommand]
private void Print()
{
MessageBox.Show("打印");
PrintToDevView window=new PrintToDevView();
window.ShowDialog();
}
#endregion
#region 重打
///
///重打
///
[RelayCommand]
private void Reprint()
{
MessageBox.Show("重打");
// OrderInfo info = new OrderInfo();
}
#endregion
#region 补打
///
///补打
///
[RelayCommand]
private void SupplementaryPrint()
{
MessageBox.Show("补打");
// OrderInfo info = new OrderInfo();
}
#endregion
#region 续打
///
///续打
///
[RelayCommand]
private void ContinuedPrint()
{
MessageBox.Show("续打");
// OrderInfo info = new OrderInfo();
}
#endregion
#region 初始化datagrid
private ObservableCollection datalist = new ObservableCollection();
public ObservableCollection Datalist
{
get { return datalist; }
set
{
datalist = value;
OnPropertyChanged();//属性通知
}
}
#endregion
#region 获取当前行数据 赋值到textbox
private OrderInfo selectedCells;
public OrderInfo SelectedCells
{
get { return selectedCells; }
set
{
selectedCells = value;
SetProperty(ref selectedCells, value);
}
}
#endregion
}
}