Major upgrade

This commit is contained in:
Duc
2025-10-24 15:18:11 -07:00
parent fd85735c93
commit ce583d1664
478 changed files with 237518 additions and 47610 deletions

View File

@@ -1,8 +1,26 @@
using ProgramLib.GUI.ViewModel;
/*-------------------------------------------------------------------------
// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using System;
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Media.Imaging;
using ProgramLib.GUI.Model;
using ProgramLib.GUI.ViewModel;
namespace ProgramLib.GUI.View
{
@@ -13,11 +31,13 @@ namespace ProgramLib.GUI.View
{
internal ImpedanceCheckWindowViewModel ViewModel { get; set; }
private double _previousWindowWidth = -1.0;
public ImpedanceCheckWindow()
{
InitializeComponent();
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
this.Icon = BitmapFrame.Create(iconUri);
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
@@ -53,7 +73,35 @@ namespace ProgramLib.GUI.View
{
// scroll the new item into view
lvImpedanceCheck.ScrollIntoView(e.NewItems[0]);
ResizeWindowToFitContent();
}
}
/// <summary>
/// Resize window to fit variable text length
/// </summary>
private void ResizeWindowToFitContent()
{
bool resizeWindow = false;
double textLength = ProgramLib.GUI.Util.MeasureString(((ImpedanceDataModel)lvImpedanceCheck.Items[lvImpedanceCheck.Items.Count - 1]).Description).Width;
double padding = 90.0;
double requiredWith = textLength + padding;
if (lvImpedanceCheck.Items.Count > 1)
{
if (requiredWith > this.Width)
resizeWindow = true;
}
else
{
_previousWindowWidth = this.Width;
resizeWindow = true;
}
if (resizeWindow)
this.Width = requiredWith;
}
}
}