Beispiel #1
0
        public UpdateContentItemAction(IView view, IController con, ContentItem item, PropertyDescriptor property, object previousValue)
        {
            _view = view;
            _con = con;

            _state = ContentItemState.Get(item);

            var name = property.Name;
            var value = previousValue;

            if (name == "Importer")
            {
                name = "ImporterName";
                value = ((ImporterTypeDescription)value).TypeName;
            }

            if (name == "Processor")
            {
                name = "ProcessorName";
                value = ((ProcessorTypeDescription)value).TypeName;
            }

            var field = _state.GetType().GetMember(name).SingleOrDefault() as FieldInfo;
            if (field == null)
            {
                if (!_state.ProcessorParams.ContainsKey(name))
                    throw new Exception();

                _state.ProcessorParams[name] = value;
            }
            else
            {
                field.SetValue(_state, value);
            }
        }
            public ExcludeAction(PipelineController controller, IEnumerable <ContentItem> items)
            {
                _con = controller;

                _state = new ContentItemState[items.Count()];

                var i = 0;

                foreach (var item in items)
                {
                    _state[i++] = ContentItemState.Get(item);
                }
            }
Beispiel #3
0
        private void Toggle()
        {
            var item = (ContentItem)_con.GetItem(_state.SourceFile);
            var state = ContentItemState.Get(item);
            _state.Apply(item);
            _state = state;

            item.ResolveTypes();

            _view.BeginTreeUpdate();
            _view.UpdateProperties(item);
            _view.UpdateTreeItem(item);
            _view.EndTreeUpdate();
        }
Beispiel #4
0
        private void Toggle()
        {
            var item  = (ContentItem)_con.GetItem(_state.SourceFile);
            var state = ContentItemState.Get(item);

            _state.Apply(item);
            _state = state;

            item.ResolveTypes();

            _view.BeginTreeUpdate();
            _view.UpdateProperties(item);
            _view.UpdateTreeItem(item);
            _view.EndTreeUpdate();
        }
Beispiel #5
0
        private void Toggle()
        {
            for (int i = 0; i < _states.Count; i++)
            {
                var item  = (ContentItem)_con.GetItem(_states[i].SourceFile);
                var state = ContentItemState.Get(item);
                _states[i].Apply(item);
                _states[i] = state;

                item.ResolveTypes();

                _view.BeginTreeUpdate();
                _view.UpdateProperties(item);
                _view.UpdateTreeItem(item);
                _view.EndTreeUpdate();
            }
        }
        /// <summary>
        /// Create a ContentItemState storing member values of the passed ContentItem.
        /// </summary>        
        public static ContentItemState Get(ContentItem item)
        {
            var state = new ContentItemState()
                {
                    BuildAction = item.BuildAction,
                    SourceFile = item.OriginalPath,
                    ImporterName = item.ImporterName,
                    ProcessorName = item.ProcessorName,
                    ProcessorParams = new OpaqueDataDictionary(),
                };

            foreach (var pair in item.ProcessorParams)
            {
                state.ProcessorParams[pair.Key] = pair.Value;
            }

            return state;
        }
        /// <summary>
        /// Create a ContentItemState storing member values of the passed ContentItem.
        /// </summary>
        public static ContentItemState Get(ContentItem item)
        {
            var state = new ContentItemState()
            {
                BuildAction     = item.BuildAction,
                SourceFile      = item.OriginalPath,
                ImporterName    = item.ImporterName,
                ProcessorName   = item.ProcessorName,
                ProcessorParams = new OpaqueDataDictionary(),
            };

            foreach (var pair in item.ProcessorParams)
            {
                state.ProcessorParams[pair.Key] = pair.Value;
            }

            return(state);
        }
            public ExcludeAction(PipelineController controller, IEnumerable <ContentItem> items, IEnumerable <string> folders)
            {
                _con    = controller;
                _folder = (folders == null) ? new string[0] : folders.ToArray();

                if (items == null)
                {
                    _state = new ContentItemState[0];
                }
                else
                {
                    _state = new ContentItemState[items.Count()];

                    var i = 0;
                    foreach (var item in items)
                    {
                        _state[i++] = ContentItemState.Get(item);
                    }
                }
            }
        private void TreeViewAfterSelect(object sender, TreeViewEventArgs e)
        {
            _controller.Selection.Clear(this);
            _propertyGrid.SelectedObject = null;

            _oldValues.Clear();

            foreach (var node in _treeView.SelectedNodes)
            {
                var item = node.Tag as IProjectItem;

                if (item is ContentItem)
                {
                    _oldValues.Add(ContentItemState.Get(item as ContentItem));
                }

                _controller.Selection.Add(item, this);
            }

            _propertyGrid.SelectedObjects = _controller.Selection.ToArray();
            _propertyGrid.ExpandAllGridItems();
        }
Beispiel #10
0
        public UpdateContentItemAction(IView view, IController con, ContentItem item, PropertyDescriptor property, object previousValue)
        {
            _view = view;
            _con  = con;

            _state = ContentItemState.Get(item);

            var name  = property.Name;
            var value = previousValue;

            if (name == "Importer")
            {
                name  = "ImporterName";
                value = ((ImporterTypeDescription)value).TypeName;
            }

            if (name == "Processor")
            {
                name  = "ProcessorName";
                value = ((ProcessorTypeDescription)value).TypeName;
            }

            var field = _state.GetType().GetMember(name).SingleOrDefault() as FieldInfo;

            if (field == null)
            {
                if (!_state.ProcessorParams.ContainsKey(name))
                {
                    throw new Exception();
                }

                _state.ProcessorParams[name] = value;
            }
            else
            {
                field.SetValue(_state, value);
            }
        }