Files

65 lines
1.5 KiB
C#

using AllBase.Model.DBModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _29WxOrderWpf.Ctrls.OrderCtrls;
/// <summary>
/// OrderTransitListCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderTransitListCtrl : UserControl
{
OrderTransitListCtrlViewModel ViewModel;
public OrderTransitListCtrl(oms_wei_order_item_transit_model transitInfo)
{
InitializeComponent();
UpdateViewModel(transitInfo);
}
public void UpdateViewModel(oms_wei_order_item_transit_model transitInfo)
{
ViewModel = new OrderTransitListCtrlViewModel(transitInfo);
ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
this.lbxTransitList.ItemsSource = ViewModel.TransitInfo.OrderItemTransitDetailList;
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
}
private void OrderTransitListCtrl_Loaded(object sender, RoutedEventArgs e)
{
Window parentWindow = Window.GetWindow(this);
if (parentWindow != null)
{
parentWindow.Closed += ChangeWaybillView_Closed;
}
ViewModel.Start();
}
private void ChangeWaybillView_Closed(object sender, EventArgs e)
{
ViewModel.Stop();
}
}