public void ShowSample(SampleInfo info)
 {
     if (info != null)
     {
         try
         {
             this.Cursor = Cursors.AppStarting;
             LockWindowUpdate(Handle);
             this.demoViewer1.Show(info);
             this.allControls1.Visible = false;
         }
         finally
         {
             LockWindowUpdate(IntPtr.Zero);
             this.Cursor = Cursors.Default;
         }
     }
 }
Esempio n. 2
0
        private static CategoryInfo ReadCategoryData(XElement catNode)
        {
            CategoryInfo category = new CategoryInfo();

            if (catNode.Attribute("name") != null)
            {
                category.Name = catNode.Attribute("name").Value;
            }
            if (catNode.Attribute("status") != null)
            {
                category.IsNew = (catNode.Attribute("status").Value == "new") ? true : false;
            }
            else
            {
                category.IsNew = false;
            }
            category.Samples = new List <SampleInfo>();
            foreach (XElement sampleNode in catNode.Descendants("sample"))
            {
                SampleInfo sample = ReadSampleData(sampleNode);
                category.Samples.Add(sample);
            }
            return(category);
        }
        public ControlInfo(XElement node)
        {
            if (node.Attribute("name") != null)
            {
                Name = node.Attribute("name").Value;
            }
            if (node.Attribute("link") != null)
            {
                Link = node.Attribute("link").Value;
            }
            if (node.Attribute("tooltip") != null)
            {
                Tooltip = node.Attribute("tooltip").Value;
            }
            if (node.Attribute("group") != null)
            {
                Group = node.Attribute("group").Value;
            }
            if (node.Attribute("status") != null)
            {
                foreach (string val in node.Attribute("status").Value.Split(','))
                {
                    switch (val)
                    {
                    case "new":
                        IsNew = true;
                        break;

                    case "popular":
                        IsPopular = true;
                        break;
                    }
                }
            }
            else
            {
                IsNew     = false;
                IsPopular = false;
            }
            if (node.Attribute("newFeatureName") != null)
            {
                NewFeatureName = node.Attribute("newFeatureName").Value;
            }
            Icon     = ControlIcons.GetControlIcon(Name, IsNew, IsPopular);
            Features = new List <FeatureInfo>();
            foreach (XElement fNode in node.Elements())
            {
                if (fNode.Name == "sample")
                {
                    SampleInfo sample = new SampleInfo(fNode);
                    Features.Add(sample);
                }
                else if (fNode.Name == "category")
                {
                    CategoryInfo category = new CategoryInfo(fNode);
                    if (category.Samples.Count > 0)
                    {
                        Features.Add(category);
                    }
                }
            }
        }
Esempio n. 4
0
        static ControlInfo()
        {
            // parse control descriptions from xml
            XElement elem      = XDocument.Load(SAMPLE_TREE).Root;
            int      pageIndex = 0;

            Controls = new List <ControlInfo>();
            foreach (XElement controlNode in elem.Descendants("control").ToList())
            {
                ControlInfo control = new ControlInfo();
                if (controlNode.Attribute("name") != null)
                {
                    control.Name = controlNode.Attribute("name").Value;
                }
                if (controlNode.Attribute("link") != null)
                {
                    control.Link = controlNode.Attribute("link").Value;
                }
                if (controlNode.Attribute("tooltip") != null)
                {
                    control.Tooltip = controlNode.Attribute("tooltip").Value;
                }
                if (controlNode.Attribute("group") != null)
                {
                    control.Group = controlNode.Attribute("group").Value;
                }
                if (controlNode.Attribute("status") != null)
                {
                    foreach (string val in controlNode.Attribute("status").Value.Split(','))
                    {
                        switch (val)
                        {
                        case "new":
                            control.IsNew = true;
                            break;

                        case "popular":
                            control.IsPopular = true;
                            break;
                        }
                    }
                }
                else
                {
                    control.IsNew     = false;
                    control.IsPopular = false;
                }
                if (controlNode.Attribute("newFeatureName") != null)
                {
                    control.NewFeatureName = controlNode.Attribute("newFeatureName").Value;
                }

                /*      // todo: we have it in xml, but currently it is not used
                 *      if (controlNode.Attribute("icon") != null)
                 *      {
                 *          string icon = controlNode.Attribute("icon").Value;
                 *          if (_icons.ContainsKey(icon))
                 *          {
                 *              control.Icon = _icons[icon].Image;
                 *          }
                 *      }
                 *      if (control.Icon == null)
                 *      {
                 *          if (!_icons.ContainsKey(control.Name))
                 *          {
                 *              _icons.Add(control.Name, Properties.Resources.ci_Empty); // Default empty icon for new stuff
                 *          }
                 *          control.Icon = _icons[control.Name].Image;
                 *      }*/
                control.Features = new List <FeatureInfo>();
                foreach (XElement node in controlNode.Elements())
                {
                    if (node.Name == "sample")
                    {
                        SampleInfo sample = ReadSampleData(node);
                        control.Features.Add(sample);
                    }
                    else if (node.Name == "category")
                    {
                        CategoryInfo category = ReadCategoryData(node);
                        if (category.Samples.Count > 0)
                        {
                            control.Features.Add(category);
                        }
                    }
                }
                ControlInfo.Controls.Add(control);
                pageIndex++;
            }
        }