override public void Expand()
        {
            if (Expanded)
            {
                return;
            }

            if (!HasJSon)
            {
                return;
            }

            PreInserts();

            if (m_json.ID.Length > 0)
            {
                RscViewer_JSon_TreeLbItem ti = new RscViewer_JSon_TreeLbItem(Holder, this);
                ti.DetailsOnly = "RscJSonItem.ID" + ": " + m_json.ID;

                Insert(ti);
            }
            if (m_json.Description.Length > 0)
            {
                RscViewer_JSon_TreeLbItem ti = new RscViewer_JSon_TreeLbItem(Holder, this);
                ti.DetailsOnly = "RscJSonItem.Description" + ": " + m_json.Description;

                Insert(ti);
            }

            for (int i = 0; i < m_json.PropertyCount; i++)
            {
                RscJSonItemProperty oProp = m_json.GetProperty(i);

                RscViewer_JSon_TreeLbItem ti = new RscViewer_JSon_TreeLbItem(Holder, this);
                ti.DetailsOnly = oProp.Name + ": " + oProp.Value(false);

                Insert(ti);
            }

            for (int i = 0; i < m_json.ChildCount; i++)
            {
                RscJSonItem oChild = m_json.GetChild(i);

                RscViewer_JSon_TreeLbItem ti = new RscViewer_JSon_TreeLbItem(Holder, this);
                ti.m_json = oChild;

                Insert(ti);
            }

            base.Expand();
        }
예제 #2
0
        override public void Expand()
        {
            if (Expanded)
            {
                return;
            }

            if (!HasResponse)
            {
                base.Expand();
                return;
            }

            PreInserts();

            if (m_jsonResponse.ID.Length > 0)
            {
                TreeLbItem ti = new TreeLbItem(Holder, this);
                ti.DetailsOnly = "RscJSonItem.ID" + ": " + m_jsonResponse.ID;

                ti.DetailsBackColor = Colors.Gray;
                ti.DetailsForeColor = Colors.Black;

                Insert(ti);
            }
            if (m_jsonResponse.Description.Length > 0)
            {
                TreeLbItem ti = new TreeLbItem(Holder, this);
                ti.DetailsOnly = "RscJSonItem.Description" + ": " + m_jsonResponse.Description;

                ti.DetailsBackColor = Colors.Gray;
                ti.DetailsForeColor = Colors.Black;

                Insert(ti);
            }

            if (m_jsonParameters != null)
            {
                //Response properties inherited from parent to get this response...
                for (int i = 0; i < m_jsonParameters.PropertyCount; i++)
                {
                    RscJSonItemProperty oProp = m_jsonParameters.GetProperty(i);

                    TreeLbItem ti = new TreeLbItem(Holder, this);
                    ti.DetailsOnly = oProp.Name + ": " + oProp.Value(false);

                    ti.DetailsBackColor = Colors.White;
                    ti.DetailsForeColor = Colors.Black;

                    Insert(ti);
                }
            }

            for (int i = 0; i < m_jsonResponse.PropertyCount; i++)
            {
                RscJSonItemProperty oProp = m_jsonResponse.GetProperty(i);

                TreeLbItem ti = new TreeLbItem(Holder, this);
                ti.DetailsOnly = oProp.Name + ": " + oProp.Value(false);

                Insert(ti);
            }

            GoogleRequest grParent = GoogleRequest.None;

            if (Parent != null)
            {
                if (((TreeLbItem)Parent).Response != null)
                {
                    grParent = GoogleUtils.GoogleRequestFromUrl(((TreeLbItem)Parent).Response.ID);
                }
            }

            for (int i = 0; i < m_jsonResponse.ChildCount; i++)
            {
                RscJSonItem oChild = m_jsonResponse.GetChild(i);

                TreeLbItem ti = new TreeLbItem(Holder, this);

                /*
                 * if( m_jsonResponse.Name != "error" )
                 * {
                 */

                switch (grParent)
                {
                case GoogleRequest.GMail_Messages:
                {
                    if (m_jsonResponse.Name == "messages")
                    {
                        //Downloadable, but with parameters...
                        ti.gr = GoogleRequest.GMail_Message_Details;
                        ti.m_jsonParameters = oChild;
                    }
                    else
                    {
                        ti.m_jsonResponse = oChild;
                    }
                    break;
                }

                default:
                {
                    //Allowe to expand item...
                    ti.m_jsonResponse = oChild;
                    break;
                }
                }

                /*
                 * }
                 * else
                 * {
                 *      ti.m_jsonResponse = oChild;
                 * }
                 */

                Insert(ti);
            }

            base.Expand();
        }