예제 #1
0
        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;
                }
            }
        }
예제 #2
0
 private void AddAxisMapHandlers(AxisMapViewModel mapViewModel)
 {
     mapViewModel.RecordingStopped += MapViewModel_RecordingStopped;
 }