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; /// /// OrderTransitListCtrl.xaml 的交互逻辑 /// public partial class OrderTransitListCtrl : UserControl { OrderTransitListCtrlViewModel ViewModel; public OrderTransitListCtrl(oms_wei_order_item_transit_info transitInfo) { InitializeComponent(); 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(); } }