Esempio n. 1
0
        public BusMonitorControl(UavcanInstance uavcan)
        {
            _serializer = uavcan.Serializer;

            InitializeComponent();

            var filter = TableFilterSet.ViewModel;

            ViewModel = new BusMonitorViewModel(uavcan, filter);

            this.WhenActivated(disposableRegistration =>
            {
                this.OneWayBind(ViewModel,
                                vm => vm.Items,
                                v => v.dgFrames.ItemsSource)
                .DisposeWith(disposableRegistration);

                this.BindCommand(ViewModel,
                                 vm => vm.AddFilter,
                                 v => v.AddFilterButton)
                .DisposeWith(disposableRegistration);

                this.BindCommand(ViewModel,
                                 vm => vm.ClearItems,
                                 v => v.ClearButton)
                .DisposeWith(disposableRegistration);

                this.Bind(ViewModel,
                          vm => vm.Enabled,
                          v => v.EnabledButton.IsChecked)
                .DisposeWith(disposableRegistration);
            });
        }
Esempio n. 2
0
        internal LogViewerViewModel(UavcanInstance uavcan, TableFilterSetViewModel filter)
        {
            _serializer = uavcan.Serializer;

            ResolveTypes(uavcan.TypeResolver);

            var messageReceived = Observable.FromEventPattern <EventHandler <TransferReceivedArgs>, TransferReceivedArgs>(
                handler => uavcan.MessageReceived += handler,
                handler => uavcan.MessageReceived -= handler);

            var logItemsFiller = messageReceived
                                 .Select(x => GetLogMessage(x))
                                 .Where(x => x != null)
                                 .Subscribe(m => _logItemsSource.Add(m));

            var filterObservable = filter.WhenValueChanged(t => t.Filter)
                                   .Select(BuildFilter);

            var sourceBuilder = _logItemsSource
                                .Connect()
                                .Filter(filterObservable)
                                .ObserveOn(RxApp.MainThreadScheduler)
                                .Bind(out _logItems)
                                .Subscribe();

            AddFilter = ReactiveCommand.Create(() => filter.AddFilter());

            _cleanUp = new CompositeDisposable(logItemsFiller, sourceBuilder, filter);
        }
Esempio n. 3
0
 public ParametersAccessor(UavcanInstance uavcan, NodeHandle handle)
 {
     _uavcan = uavcan;
     _handle = handle;
 }
Esempio n. 4
0
 public UIElement CreateUIElement(UavcanInstance uavcan)
 {
     return(new BusMonitorControl(uavcan));
 }
Esempio n. 5
0
 public UavcanService(TypeResolvingService typeResolvingService)
 {
     Engine = new UavcanInstance(typeResolvingService);
 }
Esempio n. 6
0
 public ParametersService(UavcanInstance uavcan)
 {
     _uavcan = uavcan;
 }