diff --git a/29WxOrderWpf/Common/DialogWindow.xaml.cs b/29WxOrderWpf/Common/DialogWindow.xaml.cs index 4cfd2aa..b650996 100644 --- a/29WxOrderWpf/Common/DialogWindow.xaml.cs +++ b/29WxOrderWpf/Common/DialogWindow.xaml.cs @@ -19,10 +19,10 @@ namespace _29WxOrderWpf.Common private readonly Style dialogWindowStyle; private bool isConstructorSuccessful = false; private UserControl _content; - public DialogWindow() + public DialogWindow(Window owner = null) { InitializeComponent(); - Owner = Application.Current.MainWindow; + Owner = owner ?? Application.Current.MainWindow; isConstructorSuccessful = true; dialogWindowStyle = (Style)TryFindResource("DialogWindowStyle"); Loaded += DialogWindow_Loaded; diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.Command.cs b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.Command.cs index 1b0753e..58f7e0b 100644 --- a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.Command.cs +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.Command.cs @@ -22,22 +22,18 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls; public partial class OrderListCtrl { #region 统计 - private DialogWindow _statisticsDialog; + private ShopRevenueStatisticsView _statisticsDialog; public ICommand ShowShopRevenueStatisticsDialogViewCommand => new DelegateCommand(ShowShopRevenueStatisticsDialogView); private void ShowShopRevenueStatisticsDialogView() { if (_statisticsDialog == null) { - _statisticsDialog = new DialogWindow() - { - Title = "统计", - Content = new ShopRevenueStatisticsView(), - - }; + _statisticsDialog =new ShopRevenueStatisticsView(); _statisticsDialog.Closed += (s, e) => _statisticsDialog = null; } _statisticsDialog.Show(); + _statisticsDialog.Activate(); } #endregion diff --git a/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs b/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs index 6171f7f..3094804 100644 --- a/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs +++ b/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs @@ -1,6 +1,7 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; +using WPFCommon.Models; namespace _29WxOrderWpf.Ctrls.Statistics.Models { diff --git a/29WxOrderWpf/Ctrls/Statistics/RevenueSummaryCards.xaml.cs b/29WxOrderWpf/Ctrls/Statistics/RevenueSummaryCards.xaml.cs index 2a9dba2..b65ae3d 100644 --- a/29WxOrderWpf/Ctrls/Statistics/RevenueSummaryCards.xaml.cs +++ b/29WxOrderWpf/Ctrls/Statistics/RevenueSummaryCards.xaml.cs @@ -13,5 +13,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics { InitializeComponent(); } + } } \ No newline at end of file diff --git a/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml b/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml index a01248e..6ab7470 100644 --- a/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml +++ b/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml @@ -1,4 +1,4 @@ - - + @@ -119,7 +117,7 @@ - + @@ -348,4 +346,4 @@ - + diff --git a/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml.cs b/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml.cs index 3da6c30..9bedc55 100644 --- a/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml.cs +++ b/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml.cs @@ -1,4 +1,5 @@ -using System.Windows.Controls; +using System.Windows; +using System.Windows.Controls; using _29WxOrderWpf.Ctrls.Statistics.ViewModels; namespace _29WxOrderWpf.Ctrls.Statistics @@ -9,7 +10,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics /// 如需注入自定义数据服务,请使用 /// new ShopRevenueStatisticsView(new ShopRevenueStatisticsViewModel(你的 IShopRevenueStatisticsService 实现))。 /// - public partial class ShopRevenueStatisticsView : UserControl + public partial class ShopRevenueStatisticsView : Window { public ShopRevenueStatisticsView() : this(new ShopRevenueStatisticsViewModel()) @@ -19,7 +20,9 @@ namespace _29WxOrderWpf.Ctrls.Statistics public ShopRevenueStatisticsView(ShopRevenueStatisticsViewModel viewModel) { InitializeComponent(); + viewModel.GetWindow = () => this; DataContext = viewModel; + } private void help_mouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) diff --git a/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml b/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml index 6eb7118..460362c 100644 --- a/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml +++ b/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml @@ -5,9 +5,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.Statistics" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:wpf="WPFCommon" d:Background="White" d:DesignHeight="450" d:DesignWidth="800" + Focusable="True" mc:Ignorable="d"> @@ -16,11 +18,34 @@ - + + + + + + + + + +