From 03f71a5d64f3f01b607d64b03f2414f46199557d Mon Sep 17 00:00:00 2001 From: chfei Date: Wed, 7 Oct 2026 16:16:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=EF=BC=8C=E5=A4=8D=E5=88=B6=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E3=80=82window=E5=B1=82=E7=BA=A7=20=E5=A2=9E=E5=8A=A0=20toast?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20=E5=8F=AF=E4=BB=A5=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=E5=9F=9F=E4=BB=BB=E4=BD=95window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 29WxOrderWpf/Common/DialogWindow.xaml.cs | 4 +- .../Ctrls/OrderCtrls/OrderListCtrl.Command.cs | 10 +- .../Models/ShopRevenueStatisticsModels.cs | 1 + .../Statistics/RevenueSummaryCards.xaml.cs | 1 + .../Statistics/ShopRevenueStatisticsView.xaml | 10 +- .../ShopRevenueStatisticsView.xaml.cs | 7 +- .../Ctrls/Statistics/ShowOrderDialogView.xaml | 34 +++- .../Statistics/ShowOrderDialogView.xaml.cs | 78 ++++++++- .../ShopRevenueStatisticsViewModel.cs | 7 +- 29WxOrderWpf/ToolCtrls/ToastHelper.cs | 161 ++++++++++++++++++ 10 files changed, 286 insertions(+), 27 deletions(-) create mode 100644 29WxOrderWpf/ToolCtrls/ToastHelper.cs 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 @@ - + + + + + + + + + +