diff --git a/Common/Production/ProductionUiCordonel/Event/StringArgs.cs b/Common/Production/ProductionUiCordonel/Event/StringArgs.cs deleted file mode 100644 index 06808c93..00000000 --- a/Common/Production/ProductionUiCordonel/Event/StringArgs.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Xylem.Common.Production.ProductionUiCordonel.Event -{ - public class StringArgs : EventArgs - { - public readonly String Content; - public StringArgs(String content) - { - Content = content; - } - } -} diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs index 46bf77d6..1491b865 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/BaseProductionProcess.cs @@ -168,6 +168,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// public event EventHandler OnProcessProgressChanged; + + /// + public event EventHandler OnGuiMessageDispatcher; #endregion --------------------------------------- Variables -------------------------------------------------- #region ------------------------------------------ Init ------------------------------------------------------- @@ -290,6 +293,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses OnProcessStateChanged?.Invoke(sender, new SingleProcessStateArgs(state)); } + /// + /// Fire event for GUI messages + /// + /// + protected void DispatchGuiMessage(GuiMessageArgs args) + { + OnGuiMessageDispatcher?.Invoke(this, args); + } + /// public void StartProcess(ProcessState? successExitState, ProcessState errorExitState = ProcessState.Error, ProcessState breakExitState = ProcessState.AbortTest) diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/Enum/GuiItem.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/Enum/GuiItem.cs new file mode 100644 index 00000000..846dd084 --- /dev/null +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/Enum/GuiItem.cs @@ -0,0 +1,17 @@ +namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum +{ + /// + /// Items to dispatch as message to the GUI + /// + public enum GuiItem + { + /// + /// Order amount of Cordonels + /// + OrderAmount, + /// + /// Counter of Cordonels for this order + /// + OrderCounter + } +} \ No newline at end of file diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/GuiMessageArgs.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/GuiMessageArgs.cs new file mode 100644 index 00000000..965ca3ec --- /dev/null +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/GuiMessageArgs.cs @@ -0,0 +1,27 @@ +using System; +using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum; + +namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EventArgs +{ + /// + /// Logging messages with a specific color for output to GUI as user information. + /// + public class GuiMessageArgs : System.EventArgs + { + public readonly String Message; + public readonly GuiItem GuiItem; + public readonly Int64? Int64Value; + /// + /// Message dispatcher event arguments for GUI display + /// + /// identifier to specify the GUI item + /// + /// + public GuiMessageArgs(GuiItem guiItem, String message = "", Int64? int64Value = null) + { + GuiItem = guiItem; + Message = message; + Int64Value = int64Value; + } + } + } diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessLogArgs.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessLogArgs.cs index a6fa781d..fefebe57 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessLogArgs.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessLogArgs.cs @@ -2,7 +2,11 @@ using System.Windows.Media; namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EventArgs -{ public class ProcessLogArgs : System.EventArgs +{ + /// + /// Logging a text with a specific color for output to GUI as user information. + /// + public class ProcessLogArgs : System.EventArgs { public readonly String Data; public readonly SolidColorBrush Color; diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessProgressArgs.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessProgressArgs.cs index 46a18003..c918ab77 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessProgressArgs.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EventArgs/ProcessProgressArgs.cs @@ -2,6 +2,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EventArgs { + /// + /// Process progress to feed the progress bar. + /// public class ProcessProgressArgs : System.EventArgs { public enum ProcessProgressType diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs index 9bf5a649..62cb3390 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/IProductionProcess.cs @@ -39,6 +39,11 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// event EventHandler OnProcessProgressChanged; + /// + /// Send messages to GUI + /// + event EventHandler OnGuiMessageDispatcher; + /// /// State of single production process /// diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs index 5dec885d..ff7ec872 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs @@ -5,6 +5,7 @@ using Xylem.Common.CommonCore.Configuration; using Xylem.Common.CommonCore.Consts; using Xylem.Common.Logic.SoftwareAccessHelper; using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum; +using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EventArgs; using Xylem.Common.Production.ProductionUiCordonel.Properties; using Xylem.Common.Production.ProductionUiCordonel.UserControls; @@ -111,6 +112,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki ActualProcessProgress++; // Display order overview in GUI + DispatchGuiMessage(new GuiMessageArgs(GuiItem.OrderAmount, null, orderSize )); + DispatchGuiMessage(new GuiMessageArgs(GuiItem.OrderCounter, null, assignedPicking )); // Exit if order is complete diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs index b0aef037..64d76e62 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs @@ -85,6 +85,11 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// public event EventHandler OnProcessProgressChanged; + /// + /// Dispatch a message to the GUI + /// + public event EventHandler OnGuiMessageDispatcher; + // cancellation token private CancellationTokenSource _cancellationTokenSource; private CancellationToken _cancellationToken; @@ -254,6 +259,11 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses OnProcessProgressChanged?.Invoke(sender, e); } + private void GuiMessageDispatcher_Handler(Object sender, GuiMessageArgs e) + { + OnGuiMessageDispatcher?.Invoke(sender, e); + } + private void ProcessLog_Handler(Object sender, ProcessLogArgs e) { OnProcessLogRequest?.Invoke(sender, e); @@ -812,6 +822,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses if (process == null) return; + process.OnGuiMessageDispatcher += GuiMessageDispatcher_Handler; process.OnProcessProgressChanged += ProcessProgress_Handler; process.OnProcessLogRequest += ProcessLog_Handler; process.OnProcessStateChanged += ProcessStateChanged_Handler; @@ -827,6 +838,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses if (process == null) return; + process.OnGuiMessageDispatcher -= GuiMessageDispatcher_Handler; process.OnProcessProgressChanged -= ProcessProgress_Handler; process.OnProcessLogRequest -= ProcessLog_Handler; process.OnProcessStateChanged -= ProcessStateChanged_Handler; diff --git a/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj b/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj index 3ad7c80c..cad615af 100644 --- a/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj +++ b/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj @@ -141,8 +141,10 @@ Properties\SharedAssemblyInfo.cs + + @@ -162,7 +164,6 @@ - diff --git a/Common/Production/ProductionUiCordonel/ProductionWindow.xaml b/Common/Production/ProductionUiCordonel/ProductionWindow.xaml index 55b92026..e48305ac 100644 --- a/Common/Production/ProductionUiCordonel/ProductionWindow.xaml +++ b/Common/Production/ProductionUiCordonel/ProductionWindow.xaml @@ -105,25 +105,27 @@ -