public void Init(DeviceViewArgs args) { eventAggregator = container.Resolve<IEventAggregator>(); filtersList = new ObservableCollection<FilterExpression>(); btnSwitch = new LinkButtonSwitch(eventAggregator); btnSwitch.ClearSelection = () => { buttonsList.UnselectAll(); }; disposables.Add(Observable.FromEventPattern(buttonsList, "SelectionChanged") .Subscribe(e => { btnSwitch.SelectedButton = (ButtonBase)buttonsList.SelectedItem; })); disposables.Add(btnSwitch); var subcrtok = eventAggregator.GetEvent<AddEventsFilterClick>().Subscribe(arg => { dispatch.BeginInvoke(() => { ReSubscribe(args); }); }); disposables.Add(Disposable.Create(() => { eventAggregator.GetEvent<AddEventsFilterClick>().Unsubscribe(subcrtok); })); odmSession = new OdmSession(args.nvtSession); InitDeviceImage(args); LoadButtons(args); EventsSubscription(args); }
public void Init(SourceViewArgs args) { eventAggregator = container.Resolve<IEventAggregator>(); btnSwitch = new LinkButtonSwitch(eventAggregator); btnSwitch.ClearSelection = () => { buttonsList.UnselectAll(); }; disposables.Add(Observable.FromEventPattern(buttonsList, "SelectionChanged") .Subscribe(e => { btnSwitch.SelectedButton = (ButtonBase)buttonsList.SelectedItem; })); disposables.Add(btnSwitch); dataProcInfo = new VideoInfo(); GetSnapshot(args); if (args.selectedProfile == null) { log.WriteInfo("Selected profile == null"); CreateEmergencyButtons(args); } else { dataProcInfo.ChanToken = args.channelDescr.videoSource.token; LoadButtons(args); disposables.Add(Observable.FromEventPattern(vsSnapshot, "MouseDown").Subscribe(ev => { GetSnapshot(args); })); } buttonsList.ItemsSource = Buttons; }