Ejemplo n.º 1
0
        public AlgorithmFlowElement(FlowInterfaceControl control, StorageLayer l)
        {
            this.m_Control = control;
            this.m_Layer   = l;
            var attrs = l.Algorithm.GetType().GetCustomAttributes(typeof(FlowDesignerNameAttribute), true);

            this.Name        = attrs.Length > 0 ? (attrs[0] as FlowDesignerNameAttribute).Name : l.Algorithm.ToString();
            this.ImageWidth  = 128;
            this.ImageHeight = 192;
            this.ObjectPropertyUpdated();

            // Create input / output connectors.
            foreach (string s in this.m_Layer.Algorithm.InputNames)
            {
                this.m_InputConnectors.Add(new AlgorithmFlowConnector(this, s, true, l));
            }
            this.m_OutputConnectors.Add(new AlgorithmFlowConnector(this, "Output", false, l));

            this.m_CompiledViewToggleThread = new Thread(() =>
            {
                while (this.m_CompiledViewToggleThread.ThreadState != ThreadState.AbortRequested)
                {
                    Thread.Sleep(100);
                    if (this.m_RealBitmap == this.m_RuntimeBitmap)
                    {
                        this.m_RealBitmap = this.m_CompiledBitmap;
                    }
                    else
                    {
                        this.m_RealBitmap = this.m_RuntimeBitmap;
                    }
                    try
                    {
                        this.m_Control.Invoke(new Action(() =>
                        {
                            this.m_Control.Invalidate(this.InvalidatingRegion.Apply(this.m_Control.Zoom));
                        }));
                    }
                    catch
                    {
                        break;
                    }
                }
            });
            this.m_CompiledViewToggleThread.Start();
        }
Ejemplo n.º 2
0
 public override void SetDeserializationData(FlowInterfaceControl control)
 {
     this.m_Control = control;
 }
Ejemplo n.º 3
0
 public AlgorithmFlowElement(FlowInterfaceControl control, IAlgorithm algorithm)
     : this(control, new StorageLayer {
     Algorithm = algorithm
 })
 {
 }