public MainWindowViewModel(IDeviceValidator validator, INotificationService notificationService, IWindowManager manager)
        {
            this.validator           = validator;
            this.logger              = new TextLogger("../../../log.txt", true);
            this.notificationService = notificationService;
            Items             = new ObservableCollection <Device>();
            Connected         = false;
            this.manager      = manager;
            LogCommand        = new GUIICommand(ShowLogs);
            commandExecutor   = new CommandExecutor(logger);
            commandProcessor  = new CommandProcessor(notificationService, validator, commandExecutor, logger);
            alarmProcessor    = new AlarmProcessor(logger);
            automationManager = new AutomationManager(commandExecutor, Items, logger);


            try
            {
                LoadFromConfiguration();
                factory      = new ChannelFactory <IService>(new NetTcpBinding(), $"net.tcp://localhost:{servicePort}/WCFService");
                proxy        = factory.CreateChannel();
                Connected    = false;
                UpdateEvent += MainWindowViewModel_UpdateEvent;
                acquisitor   = new Acquisitor(Items, acquisitionInterval, factory, commandExecutor, logger, automationManager);
            }
            catch (Exception ex)
            {
                notificationService.ShowNotification("Server", $"Error: {ex.Message}, ST: {ex.StackTrace}", Notifications.Wpf.NotificationType.Error);
            }
        }
 public CommandProcessor(INotificationService notificationService, IDeviceValidator validator, CommandExecutor executor, ILogger logger)
 {
     this.notificationService = notificationService;
     this.validator           = validator;
     this.logger          = logger;
     this.commandExecutor = executor;
 }
Exemplo n.º 3
0
        public MainWindowViewModel(IDeviceValidator validator, INotificationService notification, IDataRepository repo)
        {
            this.validator           = validator;
            this.notificationService = notification;
            this.repository          = repo;
            StartCommand             = new MyICommand(OnStart);
            StopCommand = new MyICommand(OnStop);
            Items       = new BindingList <Device>();

            SimulationStatus = "InActive";
            try
            {
                LoadFromConfiguration();
                service = new Common.WCF.WCFService("WCFService", new IPEndPoint(IPAddress.Loopback, servicePort), typeof(Service), typeof(IService));
                service.Create();
                service.Open();
            }
            catch (Exception ex)
            {
                notificationService.ShowNotification("Server", $"Error: {ex.Message}, ST: {ex.StackTrace}", Notifications.Wpf.NotificationType.Error);
            }
        }
Exemplo n.º 4
0
 public DeviceManager(IDevicesRepository devicesRepository, IDeviceValidator deviceValidator)
 {
     _devicesRepository = devicesRepository;
     _deviceValidator   = deviceValidator;
 }