internal static svg Cmd_Create_Dynamic_Icon(TreeItem Par_dynamic)
        {
            svg svg1 = new svg();

            svg1.id     = Par_dynamic.Tree_ID.ToString();
            svg1.width  = Par_dynamic.Tree_Level * LocalData.My_Tree_Icon_With_And_Heigth + 10;
            svg1.height = LocalData.My_Tree_Icon_With_And_Heigth;

            //  svg1.onclick = "aaa";


            g g1 = null;



            int Tmp_IconType = -1;

            #region Detect_Icon_Type
            if (Par_dynamic.Tree_HasChildren)
            {
                if (Par_dynamic.Tree_IsExpanded)
                {
                    Tmp_IconType = 0;
                }
                else
                {
                    Tmp_IconType = 1;
                }
            }
            else
            {
                if (Par_dynamic.Tree_Level > 1)
                {
                    if (!Par_dynamic.Tree_IsLastItemInLevel)
                    {
                        Tmp_IconType = 2;
                    }
                    else
                    {
                        Tmp_IconType = 3;
                    }
                }
                else
                {
                    Tmp_IconType = -1;
                }
            }
            #endregion



            if (Tmp_IconType > -1)
            {
                #region Get_Relevant_Icon
                switch (Tmp_IconType)
                {
                case 0:
                    if (Par_dynamic.Tree_Level > 1)
                    {
                        if (Par_dynamic.Tree_IsLastItemInLevel)
                        {
                            g1 = LocalData.Tree_Icon_Minus_Top;
                        }
                        else
                        {
                            g1 = LocalData.Tree_Icon_Minus_Top_Bottom;
                        }
                    }
                    else
                    {
                        if (Par_dynamic.Tree_IsLastItemInLevel)
                        {
                            g1 = LocalData.Tree_Icon_Minus;
                        }
                        else
                        {
                            g1 = LocalData.Tree_Icon_Minus_Bottom;
                        }
                    }
                    break;

                case 1:
                    if (Par_dynamic.Tree_Level > 1)
                    {
                        if (Par_dynamic.Tree_IsLastItemInLevel)
                        {
                            g1 = LocalData.Tree_Icon_Plus_Top;
                        }
                        else
                        {
                            g1 = LocalData.Tree_Icon_Plus_Top_Bottom;
                        }
                    }
                    else
                    {
                        if (Par_dynamic.Tree_IsLastItemInLevel)
                        {
                            g1 = LocalData.Tree_Icon_Plus;
                        }
                        else
                        {
                            g1 = LocalData.Tree_Icon_Plus_Bottom;
                        }
                    }
                    break;

                case 2:
                    g1 = LocalData.Tree_Icon_Item;
                    break;

                case 3:
                    g1 = LocalData.Tree_Icon_LastItem;
                    break;

                default:
                    g1 = LocalData.Tree_Icon_Minus;
                    break;
                }
                #endregion



                g1.transform = "translate(" + (Par_dynamic.Tree_Level * LocalData.My_Tree_Icon_With_And_Heigth - LocalData.My_Tree_Icon_With_And_Heigth) + ",0) scale(0.5, 0.5)";


                svg1.Children.Add(g1);
            }

            #region Add_Lines_If_Needs
            if (Par_dynamic.Tree_Level > 1)
            {
                for (int i = 1; i < Par_dynamic.Tree_Level - 1; i++)
                {
                    int k = Cmd_Get_ParentID_By_Steps(Par_dynamic.Tree_ID, Par_dynamic.Tree_Level - i - 1);
                    if (k > 0)
                    {
                        if (LocalData.dynamic_List.Any(x => x.Tree_ID == k))
                        {
                            TreeItem tmp_dynamics = LocalData.dynamic_List.Single(x => x.Tree_ID == k);

                            if (!tmp_dynamics.Tree_IsLastItemInLevel)
                            {
                                g g2 = LocalData.Tree_Icon_Line;


                                g2.transform = "translate(" + (i * LocalData.My_Tree_Icon_With_And_Heigth) + ",0) scale(0.5, 0.5)";

                                svg1.Children.Add(g2);
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            #endregion



            return(svg1);
        }
Пример #2
0
        internal static svg CmdCreateDynamicIcon(TreeItem Pardynamic)
        {
            svg svg1 = new svg();

            svg1.id     = Pardynamic.ID.ToString();
            svg1.width  = Pardynamic.Level * LocalData.IconWithAndHeigth + 10;
            svg1.height = LocalData.IconWithAndHeigth;



            g g1 = null;



            int TmpIconType = -1;

            #region DetectIconType
            if (Pardynamic.HasChildren)
            {
                //svg1.onclick = BoolOptionsEnum.Yes;
                if (Pardynamic.IsExpanded)
                {
                    TmpIconType = 0;
                }
                else
                {
                    TmpIconType = 1;
                }
            }
            else
            {
                if (Pardynamic.Level > 1)
                {
                    if (!Pardynamic.IsLastItemInLevel)
                    {
                        TmpIconType = 2;
                    }
                    else
                    {
                        TmpIconType = 3;
                    }
                }
                else
                {
                    TmpIconType = -1;
                }
            }
            #endregion



            if (TmpIconType > -1)
            {
                #region GetRelevantIcon
                switch (TmpIconType)
                {
                case 0:
                    if (Pardynamic.Level > 1)
                    {
                        if (Pardynamic.IsLastItemInLevel)
                        {
                            g1 = LocalData.IconMinusTop;
                        }
                        else
                        {
                            g1 = LocalData.IconMinusTopBottom;
                        }
                    }
                    else
                    {
                        if (Pardynamic.IsLastItemInLevel)
                        {
                            g1 = LocalData.IconMinus;
                        }
                        else
                        {
                            g1 = LocalData.IconMinusBottom;
                        }
                    }
                    break;

                case 1:
                    if (Pardynamic.Level > 1)
                    {
                        if (Pardynamic.IsLastItemInLevel)
                        {
                            g1 = LocalData.IconPlusTop;
                        }
                        else
                        {
                            g1 = LocalData.IconPlusTopBottom;
                        }
                    }
                    else
                    {
                        if (Pardynamic.IsLastItemInLevel)
                        {
                            g1 = LocalData.IconPlus;
                        }
                        else
                        {
                            g1 = LocalData.IconPlusBottom;
                        }
                    }
                    break;

                case 2:
                    g1 = LocalData.IconItem;
                    break;

                case 3:
                    g1 = LocalData.IconLastItem;
                    break;

                default:
                    g1 = LocalData.IconMinus;
                    break;
                }
                #endregion



                g1.transform = "translate(" + (Pardynamic.Level * LocalData.IconWithAndHeigth - LocalData.IconWithAndHeigth) + ",0) scale(0.5, 0.5)";


                svg1.Children.Add(g1);
            }

            #region AddLinesIfNeeds
            if (Pardynamic.Level > 1)
            {
                for (int i = 1; i < Pardynamic.Level - 1; i++)
                {
                    int k = CmdGetParentIDBySteps(Pardynamic.ID, Pardynamic.Level - i - 1);
                    if (k > 0)
                    {
                        if (LocalData.dynamicList.Any(x => x.ID == k))
                        {
                            TreeItem tmpdynamics = LocalData.dynamicList.Single(x => x.ID == k);

                            if (!tmpdynamics.IsLastItemInLevel)
                            {
                                g g2 = LocalData.IconLine;


                                g2.transform = "translate(" + (i * LocalData.IconWithAndHeigth) + ",0) scale(0.5, 0.5)";

                                svg1.Children.Add(g2);
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            #endregion



            return(svg1);
        }