public NavigationPresenter(INavigationView view, ISettingsSerializer settingsSerializer, IKeyboardListener keyboardListener, IMatchModelMapper matchModelMapper, IPresentationService presentationService, INavigationServiceBuilder navigationServiceBuilder) { _view = view; _settingsSerializer = settingsSerializer; _keyboardListener = keyboardListener; _matchModelMapper = matchModelMapper; _navigationServiceBuilder = navigationServiceBuilder; _presentationService = presentationService; Settings settings = _settingsSerializer.Deserialize(); _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed; _keyboardListener.StartListening(settings.GlobalKeyCombination); _view.CurrentSettings = settings; _view.ShowMatches(new List <MatchModel> { new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage) }); _view.ShowInitializingScreen = true; //Initialize navigation service asynchronously, as it may require a long operation (file system parsing). //Clone settings to avoid any coupling Settings settingsCopy = settings.Clone() as Settings; InitializeDelegate initialize = Initialize; initialize.BeginInvoke(settingsCopy, EndInitialize, initialize); }
public NavigationPresenter(INavigationView view, ISettingsSerializer settingsSerializer, IKeyboardListener keyboardListener, IMatchModelMapper matchModelMapper, IPresentationService presentationService, INavigationServiceBuilder navigationServiceBuilder) { _view = view; _settingsSerializer = settingsSerializer; _keyboardListener = keyboardListener; _matchModelMapper = matchModelMapper; _navigationServiceBuilder = navigationServiceBuilder; _presentationService = presentationService; Settings settings = _settingsSerializer.Deserialize(); _keyboardListener.KeyCombinationPressed += GlobalKeyCombinationPressed; _keyboardListener.StartListening(settings.GlobalKeyCombination); _view.CurrentSettings = settings; _view.ShowMatches(new List<MatchModel> {new MatchModel(_matchModelMapper, Resources.InitialMatchesMessage)}); _view.ShowInitializingScreen = true; //Initialize navigation service asynchronously, as it may require a long operation (file system parsing). //Clone settings to avoid any coupling Settings settingsCopy = settings.Clone() as Settings; InitializeDelegate initialize = Initialize; initialize.BeginInvoke(settingsCopy, EndInitialize, initialize); }
//Called just if initialized private void HandleTextChanged(object sender, ItemEventArgs <string> e) { List <MatchModel> matches = GetMatchModels(e.Item); _view.ShowMatches(matches); }