public static IOperatorShapeInfo CreateOperatorShapeInfo(IOperator op) {
      IEnumerable<string> operatorParameterNames = op.Parameters.Where(p => p is IValueParameter && typeof(IOperator).IsAssignableFrom(p.DataType)).Select(p => p.Name);
      IEnumerable<string> paramaterNameValues = op.Parameters.Where(p => !(p is IValueParameter && typeof(IOperator).IsAssignableFrom(p.DataType))).Select(p => p.ToString());

      OperatorShapeInfo operatorShapeInfo = new OperatorShapeInfo(operatorParameterNames, paramaterNameValues);
      operatorShapeInfo.AddConnector(PredecessorConnector);
      operatorShapeInfo.Collapsed = true;
      operatorShapeInfo.Title = op.Name;
      operatorShapeInfo.TypeName = op.GetType().GetPrettyName();
      operatorShapeInfo.Color = Color.LightBlue;
      operatorShapeInfo.LineWidth = 1;
      operatorShapeInfo.LineColor = Color.Black;
      operatorShapeInfo.Icon = new Bitmap(op.ItemImage);

      return operatorShapeInfo;
    }
        public static IOperatorShapeInfo CreateOperatorShapeInfo(IOperator op)
        {
            IEnumerable <string> operatorParameterNames = op.Parameters.Where(p => p is IValueParameter && typeof(IOperator).IsAssignableFrom(p.DataType)).Select(p => p.Name);
            IEnumerable <string> paramaterNameValues    = op.Parameters.Where(p => !(p is IValueParameter && typeof(IOperator).IsAssignableFrom(p.DataType))).Select(p => p.ToString());

            OperatorShapeInfo operatorShapeInfo = new OperatorShapeInfo(operatorParameterNames, paramaterNameValues);

            operatorShapeInfo.AddConnector(PredecessorConnector);
            operatorShapeInfo.Collapsed = true;
            operatorShapeInfo.Title     = op.Name;
            operatorShapeInfo.TypeName  = op.GetType().GetPrettyName();
            operatorShapeInfo.Color     = Color.LightBlue;
            operatorShapeInfo.LineWidth = 1;
            operatorShapeInfo.LineColor = Color.Black;
            operatorShapeInfo.Icon      = new Bitmap(op.ItemImage);

            return(operatorShapeInfo);
        }
Пример #3
0
    protected OperatorShapeInfo(OperatorShapeInfo original, Cloner cloner)
      : base(original, cloner) {
      collapsed = original.collapsed;
      color = original.color;
      lineColor = original.lineColor;
      lineWidth = original.lineWidth;
      title = original.title;
      typeName = original.typeName;

      //mkommend: necessary because cloning a Bitmap is not threadsafe
      //see http://stackoverflow.com/questions/1851292/invalidoperationexception-object-is-currently-in-use-elsewhere for further information
      if (original.icon != null) {
        lock (original.lockObject) {
          icon = (Bitmap)original.icon.Clone();
        }
      }

      connectorNames = new List<string>(original.connectorNames);
      labels = new List<string>(original.labels);
    }
Пример #4
0
        private void UpdateInitialShape()
        {
            IOperatorShapeInfo old = this.oldInitialShape as OperatorShapeInfo;

            if (old != null)
            {
                old.Color = oldInitialShapeColor;
            }

            OperatorShapeInfo newInitialShapeInfo = this.InitialShape as OperatorShapeInfo;

            if (newInitialShapeInfo != null)
            {
                oldInitialShapeColor      = newInitialShapeInfo.Color;
                newInitialShapeInfo.Color = Color.LightGreen;
            }

            oldInitialShape = this.InitialShape;
            this.OnInitialShapeChanged();
        }
Пример #5
0
        protected OperatorShapeInfo(OperatorShapeInfo original, Cloner cloner)
            : base(original, cloner)
        {
            collapsed = original.collapsed;
            color     = original.color;
            lineColor = original.lineColor;
            lineWidth = original.lineWidth;
            title     = original.title;
            typeName  = original.typeName;

            //mkommend: necessary because cloning a Bitmap is not threadsafe
            //see http://stackoverflow.com/questions/1851292/invalidoperationexception-object-is-currently-in-use-elsewhere for further information
            if (original.icon != null)
            {
                lock (original.lockObject) {
                    icon = (Bitmap)original.icon.Clone();
                }
            }

            connectorNames = new List <string>(original.connectorNames);
            labels         = new List <string>(original.labels);
        }