Пример #1
0
        /// <summary>
        /// Constructs the filters and the pivot items.
        /// </summary>
        private void CreateComponents()
        {
            if (_filters == null)
            {
                Debug.WriteLine(DebugTag + "CreateComponents()");
#if !WINDOWS_PHONE_APP
                _filterPreviewViewModel = new FilterPreviewViewModel();
                DataContext = _filterPreviewViewModel;
#endif

                _filters = new List<AbstractFilter>
                {
                    new OriginalImageFilter(), // This is for the original image and has no effects
                    new SixthGearFilter(),
                    new SadHipsterFilter(),
                    new EightiesPopSongFilter(),
                    new MarvelFilter(),
                    new SurroundedFilter()
                };
            }

#if WINDOWS_PHONE_APP
            DataContext dataContext = FilterEffects.DataContext.Instance;
            _previewImages = new List<Image>();
            int i = 0;

            // Create a pivot item with an image for each filter. The image
            // content is added later. In addition, create the preview bitmaps
            // and associate them with the images.
            foreach (AbstractFilter filter in _filters)
            {
                var pivotItem = new PivotItem {Header = filter.Name};

                if (!string.IsNullOrEmpty(filter.ShortDescription))
                {
                    pivotItem.Header += " (" + filter.ShortDescription + ")";
                }

                var grid = new Grid {Name = PivotItemNamePrefix + filter.Name};

                _previewImages.Add(new Image());
                grid.Children.Add(_previewImages[i++]);

                filter.PropertiesManipulated += OnControlManipulated;

                pivotItem.Content = grid;
                FilterPreviewPivot.Items.Add(pivotItem);
                filter.PreviewResolution = FilterEffects.DataContext.Instance.PreviewResolution;
            }

            FilterPreviewPivot.SelectionChanged += FilterPreviewPivot_SelectionChanged;
#endif
        }
Пример #2
0
        /// <summary>
        /// Constructs the filters and the pivot items.
        /// </summary>
        private void CreateComponents()
        {
            if (_filters == null)
            {
                Debug.WriteLine(DebugTag + "CreateComponents()");
                _filterPreviewViewModel = new FilterPreviewViewModel();
                DataContext = _filterPreviewViewModel;

                _filters = new List<AbstractFilter>
                {
                    new OriginalImageFilter(),
                    new SixthGearFilter(),
                    new SadHipsterFilter(),
                    new EightiesPopSongFilter(),
                    new MarvelFilter(),
                    new SurroundedFilter()
                };
            }
        }