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);
        }
示例#3
0
        public MatchModel(IMatchModelMapper matchModelMapper, MatchString matchedText, string path)
        {
            _matchedText      = matchedText;
            _path             = path;
            _matchModelMapper = matchModelMapper;

            _textBlock = GetTextBlock(_matchedText);
        }
        public MatchModel(IMatchModelMapper matchModelMapper, MatchString matchedText, string path)
        {
            _matchedText = matchedText;
            _path = path;
            _matchModelMapper = matchModelMapper;

            _textBlock = GetTextBlock(_matchedText);
        }
        public MatchModel(IMatchModelMapper matchModelMapper, string text)
        {
            _path = null;
            _matchModelMapper = matchModelMapper;

            MatchSubstring substring = new MatchSubstring(text, false);
            List<MatchSubstring> substrings = new List<MatchSubstring> { substring };
            _matchedText = new MatchString(substrings);

            _textBlock = GetTextBlock(_matchedText);
        }
示例#6
0
        public MatchModel(IMatchModelMapper matchModelMapper, string text)
        {
            _path             = null;
            _matchModelMapper = matchModelMapper;

            MatchSubstring        substring  = new MatchSubstring(text, false);
            List <MatchSubstring> substrings = new List <MatchSubstring> {
                substring
            };

            _matchedText = new MatchString(substrings);

            _textBlock = GetTextBlock(_matchedText);
        }