public RCViewModel(IConfigReaderService configReaderService)
        {
            WindowTitle          = configReaderService.ReadSubnetworkConfig().Name.Remove(0, 2);
            _configReaderService = configReaderService;
            _logService          = new LogService();

            BindingOperations.EnableCollectionSynchronization(Logs, _lock);
        }
Example #2
0
        public MainViewModel(RCViewModel rcViewModel, IConfigReaderService configReaderService, ILogService logService, IRCService rcService, ICCService ccService, IConnectivityService connectivityService)
        {
            x = rcViewModel;
            _configReaderService = configReaderService;
            _logService          = logService;
            _rcService           = rcService;
            _ccService           = ccService;
            _connectivityService = connectivityService;
            _connectivityService.MessageReceived += OnMessageReceived;
            BindingOperations.EnableCollectionSynchronization(Logs, _lock);

            try
            {
                SubnetworkConfig = configReaderService.ReadSubnetworkConfig();
            }
            catch (Exception e)
            {
                _logService.LogError("WRONG CONFIG: " + e.Message);
            }

            if (SubnetworkConfig.IsDomain)
            {
                _connectivityService.ConnectToNCCorDomain("127.0.0.1", SubnetworkConfig.NCCPort, SubnetworkConfig.Name);
                _connectivityService.StartListening("127.0.0.1", SubnetworkConfig.ServerPort);
            }
            else
            {
                //_cableCloudConnectionService.StartClient("127.0.0.1", SubnetworkConfig.CableCloudPort, SubnetworkConfig.Name);
                _connectivityService.ConnectToNCCorDomain("127.0.0.1", SubnetworkConfig.ClientPort, SubnetworkConfig.Name);
                _connectivityService.StartListening("127.0.0.1", SubnetworkConfig.ServerPort);
            }

            Task.Run(async() =>
            {
                while (true)
                {
                    await CheckList();
                    Thread.Sleep(50);
                }
            });
        }
Example #3
0
 public RCService(IConfigReaderService configReaderService, ILogService logService)
 {
     _subnetworkConfigDto = configReaderService.ReadSubnetworkConfig();
     _logService          = logService;
 }