예제 #1
0
        public virtual void Initialize(Engine.Workflow w)
        {
            t_workflow            = w;
            t_attributeCollection = new Attributes.AttributeCollection();
            t_imageSource         = t_workflow.Canvas;

            // clear the drawing surface of all work layers created by previous tools or effects
            t_workflow.SelectionGlassRequest(SelectionGlassRequestType.Delete);
        }
        /// <summary>
        /// Removes all controls from the FlowPanelContainer
        /// </summary>
        private void Clear()
        {
            // explicitly removes children controls and set them to null
            while (FlowPanelContainer.Children.Count > 0)
            {
                UIElement uie = FlowPanelContainer.Children[0];
                FlowPanelContainer.Children.Remove(uie);
                uie = null;
            }

            t_properties = null;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="w"></param>
        /// <remarks>Called by the VisualPropertyPageManager</remarks>
        internal void Build(Engine.Workflow w)
        {
            Clear();

            t_workflow = w;

            if (w.GraphicActivity == null)
            {
                return;
            }

            Engine.Tools.IGraphicActivity   activity = w.GraphicActivity;
            Engine.Effects.VisualProperties vp       = activity.GetVisualProperties();


            // this can happen for tools or effects that have no visual properties
            if (vp == null)
            {
                return;
            }

            if (vp.Count == 0)
            {
                // ensure no properties are left from a previous workflow-document
                t_properties   = null;
                t_canAutoApply = false;

                return;
            }

            t_properties = new Engine.Attributes.AttributeCollection();

            Dictionary <string, Engine.Effects.VisualPropertyItem> items = vp.GetItems();

            foreach (KeyValuePair <string, Engine.Effects.VisualPropertyItem> key in items)
            {
                BuildControl(key);
            }

            t_canAutoApply = true;
        }