private void HandlePrimaryNavigatorChanged(object sender, EventArgs e) { NavigatorModel primaryNavigatorModel = sender as NavigatorModel; if (primaryNavigatorModel == null) { return; } if (primaryNavigatorModel.IsSelected) { _settings.PrimaryNavigator = primaryNavigatorModel.Type; } NavigatorModel supportedNavigatorModel = _supportedNavigatorModels.First(sn => sn.Type == primaryNavigatorModel.Type); if (primaryNavigatorModel.IsSelected) { supportedNavigatorModel.IsSelected = true; supportedNavigatorModel.IsEnabled = false; } else { supportedNavigatorModel.IsEnabled = true; } }
private void HandleSupportedNavigatorChanged(object sender, EventArgs e) { NavigatorModel supportedNavigatorModel = sender as NavigatorModel; if (supportedNavigatorModel == null) { return; } if (supportedNavigatorModel.Type == Navigators.TotalCommander) { TotalCommanderEnabled = supportedNavigatorModel.IsSelected; } bool navigatorIsSupported = _settings.SupportedNavigators.Contains(supportedNavigatorModel.Type); if (supportedNavigatorModel.IsSelected && !navigatorIsSupported) { _settings.SupportedNavigators.Add(supportedNavigatorModel.Type); } if (!supportedNavigatorModel.IsSelected && navigatorIsSupported) { _settings.SupportedNavigators.Remove(supportedNavigatorModel.Type); } }
private ObservableCollection <NavigatorModel> CreatePrimaryNavigatorModels(Settings settings) { ObservableCollection <NavigatorModel> primaryNavigatorModels = CreateNavigatorModels(); foreach (NavigatorModel navigator in primaryNavigatorModels) { navigator.IsSelectedChanged += HandlePrimaryNavigatorChanged; } //All the handlers should be bound as supported navigators should be updated correctly. NavigatorModel primaryNavigator = primaryNavigatorModels.First(pn => pn.Type == settings.PrimaryNavigator); primaryNavigator.IsSelected = true; return(primaryNavigatorModels); }