public void RebuildMap(ObservableCollection <IHotasBaseMap> map) { RemoveAllButtonMapHandlers(); ButtonMap.Clear(); foreach (var baseMap in map) { switch (baseMap.Type) { case HOTASButton.ButtonType.AxisLinear: var linearMap = baseMap as HOTASAxis; var lmVm = new AxisMapViewModel(_appDispatcher, _mediaPlayerFactory, _fileSystem, linearMap); AddAxisMapHandlers(lmVm); ButtonMap.Add(lmVm); break; case HOTASButton.ButtonType.AxisRadial: var radialMap = baseMap as HOTASAxis; var rmVm = new AxisMapViewModel(_appDispatcher, _mediaPlayerFactory, _fileSystem, radialMap); AddAxisMapHandlers(rmVm); ButtonMap.Add(rmVm); break; default: var buttonMap = baseMap as HOTASButton; var bmVm = new ButtonMapViewModel(buttonMap); AddButtonMapHandlers(bmVm); ButtonMap.Add(bmVm); break; } } }
private void AddAxisMapHandlers(AxisMapViewModel mapViewModel) { mapViewModel.RecordingStopped += MapViewModel_RecordingStopped; }