first commit
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using JSMachine.WMS.Storage.BusinessModules.Views;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
using static JSMachine.WMS.Common.EventBus.HotKeyEventBus;
|
||||
|
||||
namespace JSMachine.WMS.Storage.BusinessModules.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// HomePage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class HomePage : Page
|
||||
{
|
||||
private static IEventAggregator _eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
|
||||
public bool IsMainWindows { get; set; } = true;
|
||||
|
||||
private LinearGradientBrush ActiveBrush = new();
|
||||
public HomePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Init();
|
||||
RegisterHotKey();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册快捷键
|
||||
/// </summary>
|
||||
private void RegisterHotKey()
|
||||
{
|
||||
////没有权限点击的按钮不允许使用快捷键
|
||||
//_eventAggregator.GetEvent<ProductionHomeHotKeyEvent>().Subscribe(() =>
|
||||
//{
|
||||
// if (this.ButtonHome.Visibility == Visibility.Visible && this.ButtonHome.IsEnabled)
|
||||
// this.ButtonHome.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
//});
|
||||
|
||||
//_eventAggregator.GetEvent<OrderManageHotKeyEvent>().Subscribe(() =>
|
||||
//{
|
||||
// if (this.ButtonOrder.Visibility == Visibility.Visible && this.ButtonOrder.IsEnabled)
|
||||
// this.ButtonOrder.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
//});
|
||||
}
|
||||
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//Page_Change.Content = new ProductionHomeView() { };
|
||||
ActiveBrush.StartPoint = new Point(0, 0);
|
||||
ActiveBrush.EndPoint = new Point(0, 1);
|
||||
ActiveBrush.Opacity = 1;
|
||||
ActiveBrush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#111111"), offset: 0));
|
||||
ActiveBrush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#999999"), offset: 0.5));
|
||||
ActiveBrush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#111111"), offset: 1));
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//ButtonHome.Background = ActiveBrush;//主页默认选中黑色
|
||||
//ButtonHome.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
|
||||
}
|
||||
|
||||
public void TabClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button button = (Button)e.OriginalSource;
|
||||
ShowButtonBlack();
|
||||
button.Background = ActiveBrush;
|
||||
button.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
|
||||
switch (button.Name)
|
||||
{
|
||||
case "ButtonHome":
|
||||
{
|
||||
Page_Change.Content = new PaperStorageView() { };
|
||||
};
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowButtonBlack()
|
||||
{
|
||||
LinearGradientBrush brush = new LinearGradientBrush();
|
||||
brush.StartPoint = new Point(0, 0);
|
||||
brush.EndPoint = new Point(0, 1);
|
||||
brush.Opacity = 1;
|
||||
brush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#BBBBBB"), offset: 0));
|
||||
brush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#FFFFFF"), offset: 0.5));
|
||||
brush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#BBBBBB"), offset: 1));
|
||||
|
||||
//for (int i = 0; i < ButtonContainer.Children.Count; i++)
|
||||
//{
|
||||
// Button button = ButtonContainer.Children[i] as Button;
|
||||
// button.Background = brush;
|
||||
// button.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("Black"));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user