private async Task OnEditSchemeExecuteAsync(FilterScheme filterScheme)
        {
            try
            {
                filterScheme.EnsureIntegrity(_reflectionService);

                var filterSchemeEditInfo = new FilterSchemeEditInfo(filterScheme, RawCollection, AllowLivePreview, EnableAutoCompletion);

                if (await _uiVisualizerService.ShowDialogAsync <EditFilterViewModel>(filterSchemeEditInfo) ?? false)
                {
                    _filterSchemeManager.UpdateFilters();

                    if (ReferenceEquals(filterScheme, _filterService.SelectedFilter))
                    {
                        Log.Debug("Current filter has been edited, re-applying filter");

                        _filterService.SelectedFilter = filterScheme;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Failed to edit filter scheme '{filterScheme?.Title}'");
                throw;
            }
        }
        public void FilterCollection(FilterScheme filter, IEnumerable rawCollection, IList filteredCollection)
        {
            Argument.IsNotNull(() => filter);

            filter.EnsureIntegrity(_reflectionService);

            if (filteredCollection == null)
            {
                return;
            }

            filter.Apply(rawCollection, filteredCollection);
        }
Beispiel #3
0
        public void FilterCollection(FilterScheme filter, IEnumerable rawCollection, IList filteredCollection)
        {
            Argument.IsNotNull(() => filter);

            filter.EnsureIntegrity(_reflectionService);

            if (filteredCollection == null)
            {
                return;
            }

            filter.Apply(rawCollection, filteredCollection);
        }
Beispiel #4
0
        protected override async Task InitializeAsync()
        {
            await base.InitializeAsync();

            InstanceProperties = _reflectionService.GetInstanceProperties(_originalFilterScheme.TargetType).Properties;

            using (var memoryStream = new MemoryStream())
            {
                _xmlSerializer.Serialize(_originalFilterScheme, memoryStream, null);
                memoryStream.Position = 0L;
                _xmlSerializer.Deserialize(FilterScheme, memoryStream, null);
            }

            FilterScheme.EnsureIntegrity(_reflectionService);
            FilterScheme.Scope = _originalFilterScheme.Scope;
            FilterSchemeTitle  = FilterScheme.Title;

            RaisePropertyChanged(() => FilterScheme);

            UpdatePreviewItems();

            FilterScheme.Updated += OnFilterSchemeUpdated;
        }
        private void OnEditSchemeExecute(FilterScheme filterScheme)
        {
            try
            {
                filterScheme.EnsureIntegrity(_reflectionService);

                var filterSchemeEditInfo = new FilterSchemeEditInfo(filterScheme, RawCollection, AllowLivePreview, EnableAutoCompletion);

                if (_uiVisualizerService.ShowDialog<EditFilterViewModel>(filterSchemeEditInfo) ?? false)
                {
                    _filterSchemeManager.UpdateFilters();

                    if (ReferenceEquals(filterScheme, _filterService.SelectedFilter))
                    {
                        Log.Debug("Current filter has been edited, re-applying filter");

                        _filterService.SelectedFilter = filterScheme;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Failed to edit filter scheme '{filterScheme?.Title}'");
                throw;
            }
        }