Beispiel #1
0
 private void AddSupportFunctionItems <T>()
     where T : CodeMapAttribute
 {
     this.AddFunctionItems(
         SDKManager.GetFunctions()
         .Where(f => f.Element.HasAttribute <T>()));
 }
Beispiel #2
0
        private void InitializeLayouts()
        {
            // ToolBox
            foreach (var element in DesignerManager.GetElementTypes()
                     .OrderBy(data => data.Attribute.Category)
                     .OrderBy(data => data.Element.CanCastingTo <PComponent>() ? 1 : 0))
            {
                if (!element.Attribute.Visible)
                {
                    continue;
                }

                var resource = ResourceManager.GetDesignerResource(element.Element);

                toolBox.AddItem(
                    new ToolBoxItemView(
                        new ToolBoxItemModel(element, resource)));
            }

            foreach (var function in SDKManager.GetFunctions())
            {
                var resource = new DesignerResource()
                {
                    Content = new Image()
                    {
                        Source = ResourceManager.GetImageSource("Icons/IconFunction.png")
                    }
                };

                toolBox.AddItem(
                    new ToolBoxItemView(
                        new ToolBoxItemFunctionModel(
                            function.Element,
                            new AttributeTuple <Core.DesignElementAttribute, Type>(function.Attribute, typeof(PFunction)),
                            resource)));
            }
        }
Beispiel #3
0
        private void InvlidateTargetObject()
        {
            this.Clear();

            if (TargetObject != null)
            {
                // 레이아웃에서 드래그한 경우
                if (TargetObject is PObject)
                {
                    AddEventItems(TargetObject.GetType());
                }

                // 스토리보드 우클릭한 경우
                if (TargetObject is Storyboard)
                {
                    AddComponentItems <PComponent>();
                    AddFunctionItems();
                    AddRendererItems();
                }

                // BindThumb에서 드래그한 경우
                if (TargetObject is BindRequest)
                {
                    var request = TargetObject as BindRequest;

                    switch (request.Source.BindOption)
                    {
                    case BindOptions.Output:
                    case BindOptions.Input:
                        AddComponentItems <PComponent>();
                        AddFunctionItems();
                        break;

                    case BindOptions.Parameter:
                        AddComponentItems <PComponent>();
                        AddFunctionItems();
                        AddRendererItems();
                        break;

                    case BindOptions.Return:
                        if (request.Source.Binder.Host is PSelector)
                        {
                            AddComponentItems <PTargetable>();
                        }
                        break;
                    }
                }
            }

            IsEmpty = this.ItemCount == 0;

            // ** Local Methods (C# 7.0) **

            void AddComponentItems <T>()
                where T : PComponent
            {
                this.AddComponentItems(
                    DesignerManager.GetElementTypes()
                    .Where(attr => attr.Attribute.Visible && attr.Element.CanCastingTo <T>()));
            }

            void AddRendererItems()
            {
                this.AddRendererItems(
                    GlobalModels.Items
                    .Select(obj => obj.GetRenderer())
                    .Where(r =>
                {
                    if (r == null)
                    {
                        return(false);
                    }

                    // 렌더러가 태스크에 의해 삭제된 상태 (파괴되기전)
                    if (!r.Element.IsVisible)
                    {
                        return(false);
                    }

                    if (r.Model is PVisual == false)
                    {
                        return(false);
                    }

                    return(true);
                }));
            }

            void AddFunctionItems()
            {
                this.AddFunctionItems(SDKManager.GetFunctions());
            }
        }
Beispiel #4
0
 private void AddFunctionItems()
 {
     this.AddFunctionItems(SDKManager.GetFunctions());
 }