/// <summary>
 /// Initializes a new instance of the <see cref="BinaryUDPPackageReader"/> class.
 /// </summary>
 /// <param name="port">The port.</param>
 /// <param name="trace">The trace.</param>
 public BinaryUDPPackageReader(IUADecoder uaDecoder, int port, Action <string> trace, IConsumerViewModel viewModel) : base(uaDecoder)
 {
     State       = new MyState(this);
     m_Trace     = trace;
     m_UDPPort   = port;
     m_ViewModel = viewModel;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryUDPPackageReader"/> class.
 /// </summary>
 /// <param name="port">The port.</param>
 /// <param name="trace">The trace.</param>
 public BinaryUDPPackageReader(IUADecoder uaDecoder, int port, Action<string> trace, IConsumerViewModel viewModel)
     : base(uaDecoder)
 {
     State = new MyState(this);
       m_Trace = trace;
       m_UDPPort = port;
       m_ViewModel = viewModel;
 }
        /// <summary>
        /// Starts this instance - Initializes the data set infrastructure, enables all associations and starts pumping the data;
        /// </summary>
        /// <param name="consumerViewModel">View model which should receive subscriptions and then handle them</param>
        public void Initialise(IConsumerViewModel consumerViewModel)
        {
            _logger?.LogInfo("Injecting consumer's view model for ISubscriptionFactory");
            (BindingFactory as ISubscriptionFactory)?.Initialise(consumerViewModel);

            _logger?.LogInfo("Starting communication");
            Start();
        }
Example #4
0
 /// <summary>
 /// Creates the device (e.g. HMI) simulator.
 /// </summary>
 /// <param name="bindingFactory">The binding factory.</param>
 /// <param name="toDispose">
 /// To dispose captures functionality to create a collection of disposable objects.
 /// The objects are disposed when application exits.
 /// </param>
 internal static void CreateDevice(IConsumerViewModel ViewModel, Action <IDisposable> toDispose)
 {
     Current = new ConsumerDataManagementSetup();
     toDispose(Current);
     Current.m_ViewModel = ViewModel;
     ViewModel.ConsumerUpdateConfiguration = new RestartCommand(Current.Restart);
     Current.Setup();
 }
 /// <summary>
 /// Creates the device (e.g. HMI) simulator.
 /// </summary>
 /// <param name="bindingFactory">The binding factory.</param>
 /// <param name="toDispose">
 /// To dispose captures functionality to create a collection of disposable objects. 
 /// The objects are disposed when application exits.
 /// </param>
 internal static void CreateDevice(IConsumerViewModel ViewModel, Action<IDisposable> toDispose)
 {
     Current = new ConsumerDataManagementSetup();
       toDispose(Current);
       Current.m_ViewModel = ViewModel;
       ViewModel.ConsumerUpdateConfiguration = new RestartCommand(Current.Restart);
       Current.Setup();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConsumerMessageHandlerFactory" /> class.
 /// </summary>
 /// <param name="toDispose">To dispose captures functionality to create a collection of disposable objects.
 /// The objects are disposed when application exits.</param>
 /// <param name="viewModel">The ViewModel instance for this object.</param>
 /// <param name="trace">The delegate capturing logging functionality.</param>
 public ConsumerMessageHandlerFactory(Action <IDisposable> toDispose, IConsumerViewModel viewModel, Action <string> trace)
 {
     m_ParentViewModel = viewModel;
     m_Trace           = trace;
     m_ToDispose       = toDispose;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConsumerMessageHandlerFactory" /> class.
 /// </summary>
 /// <param name="toDispose">To dispose captures functionality to create a collection of disposable objects.
 /// The objects are disposed when application exits.</param>
 /// <param name="viewModel">The ViewModel instance for this object.</param>
 /// <param name="trace">The delegate capturing logging functionality.</param>
 public ConsumerMessageHandlerFactory(Action<IDisposable> toDispose, IConsumerViewModel viewModel, Action<string> trace)
 {
     m_ParentViewModel = viewModel;
       m_Trace = trace;
       m_ToDispose = toDispose;
 }
 public void Initialise(IConsumerViewModel viewModel)
 {
 }
 public Task InitialiseAsync(IConsumerViewModel viewModel)
 {
     return(Task.Run(() => Initialise(viewModel)));
 }
 public void Initialise(IConsumerViewModel consumerViewModel)
 {
     _consumerViewModel = consumerViewModel
                          ?? throw new ComponentNotInitialisedException($"{nameof(consumerViewModel)} injected into {nameof(ConsumerBindingFactory)} is null");
 }
 /// <summary>
 /// Starts this instance in asynchronous mode - Initializes the data set infrastructure, enables all associations and starts pumping the data;
 /// </summary>
 /// <param name="consumerViewModel">View model which should receive subscriptions and then handle them</param>
 public async Task InitialiseAsync(IConsumerViewModel consumerViewModel)
 {
     await Task.Run(() => Initialise(consumerViewModel));
 }