|
|
@@ -22,16 +22,13 @@ namespace PRSDesktop
|
|
|
"Collapsed", typeof(bool), typeof(StagingManufacturingPacketListItem),
|
|
|
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnCollapsedChanged)));
|
|
|
|
|
|
- public static readonly DependencyProperty ReadOnlyProperty = DependencyProperty.Register(
|
|
|
- "ReadOnly", typeof(bool), typeof(StagingManufacturingPacketListItem),
|
|
|
- new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnReadOnlyChanged)));
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Height of the uncollapsed stages grid.
|
|
|
/// </summary>
|
|
|
public static readonly DependencyProperty StagesGridHeightProperty = DependencyProperty.Register(
|
|
|
"StagesGridHeight", typeof(double), typeof(StagingManufacturingPacketListItem),
|
|
|
- new FrameworkPropertyMetadata(200.0));
|
|
|
+ new FrameworkPropertyMetadata(205.0));
|
|
|
|
|
|
private static BitmapImage collapsedImg = PRSDesktop.Resources.rightarrow.ToBitmapImage();
|
|
|
private static BitmapImage uncollapsedImg = PRSDesktop.Resources.downarrow.ToBitmapImage();
|
|
|
@@ -43,14 +40,9 @@ namespace PRSDesktop
|
|
|
|
|
|
//private StagingManufacturingPacketStageGrid StagesGrid;
|
|
|
|
|
|
- public event EventHandler Changed;
|
|
|
-
|
|
|
- private bool _serialChanged = false;
|
|
|
- private bool _titleChanged = false;
|
|
|
- private bool _locationChanged = false;
|
|
|
- private bool _watermarkChanged = false;
|
|
|
+ public event EventHandler? Changed;
|
|
|
+
|
|
|
private bool _itpChanged = false;
|
|
|
- private bool _qtychanged = false;
|
|
|
|
|
|
public TimeSpan TimeRequired()
|
|
|
{
|
|
|
@@ -72,16 +64,26 @@ namespace PRSDesktop
|
|
|
get => (double)GetValue(StagesGridHeightProperty);
|
|
|
set => SetValue(StagesGridHeightProperty, value);
|
|
|
}
|
|
|
-
|
|
|
- public bool ReadOnly
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsEditableProperty = DependencyProperty.Register(
|
|
|
+ nameof(IsEditable), typeof(bool), typeof(StagingManufacturingPacketListItem),
|
|
|
+ new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None));
|
|
|
+
|
|
|
+ public bool IsEditable
|
|
|
{
|
|
|
- get => (bool)GetValue(ReadOnlyProperty);
|
|
|
- set => SetValue(ReadOnlyProperty, value);
|
|
|
+ get => (bool)GetValue(IsEditableProperty);
|
|
|
+ set => SetValue(IsEditableProperty, value);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public StagingManufacturingPacketListItem(StagingManufacturingPacket packet, bool collapsed)
|
|
|
{
|
|
|
Packet = packet;
|
|
|
+ Packet.PropertyChanged += (sender, args) =>
|
|
|
+ {
|
|
|
+ SaveTemplate();
|
|
|
+ if (String.Equals(args.PropertyName, nameof(StagingManufacturingPacket.Quantity)))
|
|
|
+ BarcodeQtyPlaceHolder.Text = packet.Quantity.ToString();
|
|
|
+ };
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
@@ -91,25 +93,10 @@ namespace PRSDesktop
|
|
|
ComponentGrid.Packet = Packet;
|
|
|
TreatmentGrid.Packet = Packet;
|
|
|
|
|
|
- SerialBox.Text = Packet.Serial;
|
|
|
- _serialChanged = false;
|
|
|
-
|
|
|
- TitleBox.Text = Packet.Title;
|
|
|
- _titleChanged = false;
|
|
|
-
|
|
|
ITPCode.Text = Packet.ITP.Code;
|
|
|
ITPDescription.Text = Packet.ITP.Description;
|
|
|
_itpChanged = false;
|
|
|
|
|
|
- LocationBox.Text = Packet.Location;
|
|
|
- _locationChanged = false;
|
|
|
-
|
|
|
- WatermarkBox.Text = Packet.Watermark;
|
|
|
- _watermarkChanged = false;
|
|
|
-
|
|
|
- QtyBox.Text = Packet.Quantity.ToString();
|
|
|
- _qtychanged = false;
|
|
|
-
|
|
|
if (collapsed)
|
|
|
{
|
|
|
Collapse();
|
|
|
@@ -119,7 +106,7 @@ namespace PRSDesktop
|
|
|
Uncollapse();
|
|
|
}
|
|
|
|
|
|
- ReadOnly = packet.ManufacturingPacket.ID != Guid.Empty;
|
|
|
+ IsEditable = packet.ManufacturingPacket.ID == Guid.Empty;
|
|
|
}
|
|
|
|
|
|
private void EditButton_Click(object sender, RoutedEventArgs e)
|
|
|
@@ -229,23 +216,7 @@ namespace PRSDesktop
|
|
|
UpdateTemplateButton();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private void SerialBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
- {
|
|
|
- _serialChanged = true;
|
|
|
- }
|
|
|
-
|
|
|
- private void SerialBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- if (_serialChanged)
|
|
|
- {
|
|
|
- Packet.Serial = SerialBox.Text;
|
|
|
- SaveTemplate();
|
|
|
- _serialChanged = false;
|
|
|
- Changed?.Invoke(this, EventArgs.Empty);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
private void Collapse()
|
|
|
{
|
|
|
CollapseButton.Content = new Image { Source = collapsedImg };
|
|
|
@@ -276,40 +247,52 @@ namespace PRSDesktop
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void OnReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
|
- {
|
|
|
- var item = (StagingManufacturingPacketListItem)d;
|
|
|
- var readOnly = (bool)e.NewValue;
|
|
|
- item.StagesGrid.ReadOnly = readOnly;
|
|
|
- item.ComponentGrid.ReadOnly = readOnly;
|
|
|
- item.TreatmentGrid.ReadOnly = readOnly;
|
|
|
- item.TitleBox.IsReadOnly = !readOnly;
|
|
|
- item.ITPCode.IsReadOnly = !readOnly;
|
|
|
- item.LocationBox.IsReadOnly = !readOnly;
|
|
|
- }
|
|
|
|
|
|
- private void QtyBox_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
|
- {
|
|
|
- if (!int.TryParse(e.Text, out int _))
|
|
|
- e.Handled = true;
|
|
|
- }
|
|
|
|
|
|
- private void QtyBox_OnTextChanged(object sender, TextChangedEventArgs e)
|
|
|
- {
|
|
|
- _qtychanged = true;
|
|
|
- }
|
|
|
-
|
|
|
- private void QtyBox_OnLostFocus(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- if (_qtychanged)
|
|
|
- {
|
|
|
- int.TryParse(QtyBox.Text, out int qty);
|
|
|
- Packet.Quantity = qty;
|
|
|
- SaveTemplate();
|
|
|
- _qtychanged = false;
|
|
|
- Changed?.Invoke(this, EventArgs.Empty);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ // private void SerialBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ // {
|
|
|
+ // _serialChanged = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void SerialBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (_serialChanged)
|
|
|
+ // {
|
|
|
+ // Packet.Serial = SerialBox.Text;
|
|
|
+ // SaveTemplate();
|
|
|
+ // _serialChanged = false;
|
|
|
+ // Changed?.Invoke(this, EventArgs.Empty);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void QtyBox_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (!int.TryParse(e.Text, out int _))
|
|
|
+ // e.Handled = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void QtyBox_OnTextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ // {
|
|
|
+ // _qtychanged = true;
|
|
|
+ // if (String.IsNullOrWhiteSpace(BarcodeQtyBox.Text) || String.Equals(QtyBox.Text, BarcodeQtyBox.Text))
|
|
|
+ // {
|
|
|
+ // BarcodeQtyBox.Text = QtyBox.Text;
|
|
|
+ // _barcodeQtyChanged = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void QtyBox_OnLostFocus(object sender, RoutedEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (_qtychanged)
|
|
|
+ // {
|
|
|
+ // int.TryParse(QtyBox.Text, out int qty);
|
|
|
+ // Packet.Quantity = qty;
|
|
|
+ // SaveTemplate();
|
|
|
+ // _qtychanged = false;
|
|
|
+ // Changed?.Invoke(this, EventArgs.Empty);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
private void DetailGrid_OnAfterRefresh(object sender, AfterRefreshEventArgs args)
|
|
|
{
|
|
|
@@ -321,54 +304,21 @@ namespace PRSDesktop
|
|
|
Changed?.Invoke(this, EventArgs.Empty);
|
|
|
}
|
|
|
|
|
|
- private void TitleBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
- {
|
|
|
- _titleChanged = true;
|
|
|
- }
|
|
|
-
|
|
|
- private void TitleBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- if (_titleChanged)
|
|
|
- {
|
|
|
- Packet.Title = TitleBox.Text;
|
|
|
- SaveTemplate();
|
|
|
- Changed?.Invoke(this, EventArgs.Empty);
|
|
|
- _titleChanged = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void LocationBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
- {
|
|
|
- _locationChanged = true;
|
|
|
- }
|
|
|
-
|
|
|
- private void LocationBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- if (_locationChanged)
|
|
|
- {
|
|
|
- Packet.Location = LocationBox.Text;
|
|
|
- SaveTemplate();
|
|
|
- _locationChanged = false;
|
|
|
- Changed?.Invoke(this, EventArgs.Empty);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void WatermarkBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
- {
|
|
|
- _watermarkChanged = true;
|
|
|
- }
|
|
|
-
|
|
|
- private void WatermarkBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- if (_watermarkChanged)
|
|
|
- {
|
|
|
- Packet.Watermark = WatermarkBox.Text;
|
|
|
- SaveTemplate();
|
|
|
- _watermarkChanged = false;
|
|
|
- Changed?.Invoke(this, EventArgs.Empty);
|
|
|
- }
|
|
|
- }
|
|
|
+ // private void TitleBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ // {
|
|
|
+ // _titleChanged = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void TitleBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (_titleChanged)
|
|
|
+ // {
|
|
|
+ // Packet.Title = TitleBox.Text;
|
|
|
+ // SaveTemplate();
|
|
|
+ // Changed?.Invoke(this, EventArgs.Empty);
|
|
|
+ // _titleChanged = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
private void ITPCode_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
{
|
|
|
@@ -450,5 +400,61 @@ namespace PRSDesktop
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ // private void LocationBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ // {
|
|
|
+ // _locationChanged = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void LocationBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (_locationChanged)
|
|
|
+ // {
|
|
|
+ // Packet.Location = LocationBox.Text;
|
|
|
+ // SaveTemplate();
|
|
|
+ // _locationChanged = false;
|
|
|
+ // Changed?.Invoke(this, EventArgs.Empty);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // private void WatermarkBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ // {
|
|
|
+ // _watermarkChanged = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void WatermarkBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (_watermarkChanged)
|
|
|
+ // {
|
|
|
+ // Packet.Watermark = WatermarkBox.Text;
|
|
|
+ // SaveTemplate();
|
|
|
+ // _watermarkChanged = false;
|
|
|
+ // Changed?.Invoke(this, EventArgs.Empty);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void BarcodeQtyBox_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (!int.TryParse(e.Text, out int _))
|
|
|
+ // e.Handled = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void BarcodeQtyBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
+ // {
|
|
|
+ // _barcodeQtyChanged = true;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // private void BarcodeQtyBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
+ // {
|
|
|
+ // if (_barcodeQtyChanged)
|
|
|
+ // {
|
|
|
+ // int.TryParse(BarcodeQtyBox.Text, out int barcodes);
|
|
|
+ // Packet.BarcodeQuantity = barcodes;
|
|
|
+ // SaveTemplate();
|
|
|
+ // _barcodeQtyChanged = false;
|
|
|
+ // Changed?.Invoke(this, EventArgs.Empty);
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // }
|
|
|
}
|
|
|
}
|