AWGMappingWindow.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using Comal.Classes;
  8. using InABox.Core;
  9. using InABox.Integration.Awg;
  10. using InABox.Integration.Logikal;
  11. using PRSDesktop.Integrations.Logikal;
  12. namespace PRSDesktop.Integrations.Common;
  13. public partial class AWGMappingWindow : Window
  14. {
  15. private readonly Action<ProductLink,ProductStyleLink?,IBaseDimensions,double,double>? _partsCallback;
  16. private readonly Action<ActivityLink,TimeSpan, double>? _labourCallback;
  17. public AWGMappingWindow(
  18. IntegrationSourceType sourceType,
  19. IEnumerable<IAwgStyle> styles,
  20. IEnumerable<IAwgGroup> groups,
  21. IEnumerable<IAwgSupplier> suppliers,
  22. IEnumerable<IAwgProfile> profiles,
  23. IEnumerable<IAwgGasket> gaskets,
  24. IEnumerable<IAwgComponent> components,
  25. IEnumerable<IAwgGlass> glass,
  26. IEnumerable<IAwgLabour> labour,
  27. Action<ProductLink,ProductStyleLink?,IBaseDimensions,double,double>? partsCallback,
  28. Action<ActivityLink,TimeSpan, double>? labourCallback)
  29. {
  30. InitializeComponent();
  31. _partsCallback = partsCallback;
  32. _labourCallback = labourCallback;
  33. ViewModel.SourceType = sourceType;
  34. ViewModel.Styles = styles;
  35. ViewModel.Groups = groups;
  36. ViewModel.Suppliers = suppliers;
  37. ViewModel.Profiles = profiles;
  38. ViewModel.Gaskets = gaskets;
  39. ViewModel.Components = components;
  40. ViewModel.Glass = glass;
  41. ViewModel.Labour = labour;
  42. }
  43. private void CancelClick(object sender, RoutedEventArgs e)
  44. {
  45. DialogResult = false;
  46. }
  47. private void OKClick(object sender, RoutedEventArgs e)
  48. {
  49. ViewModel.GetParts(_partsCallback,_labourCallback);
  50. //ViewModel.CreateBOM();
  51. DialogResult = true;
  52. }
  53. public void GetParts<TProfile, TGasket, TComponent, TGlass, TLabour>(
  54. IEnumerable<TProfile>? profiles,
  55. IEnumerable<TGasket>? gaskets,
  56. IEnumerable<TComponent>? components,
  57. IEnumerable<TGlass>? glasses,
  58. IEnumerable<TLabour>? labour,
  59. Action<ProductLink, ProductStyleLink?, IBaseDimensions, double, double>? productCallback,
  60. Action<ActivityLink, TimeSpan, double>? labourCallback)
  61. where TProfile : IAwgProfile
  62. where TGasket : IAwgGasket
  63. where TComponent : IAwgComponent
  64. where TGlass : IAwgGlass
  65. where TLabour : IAwgLabour
  66. {
  67. ViewModel.GetParts(profiles, gaskets, components, glasses, labour, productCallback, labourCallback);
  68. }
  69. private void BaseDynamicGrid_OnOnChanged(object? sender, EventArgs e)
  70. {
  71. ViewModel.CheckChanged();
  72. }
  73. }