void DesignerItem_Loaded(object sender, RoutedEventArgs e)
 {
     if (base.Template != null)
     {
         ContentPresenter contentPresenter =
             this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;
         if (contentPresenter != null)
         {
             UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;
             if (contentVisual != null)
             {
                 DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                 if (thumb != null)
                 {
                     ControlTemplate template =
                         DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                     if (template != null)
                     {
                         thumb.Template = template;
                     }
                 }
             }
         }
     }
 }
Example #2
0
 void DesignerItem_Loaded(object sender, RoutedEventArgs e)
 {
     if (base.Template != null)
     {
         ContentPresenter contentPresenter =
             this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;
         if (contentPresenter != null)
         {
             UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;
             if (contentVisual != null)
             {
                 DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                 if (thumb != null)
                 {
                     ControlTemplate template =
                         DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                     if (template != null)
                     {
                         thumb.Template = template;
                     }
                     if (this.BookmarkBase == null || this.BookmarkBase.NodeType == string.Empty)
                     {
                         this.BookmarkBase = BookmarkFactory.GetBookmark(EnumHelper.GetEnumByString <ActivityTypeEnum>((contentPresenter.Content is Grid) ? (contentPresenter.Content as Grid).Tag.ToString()
                         : (contentPresenter.Content as System.Windows.Shapes.Shape).Tag.ToString()));
                     }
                 }
             }
         }
     }
 }
Example #3
0
 void DesignerItem_Loaded(object sender, RoutedEventArgs e)
 {
     Console.Write("item loaded");
     if (base.Template != null)
     {
         ContentPresenter contentPresenter =
             this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;
         if (contentPresenter != null)
         {
             UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;
             if (contentVisual != null)
             {
                 DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                 if (thumb != null)
                 {
                     ControlTemplate template =
                         DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                     if (template != null)
                     {
                         thumb.Template = template;
                     }
                     (this.Template.FindName("lblComponentName", this) as Label).Content = primaryField;
                     (this.Template.FindName("lblComponentDesc", this) as Label).Content = secondaryField;
                 }
             }
         }
     }
 }
Example #4
0
        void DesignerItem_Loaded(object sender, RoutedEventArgs e)
        {
            if (base.Template != null)
            {
                ContentPresenter contentPresenter =
                    this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;

                if (contentPresenter != null)
                {
                    UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;

                    if (contentVisual != null)
                    {
                        DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                        if (thumb != null)
                        {
                            ControlTemplate template =
                                DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                            if (template != null)
                            {
                                thumb.Template = template;
                            }

                            //Para que sea responsive
                            this.Height = (double)contentVisual.GetAnimationBaseValue(HeightProperty);
                            this.Width  = (double)contentVisual.GetAnimationBaseValue(WidthProperty);

                            /*Traigo la TAG del elemento hijo y la convierto en string*/
                            var tag = (contentVisual.GetAnimationBaseValue(TagProperty) ?? "").ToString();
                            if (tag == "DIAG")
                            {
                                this.Tag = "DIAG";        //Le pongo la TAG al item del diagram designer
                            }
                            else if (tag == "COND")       //Si es un nodo_condicion le cambio la altura
                            {
                                this.Height = 60;
                            }
                            else if (tag == "REFR")
                            {
                                this.Tag = "REFR";
                            }
                            /*Traigo el Uid del elemento hijo y la convierto en string*/
                            var uid = (contentVisual.GetAnimationBaseValue(UidProperty) ?? "").ToString();
                            if (uid == "Principal")
                            {
                                this.Uid = "Principal";      //Le pongo la uid al item del diagram designer
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        void DesignerItem_Loaded(object sender, RoutedEventArgs e)
        {
            // if DragThumbTemplate and ConnectorDecoratorTemplate properties of this class
            // are set these templates are applied;
            // Note: this method is only executed when the Loaded event is fired, so
            // setting DragThumbTemplate or ConnectorDecoratorTemplate properties after
            // will have no effect.
            if (base.Template != null)
            {
                ContentPresenter contentPresenter =
                    this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;
                if (contentPresenter != null)
                {
                    UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;
                    if (contentVisual != null)
                    {
                        DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                        Control   connectorDecorator = this.Template.FindName("PART_ConnectorDecorator", this) as Control;

                        if (thumb != null)
                        {
                            ControlTemplate template =
                                DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                            if (template != null)
                            {
                                thumb.Template = template;
                            }
                        }


                        if (connectorDecorator != null)
                        {
                            ControlTemplate template =
                                DesignerItem.GetConnectorDecoratorTemplate(contentVisual) as ControlTemplate;
                            if (template != null)
                            {
                                connectorDecorator.Template = template;
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        public override void OnApplyTemplate()
        {
            ContentPresenter contentPresenter = this.GetTemplateChild("PART_ContentPresenter") as ContentPresenter;
            DragThumb        thumb            = this.GetTemplateChild("PART_DragThumb") as DragThumb;

            if (thumb != null)
            {
                ControlTemplate template =
                    DesignerItem.GetDragThumbTemplate(Content as UIElement) as ControlTemplate;
                if (template != null)
                {
                    thumb.Template = template;
                }
            }

            ConnectorDecorator = this.GetTemplateChild("PART_ConnectorDecorator") as Control;

            base.OnApplyTemplate();
        }
 void DesignerItem_Loaded(object sender, RoutedEventArgs e)
 {
     if (base.Template != null)
     {
         //var tmp = (ControlTemplate)FindResource("DesignerItem");
         this.Caption    = (Label)Template.FindName("lblCaption", this);
         Caption.Content = "N/A";
         if (this.DataBinding != null)
         {
             this.DataBinding.SetMyLabel(this.Caption);
             this.DataBinding.Name = this.DataBinding.Caption;
             this.Caption.Content  = this.DataBinding.Name;
         }
         else
         {
             DataBinding = new ExecutionUnitDataBinding(Caption);
         }
         ContentPresenter contentPresenter =
             this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;
         if (contentPresenter != null)
         {
             UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;
             if (contentVisual != null)
             {
                 DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                 if (thumb != null)
                 {
                     ControlTemplate template =
                         DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                     if (template != null)
                     {
                         thumb.Template = template;
                     }
                 }
             }
         }
     }
 }
Example #8
0
 void DesignerItem_Loaded(object sender, RoutedEventArgs e)
 {
     if (base.Template != null)
     {
         ContentPresenter contentPresenter =
             this.Template.FindName("PART_ContentPresenter", this) as ContentPresenter;
         if (contentPresenter != null)
         {
             UIElement contentVisual = VisualTreeHelper.GetChild(contentPresenter, 0) as UIElement;
             if (contentVisual != null)
             {
                 DragThumb thumb = this.Template.FindName("PART_DragThumb", this) as DragThumb;
                 if (thumb != null)
                 {
                     ControlTemplate template =
                         DesignerItem.GetDragThumbTemplate(contentVisual) as ControlTemplate;
                     if (template != null)
                     {
                         thumb.Template = template;
                     }
                     /*Traigo la TAG del elemento hijo y la convierto en string*/
                     var tag = (contentVisual.GetAnimationBaseValue(TagProperty) ?? "").ToString();
                     if (tag == "DIAG")
                     {
                         this.Tag = "DIAG";    //Le pongo la TAG al item del diagram designer
                     }
                     /*Traigo el Uid del elemento hijo y la convierto en string*/
                     var uid = (contentVisual.GetAnimationBaseValue(UidProperty) ?? "").ToString();
                     if (uid == "Inicializar")
                     {
                         this.Uid = "Inicializar"; //Le pongo la uid al item del diagram designer
                     }
                 }
             }
         }
     }
 }