Files
29WxOrder/29WxOrderWpf/Ctrls/Statistics/ShopRevenueStatisticsView.xaml.cs
T
2026-10-07 16:16:55 +08:00

51 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Windows;
using System.Windows.Controls;
using _29WxOrderWpf.Ctrls.Statistics.ViewModels;
namespace _29WxOrderWpf.Ctrls.Statistics
{
/// <summary>
/// 店铺营收统计页面(MVVM)。
/// 页面不写业务逻辑,只负责绑定 ShopRevenueStatisticsViewModel;
/// 如需注入自定义数据服务,请使用
/// new ShopRevenueStatisticsView(new ShopRevenueStatisticsViewModel(你的 IShopRevenueStatisticsService 实现))。
/// </summary>
public partial class ShopRevenueStatisticsView : Window
{
public ShopRevenueStatisticsView()
: this(new ShopRevenueStatisticsViewModel())
{
}
public ShopRevenueStatisticsView(ShopRevenueStatisticsViewModel viewModel)
{
InitializeComponent();
viewModel.GetWindow = () => this;
DataContext = viewModel;
}
private void help_mouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
InfoPopup.IsOpen = true;
}
private void close(object sender, System.Windows.RoutedEventArgs e)
{
InfoPopup.IsOpen = false;
}
private void TabControl_Selected(object sender, System.Windows.RoutedEventArgs e)
{
}
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems != null && e.AddedItems.Count > 0 && e.AddedItems[0] is TabItem tab && tab.Content is PeriodRevenueStatisticsView view && view.DataContext is PeriodRevenueStatisticsViewModel vm)
{
vm.Init();
}
}
}
}