Exemplo n.º 1
0
        internal static void SetMessages(StackPanel messagesOutput, ConnectorDefinition definition)
        {
            var error   = definition.GetPropertyValue("Error");
            var warning = definition.GetPropertyValue("Warning");

            if (error != null)
            {
                var errorImg = new Image();
                DrawingTools.SetImage(errorImg, ErrorImage);

                var errorDescription = DrawingTools.GetHeadingText("Error", error);
                DrawingTools.SetToolTip(errorImg, errorDescription);

                messagesOutput.Children.Add(errorImg);
            }

            if (warning != null)
            {
                var warningImg = new Image();
                DrawingTools.SetImage(warningImg, WarningImage);

                var warningDescription = DrawingTools.GetHeadingText("Warning", warning);
                DrawingTools.SetToolTip(warningImg, warningDescription);

                messagesOutput.Children.Add(warningImg);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the inherited flag.
 /// </summary>
 /// <param name="connector">The connector where flag will be set.</param>
 /// <param name="export">The export which flag will be set.</param>
 private static void setInherited(ConnectorDefinition connector, Export export)
 {
     if (export.IsInherited)
     {
         setProperty(connector, "IsInherited", "True");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Draw join between given connectors.
        /// </summary>
        /// <param name="from">Source connector.</param>
        /// <param name="to">Target connector.</param>
        /// <returns>Drawn join.</returns>
        public JoinDefinition DrawJoin(ConnectorDefinition from, ConnectorDefinition to)
        {
            var join = new JoinDefinition(from, to);

            Instance.Context.DrawJoin(join);

            return(join);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExportConnector" /> class.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="owningItem">The owning item.</param>
        public ExportConnector(ConnectorDefinition definition, DiagramItem owningItem)
            : base(definition, ConnectorAlign.Right, owningItem)
        {
            InitializeComponent();

            Contract.Text = definition.GetProperty("Contract").Value;
            ConnectorTools.SetProperties(this, "Export info", ExportProperties);
            ConnectorTools.SetMessages(ErrorOutput, definition);
        }
Exemplo n.º 5
0
        public override ConnectorDrawing CreateConnector(ConnectorDefinition definition, DiagramItem owningItem)
        {
            var kind = definition.GetProperty("Kind");

            switch (kind.Value)
            {
            case "Import":
                return(new ImportConnector(definition, owningItem));

            case "SelfExport":
                return(new SelfExportConnector(definition, owningItem));

            case "Export":
                return(new ExportConnector(definition, owningItem));

            default:
                throw new NotSupportedException(kind.Value);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates the connector according to given definition.
        /// </summary>
        /// <param name="definition">The connector definition.</param>
        /// <param name="owningItem">The owning item.</param>
        /// <returns>Created drawing.</returns>
        /// <exception cref="System.NotSupportedException"></exception>
        public override ConnectorDrawing CreateConnector(ConnectorDefinition definition, DiagramItem owningItem)
        {
            var kind = definition.GetProperty("Kind");

            switch (kind.Value)
            {
            case "Import":
                return(_connectorFactories[(int)ConnectorAlign.Left](definition, owningItem));

            case "SelfExport":
                return(_connectorFactories[(int)ConnectorAlign.Top](definition, owningItem));

            case "Export":
                return(_connectorFactories[(int)ConnectorAlign.Right](definition, owningItem));

            default:
                throw new NotSupportedException(kind.Value);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Sets the meta information to properties with given prefix.
        /// </summary>
        /// <param name="connector">The connector where meta properties will be available.</param>
        /// <param name="propertyPrefix">The property prefix.</param>
        /// <param name="meta">The meta information.</param>
        private static void setMetaProperties(ConnectorDefinition connector, string propertyPrefix, MetaExport meta)
        {
            foreach (var key in meta.ExportedKeys)
            {
                var item  = meta.GetItem(key);
                var index = 1;
                foreach (var value in item.Data)
                {
                    var propertyName        = propertyPrefix + index + "-" + item.Key;
                    var valueRepresentation = "'" + value + "'";
                    if (item.IsMultiple)
                    {
                        valueRepresentation += " | IsMultiple";
                    }

                    setProperty(connector, propertyName, valueRepresentation);

                    ++index;
                }
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Sets value of the property for given connector.
 /// </summary>
 /// <param name="connector">The connector to set.</param>
 /// <param name="propertyName">Name of the property.</param>
 /// <param name="info">The information.</param>
 private static void setProperty(ConnectorDefinition connector, string propertyName, InstanceInfo info)
 {
     setProperty(connector, propertyName, info.TypeName);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Sets value of the property for given connector.
 /// </summary>
 /// <param name="connector">The connector.</param>
 /// <param name="propertyName">Name of the property.</param>
 /// <param name="propertyValue">The property value.</param>
 private static void setProperty(ConnectorDefinition connector, string propertyName, object propertyValue)
 {
     connector.SetProperty(new DrawingProperty(propertyName, propertyValue.ToString()));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates the connector according to given definition.
 /// </summary>
 /// <param name="definition">The connector definition.</param>
 /// <param name="owningItem">The owning item.</param>
 /// <returns>Created drawing.</returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public override ConnectorDrawing CreateConnector(ConnectorDefinition definition, DiagramItem owningItem)
 {
     throw new NotImplementedException();
 }