Пример #1
0
 public DeviceSlimVM(SerialPortVM serialPortVM, IRUSDevice device, BusyObject busy, DeviceSlimVM[] children)
 {
     RUSDevice = device ?? throw new ArgumentNullException(nameof(device));
     _busy     = busy ?? throw new ArgumentNullException(nameof(busy));
     Widgets   = new WidgetsVM(WidgetsLocator.ResolveWidgetsForScope(RUSDevice, _busy).ToArray());
     Children  = this.ToSequence().Concat(children.NullToEmpty()).ToArray();
 }
Пример #2
0
        public DevicesVM(SerialPortVM serialPortVM, IRUSConnectionInterface connectionInterface, BusyObject isBusy)
        {
            IsBusy = isBusy;
            new DefaultFilesKeeper().CreateAllFiles(TEMPLATES_DIR_PATH, WidgetsLocator.Resolve <IFileExtensionFactory>());

            SupportedDevices = DevicesFactory
                               .InstantiateSupported(connectionInterface)
                               .OrderBy(d => d.Id)
                               .Select(d => new DeviceSlimVM(serialPortVM, d, IsBusy, d.Children.OrderBy(cd => cd.Id).Select(cd => new DeviceSlimVM(serialPortVM, cd, IsBusy)).ToArray()))
                               .ToObservable();
            PropertyChanged += _propertyHolder_PropertyChanged;
        }
Пример #3
0
        public MainVM()
        {
            var locker = new SemaphoreSlim(1, 1);
            var port   = new InterfaceAggregator(
                new COMPortAdapter(new SerialPort(), COM_TIMEOUT, COM_TIMEOUT, locker),
                new TestCOMInterface(locker),
                new FTDIInterface(FTDI_TIMEOUT, FTDI_TIMEOUT, locker),
                new TestFTDIInterface(locker));

            var busy = new BusyObject();

            COMPortVM = new SerialPortVM(port, busy);
            DevicesVM = new DevicesVM(COMPortVM, new SerialPortRUSConnectionInterface(port), busy);
            LogVM     = new LogVM();

            new WidgetsManager(COMPortVM, DevicesVM, busy);
        }
Пример #4
0
 public DeviceSlimVM(SerialPortVM serialPortVM, IRUSDevice device, BusyObject busy)
     : this(serialPortVM, device, busy, null)
 {
 }