Beispiel #1
0
        public void Restore(TailViewModel view, TailViewState tailviewstate)
        {
            _logger.Info("Applying {0} saved search settings  for {1} ", tailviewstate.SearchItems.Count(), view.Name);
            var searches = tailviewstate.SearchItems.Select(state => _searchStateToMetadataMapper.Map(state, false));

            view.SearchMetadataCollection.Add(searches);
            view.SearchCollection.Select(tailviewstate.SelectedSearch);
            _logger.Info("DONE: Applied {0} search settings for {1} ", tailviewstate.SearchItems.Count(), view.Name);
        }
Beispiel #2
0
        public GlobalSearchOptions(ISearchMetadataCollection metadata,
            ISearchStateToMetadataMapper converter,
            ISetting<SearchState[]> searchStateSettings)
        {
            Metadata = metadata;

            var loader = searchStateSettings.Value
                .Take(1)
                .Select(items => items.Select(state => converter.Map(state,true)))
                .Subscribe(metadata.Add);

            var writer = metadata.Metadata.Connect()
                .ToCollection()
                .Select(metaData => metaData.ToArray())
                .Throttle(TimeSpan.FromMilliseconds(250))
                .Select(searchStateItems => searchStateItems.Select(converter.Map).ToArray())
                .Subscribe(searchStateSettings.Write);

            _cleanUp = new CompositeDisposable(loader, writer);
        }
Beispiel #3
0
        public GlobalSearchOptions(ISearchMetadataCollection metadata,
                                   ISearchStateToMetadataMapper converter,
                                   ISetting <SearchState[]> searchStateSettings)
        {
            Metadata = metadata;

            var loader = searchStateSettings.Value
                         .Take(1)
                         .Select(items => items.Select(state => converter.Map(state, true)))
                         .Subscribe(metadata.Add);

            var writer = metadata.Metadata.Connect()
                         .ToCollection()
                         .Select(metaData => metaData.ToArray())
                         .Throttle(TimeSpan.FromMilliseconds(250))
                         .Select(searchStateItems => searchStateItems.Select(converter.Map).ToArray())
                         .Subscribe(searchStateSettings.Write);

            _cleanUp = new CompositeDisposable(loader, writer);
        }