public static void UpdateShape(IOperatorShapeInfo operatorShapeInfo, OperatorShape operatorShape) { operatorShape.Title = operatorShapeInfo.Title; operatorShape.Subtitle = operatorShapeInfo.TypeName; operatorShape.Color = operatorShapeInfo.Color; operatorShape.LineColor = operatorShapeInfo.LineColor; operatorShape.LineWidth = operatorShapeInfo.LineWidth; operatorShape.Icon = operatorShapeInfo.Icon; operatorShape.Collapsed = operatorShapeInfo.Collapsed; int i = 0; int j = 0; //remove old connectors and skip correct connectors List <string> oldConnectorNames = operatorShape.AdditionalConnectorNames.ToList(); while (i < operatorShapeInfo.Connectors.Count() && j < oldConnectorNames.Count) { if (operatorShapeInfo.Connectors.ElementAt(i) == OperatorShapeInfoFactory.SuccessorConnector || operatorShapeInfo.Connectors.ElementAt(i) == OperatorShapeInfoFactory.PredecessorConnector) { i++; } else if (oldConnectorNames[j] == OperatorShapeInfoFactory.SuccessorConnector || oldConnectorNames[j] == OperatorShapeInfoFactory.PredecessorConnector) { j++; } else if (operatorShapeInfo.Connectors.ElementAt(i) != oldConnectorNames[j]) { operatorShape.RemoveConnector(oldConnectorNames[j]); j++; } else { i++; j++; } } //remove remaining old connectors for (; j < oldConnectorNames.Count; j++) { operatorShape.RemoveConnector(oldConnectorNames[j]); } //add new connectors except successor and connector for (; i < operatorShapeInfo.Connectors.Count(); i++) { if (operatorShapeInfo.Connectors.ElementAt(i) != OperatorShapeInfoFactory.SuccessorConnector && operatorShapeInfo.Connectors.ElementAt(i) != OperatorShapeInfoFactory.PredecessorConnector) { operatorShape.AddConnector(operatorShapeInfo.Connectors.ElementAt(i)); } } operatorShape.UpdateLabels(operatorShapeInfo.Labels); }
public static void UpdateShapeInfo(IOperatorShapeInfo operatorShapeInfo, OperatorShape operatorShape) { operatorShapeInfo.Title = operatorShape.Title; operatorShapeInfo.TypeName = operatorShape.Subtitle; operatorShapeInfo.Color = operatorShape.Color; operatorShapeInfo.LineColor = operatorShape.LineColor; operatorShapeInfo.LineWidth = operatorShape.LineWidth; operatorShapeInfo.Icon = operatorShape.Icon; operatorShapeInfo.Collapsed = operatorShape.Collapsed; }
public static OperatorShape CreateShape(IOperatorShapeInfo shapeInfo) { OperatorShape shape = new OperatorShape(); shape.Tag = shapeInfo; shape.Location = shapeInfo.Location; shape.Title = shapeInfo.Title; shape.Subtitle = shapeInfo.TypeName; shape.Color = shapeInfo.Color; shape.LineColor = shapeInfo.LineColor; shape.LineWidth = shapeInfo.LineWidth; shape.Icon = shapeInfo.Icon; shape.Collapsed = shapeInfo.Collapsed; foreach (string connectorName in shapeInfo.Connectors) if (connectorName != OperatorShapeInfoFactory.SuccessorConnector && connectorName != OperatorShapeInfoFactory.PredecessorConnector) shape.AddConnector(connectorName); shape.UpdateLabels(shapeInfo.Labels); return shape; }
public static void UpdateShape(IOperatorShapeInfo operatorShapeInfo, OperatorShape operatorShape) { operatorShape.Title = operatorShapeInfo.Title; operatorShape.Subtitle = operatorShapeInfo.TypeName; operatorShape.Color = operatorShapeInfo.Color; operatorShape.LineColor = operatorShapeInfo.LineColor; operatorShape.LineWidth = operatorShapeInfo.LineWidth; operatorShape.Icon = operatorShapeInfo.Icon; operatorShape.Collapsed = operatorShapeInfo.Collapsed; int i = 0; int j = 0; //remove old connectors and skip correct connectors List<string> oldConnectorNames = operatorShape.AdditionalConnectorNames.ToList(); while (i < operatorShapeInfo.Connectors.Count() && j < oldConnectorNames.Count) { if (operatorShapeInfo.Connectors.ElementAt(i) == OperatorShapeInfoFactory.SuccessorConnector || operatorShapeInfo.Connectors.ElementAt(i) == OperatorShapeInfoFactory.PredecessorConnector) i++; else if (oldConnectorNames[j] == OperatorShapeInfoFactory.SuccessorConnector || oldConnectorNames[j] == OperatorShapeInfoFactory.PredecessorConnector) j++; else if (operatorShapeInfo.Connectors.ElementAt(i) != oldConnectorNames[j]) { operatorShape.RemoveConnector(oldConnectorNames[j]); j++; } else { i++; j++; } } //remove remaining old connectors for (; j < oldConnectorNames.Count; j++) operatorShape.RemoveConnector(oldConnectorNames[j]); //add new connectors except successor and connector for (; i < operatorShapeInfo.Connectors.Count(); i++) if (operatorShapeInfo.Connectors.ElementAt(i) != OperatorShapeInfoFactory.SuccessorConnector && operatorShapeInfo.Connectors.ElementAt(i) != OperatorShapeInfoFactory.PredecessorConnector) operatorShape.AddConnector(operatorShapeInfo.Connectors.ElementAt(i)); operatorShape.UpdateLabels(operatorShapeInfo.Labels); }
public static OperatorShape CreateShape(IOperatorShapeInfo shapeInfo) { OperatorShape shape = new OperatorShape(); shape.Tag = shapeInfo; shape.Location = shapeInfo.Location; shape.Title = shapeInfo.Title; shape.Subtitle = shapeInfo.TypeName; shape.Color = shapeInfo.Color; shape.LineColor = shapeInfo.LineColor; shape.LineWidth = shapeInfo.LineWidth; shape.Icon = shapeInfo.Icon; shape.Collapsed = shapeInfo.Collapsed; foreach (string connectorName in shapeInfo.Connectors) { if (connectorName != OperatorShapeInfoFactory.SuccessorConnector && connectorName != OperatorShapeInfoFactory.PredecessorConnector) { shape.AddConnector(connectorName); } } shape.UpdateLabels(shapeInfo.Labels); return(shape); }