public ProcessManagerServiceHandler CreateServiceHandler(IProcessManagerEventHandler processManagerEventHandler, Machine machine)
        {
            ProcessManagerServiceHandler serviceHandler = new ProcessManagerServiceHandler(processManagerEventHandler, machine);

            serviceHandler.InitializationCompleted += ServiceHandler_InitializationCompleted;
            serviceHandler.ConnectionChanged       += ServiceHandler_ConnectionChanged;
            return(serviceHandler);
        }
        private static void ModifyMachineConfiguration(ProcessManagerServiceHandler serviceHandler, bool retrieve)
        {
            MachineConnection machineConnection = ConnectionStore.Connections.Values.FirstOrDefault(x => x.ServiceHandler == serviceHandler);

            if (machineConnection == null)
            {
                return;
            }

            try
            {
                machineConnection.Configuration = retrieve ? machineConnection.ServiceHandler.Service.GetConfiguration().FromDTO() : null;
            }
            catch (Exception ex)
            {
                Logger.Add("Failed to retrieve machine configuration", ex);
            }
        }
 private void RaiseServiceHandlerConnectionChangedEvent(ProcessManagerServiceHandler serviceHandler, ProcessManagerServiceHandlerStatus status, Exception exception = null)
 {
     ServiceHandlerConnectionChanged?.Invoke(this, new ServiceHandlerConnectionChangedEventArgs(serviceHandler, status, exception));
 }