|
|
|
|
using Sln.Wcs.UI.Attribute;
|
|
|
|
|
using Sln.Wcs.UI.Page.BasicInfo;
|
|
|
|
|
using Sln.Wcs.UI.Page.BasicInfo.DeviceInfo;
|
|
|
|
|
using Sln.Wcs.UI.Page.Home;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
|
|
using System.Windows.Media.Animation;
|
|
|
|
|
|
|
|
|
|
namespace Sln.Wcs.UI
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
[RegisterAsSingletonAttribute]
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
|
|
|
|
private HomePage _homePage;
|
|
|
|
|
private BasicInfoPage _basicInfoPage;
|
|
|
|
|
private DeviceInfoPage _deviceInfoPage;
|
|
|
|
|
|
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_homePage = new HomePage();
|
|
|
|
|
_basicInfoPage = new BasicInfoPage();
|
|
|
|
|
_deviceInfoPage = new DeviceInfoPage();
|
|
|
|
|
MainContent.Content = _homePage;
|
|
|
|
|
|
|
|
|
|
BtnBasicInfo.Checked += BtnBasicInfo_Checked;
|
|
|
|
|
BtnBasicInfo.Unchecked += BtnBasicInfo_Unchecked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnHome_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
MainContent.Content = _homePage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnBasicInfo_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
MainContent.Content = _basicInfoPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnBasicInfo_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DropPanelPopup.IsOpen = true;
|
|
|
|
|
ShowDropPanel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnBasicInfo_Unchecked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
HideDropPanel(() => DropPanelPopup.IsOpen = false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DropPanel_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BtnBasicInfo.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShowDropPanel()
|
|
|
|
|
{
|
|
|
|
|
var fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut } };
|
|
|
|
|
var slideIn = new DoubleAnimation(-15, 0, TimeSpan.FromMilliseconds(250)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut } };
|
|
|
|
|
|
|
|
|
|
DropPanel.BeginAnimation(OpacityProperty, fadeIn);
|
|
|
|
|
DropPanel.RenderTransform = new System.Windows.Media.TranslateTransform(0, -15);
|
|
|
|
|
DropPanel.RenderTransform.BeginAnimation(System.Windows.Media.TranslateTransform.YProperty, slideIn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HideDropPanel(Action onComplete)
|
|
|
|
|
{
|
|
|
|
|
var fadeOut = new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(150)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseIn } };
|
|
|
|
|
var slideOut = new DoubleAnimation(0, -15, TimeSpan.FromMilliseconds(150)) { EasingFunction = new CubicEase { EasingMode = EasingMode.EaseIn } };
|
|
|
|
|
|
|
|
|
|
fadeOut.Completed += (s, e) => onComplete?.Invoke();
|
|
|
|
|
|
|
|
|
|
DropPanel.BeginAnimation(OpacityProperty, fadeOut);
|
|
|
|
|
DropPanel.RenderTransform = new System.Windows.Media.TranslateTransform(0, 0);
|
|
|
|
|
DropPanel.RenderTransform.BeginAnimation(System.Windows.Media.TranslateTransform.YProperty, slideOut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnDeviceInfo_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BtnBasicInfo.IsChecked = false;
|
|
|
|
|
MainContent.Content = _deviceInfoPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnMaterialInfo_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BtnBasicInfo.IsChecked = false;
|
|
|
|
|
MainContent.Content = _basicInfoPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnWarehouseInfo_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BtnBasicInfo.IsChecked = false;
|
|
|
|
|
MainContent.Content = _basicInfoPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnLocationInfo_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BtnBasicInfo.IsChecked = false;
|
|
|
|
|
MainContent.Content = _basicInfoPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnExit_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Application.Current.Shutdown();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|