|
@@ -20,6 +20,19 @@ namespace UniformMaterialManagementSystem.Views
|
|
|
InitializeComponent();
|
|
|
|
|
|
this.DataContext = App.Current.Services.GetService(typeof(MainWindowViewModel));
|
|
|
+
|
|
|
+ HoverButton.Content = App.CurrentUser?.UserName[0];
|
|
|
+
|
|
|
+ WorkYear.Content = App.CurrentUser?.WorkYear;
|
|
|
+ LoginAccount.Content = App.CurrentUser?.UserName;
|
|
|
+ Company.Content = App.CurrentUser?.Company?.Name;
|
|
|
+ SupervisionUnit.Content = App.CurrentUser?.SupervisionUnit.Name;
|
|
|
+
|
|
|
+ Company.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
|
|
+ SupervisionUnit.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
|
|
+ WorkYearLabel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
|
|
+
|
|
|
+ InfoPopupGroupBox.Width = Math.Max(Math.Ceiling(Company.DesiredSize.Width), Math.Ceiling(SupervisionUnit.DesiredSize.Width)) + Math.Ceiling(WorkYearLabel.DesiredSize.Width) + 20;
|
|
|
}
|
|
|
|
|
|
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
|
@@ -110,9 +123,9 @@ namespace UniformMaterialManagementSystem.Views
|
|
|
protected override void OnSourceInitialized(EventArgs e)
|
|
|
{
|
|
|
base.OnSourceInitialized(e);
|
|
|
-
|
|
|
+
|
|
|
var presentationSource = PresentationSource.FromVisual(this);
|
|
|
- if (presentationSource==null) return;
|
|
|
+ if (presentationSource == null) return;
|
|
|
|
|
|
var source = (HwndSource)presentationSource;
|
|
|
source.AddHook(HookProc);
|
|
@@ -121,9 +134,9 @@ namespace UniformMaterialManagementSystem.Views
|
|
|
public static IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
|
|
{
|
|
|
if (msg != WmGetMinMaxInfo) return IntPtr.Zero;
|
|
|
-
|
|
|
+
|
|
|
var structure = Marshal.PtrToStructure(lParam, typeof(MinMaxInfo));
|
|
|
- if(structure == null) return IntPtr.Zero;
|
|
|
+ if (structure == null) return IntPtr.Zero;
|
|
|
|
|
|
var mmi = (MinMaxInfo)structure;
|
|
|
var monitor = MonitorFromWindow(hWnd, MonitorDefaultTonNearest);
|
|
@@ -192,5 +205,15 @@ namespace UniformMaterialManagementSystem.Views
|
|
|
public Point ptMinTrackSize;
|
|
|
public Point ptMaxTrackSize;
|
|
|
}
|
|
|
+
|
|
|
+ private void HoverButton_OnMouseEnter(object sender, MouseEventArgs e)
|
|
|
+ {
|
|
|
+ InfoPopup.IsOpen = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void HoverButton_OnMouseLeave(object sender, MouseEventArgs e)
|
|
|
+ {
|
|
|
+ InfoPopup.IsOpen = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|