/// <summary>
        /// Initializes a new instance of the <see cref="DirectoryCatalogDrawing" /> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public DirectoryCatalogDrawing(DiagramItem item)
            : base(item)
        {
            InitializeComponent();

            DrawingTools.SetToolTip(Caption, Definition.DrawedType);
            DrawingTools.SetImage(CaptionIcon, Image);
            InstanceID.Text = Definition.ID;

            var path     = Definition.GetPropertyValue("Path");
            var fullPath = Definition.GetPropertyValue("FullPath");
            var pattern  = Definition.GetPropertyValue("Pattern");
            var error    = Definition.GetPropertyValue("Error");

            Path.Text    = path;
            Pattern.Text = pattern;

            var fullPathInfo = DrawingTools.GetHeadingText("FullPath", fullPath);

            DrawingTools.SetToolTip(PathDock, fullPath);

            //Display error message if needed
            ErrorText.Text = error;
            var hasError = error != null;

            ErrorDock.Visibility = hasError ? Visibility.Visible : Visibility.Hidden;

            Item.FillSlot(Components, Definition.Slots.First());
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateCatalogDrawing" /> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public AggregateCatalogDrawing(DiagramItem item)
            : base(item)
        {
            InitializeComponent();

            DrawingTools.SetToolTip(Caption, Definition.DrawedType);
            DrawingTools.SetImage(CaptionIcon, Image);
            InstanceID.Text = Definition.ID;

            var slot = Definition.Slots.First();

            Item.FillSlot(Catalogs, slot);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompositionContainerDrawing"/> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public CompositionContainerDrawing(DiagramItem item)
            : base(item)
        {
            InitializeComponent();

            DrawingTools.SetToolTip(Caption, Definition.DrawedType);
            DrawingTools.SetImage(CaptionIcon, Image);
            InstanceID.Text = Definition.ID;

            var error    = Definition.GetPropertyValue("Error");
            var hasError = error != null;

            ErrorDock.Visibility = hasError ? Visibility.Visible : Visibility.Hidden;
            ErrorText.Text       = error;


            Item.FillSlot(Composition, Definition.Slots.First());
        }
Esempio n. 5
0
        internal static void SetProperties(ConnectorDrawing connector, string heading, IEnumerable <KeyValuePair <string, string> > mapping)
        {
            var definition = connector.Definition;

            var propertiesText = new StringBuilder();

            foreach (var map in mapping)
            {
                var property = definition.GetProperty(map.Key);
                if (property == null || property.Value == null)
                {
                    continue;
                }

                propertiesText.AppendFormat("{0}: {1}\n", map.Value, property.Value);
            }

            var metaText = new StringBuilder();

            foreach (var property in definition.Properties)
            {
                var prefix       = "$Meta";
                var propertyName = property.Name;
                if (!propertyName.StartsWith(prefix))
                {
                    continue;
                }

                var name = propertyName.Substring(propertyName.IndexOf('-') + 1);
                metaText.AppendFormat("{0}: {1}\n", name, property.Value);
            }

            var tooltip = DrawingTools.GetHeadingText(heading, propertiesText.ToString());

            if (metaText.Length > 0)
            {
                DrawingTools.AppendHeadingText("Metadata", metaText.ToString(), tooltip);
            }

            DrawingTools.SetToolTip(connector, tooltip);
        }
Esempio n. 6
0
 /// <summary>
 /// Initialize new instance of cached image.
 /// </summary>
 /// <param name="source">Source to be converted.</param>
 public CachedImage(System.Drawing.Bitmap source)
 {
     ImageData = DrawingTools.Convert(source);
 }
Esempio n. 7
0
 /// <summary>
 /// Set ToolTip from content with specified delay to parent.
 /// </summary>
 /// <param name="target">Target which ToolTip will be set.</param>
 /// <param name="toolTipText">The tool tip text.</param>
 internal static void SetToolTip(FrameworkElement target, string toolTipText)
 {
     SetToolTip(target, DrawingTools.GetText(toolTipText));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentDrawing"/> class.
        /// </summary>
        /// <param name="item">The item.</param>
        public ComponentDrawing(DiagramItem item)
            : base(item)
        {
            InitializeComponent();

            DrawingTools.SetImage(ComponentIcon, Image);

            TypeName.Text   = Definition.DrawedType;
            InstanceID.Text = Definition.ID;

            var properties = Definition.Properties.OrderBy((prop) => prop.Name);

            string definingAssembly = null;
            string removedBy        = null;
            var    isEntryInstance  = false;

            foreach (var property in properties)
            {
                var value = property.Value;
                var name  = property.Name;

                switch (name)
                {
                case "EntryInstance":
                    isEntryInstance = true;
                    break;

                case "Removed":
                    removedBy = value;
                    break;

                case "DefiningAssembly":
                    definingAssembly = value;
                    break;

                default:
                    var prefix        = value == null || value == "" ? name : name + ": ";
                    var propertyBlock = new TextBlock();
                    propertyBlock.Text = prefix + value;
                    Properties.Children.Add(propertyBlock);
                    break;
                }
            }

            if (isEntryInstance)
            {
                BorderBrush     = Brushes.DarkGreen;
                BorderThickness = new Thickness(6);
            }

            var isRemoved = removedBy != null;

            if (isRemoved)
            {
                DrawingTools.SetImage(RemoveIcon, RemoveImage);
                DrawingTools.SetToolTip(RemoveIcon, DrawingTools.GetText("Component has been removed " + removedBy));
            }

            if (definingAssembly != null)
            {
                var assembly = DrawingTools.GetHeadingText("Defining assembly", definingAssembly);
                DrawingTools.SetToolTip(TypeName, assembly);
            }

            RemoveIcon.Visibility = isRemoved ? Visibility.Visible : Visibility.Hidden;
        }