Exemplo n.º 1
0
        public static ToolStripMenuItem GetMenuLinkRoot(string text)
        {
            ToolStripMenuItem item = new ToolStripMenuItem(text);

            item.Image = GraphicsResx.web;

            XmlDocument xDoc = new XmlDocument();

            if (File.Exists(SettingsManagement.AppDataPath + "helplinks.xml") == false)
            {
                try
                {
                    File.WriteAllText(SettingsManagement.AppDataPath + "helplinks.xml", Properties.Resources.helplinks);
                    xDoc.Load(SettingsManagement.AppDataPath + "helplinks.xml");
                }
                catch
                {
                    xDoc.LoadXml(Properties.Resources.helplinks);
                }
            }
            else
            {
                try
                {
                    xDoc.Load(SettingsManagement.AppDataPath + "helplinks.xml");
                }
                catch (XmlException ex)
                {
                    MessageBox.Show("Error while reading helplinks.xml: " + ex.Message);
                    return(item);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error while reading helplinks.xml: " + ex.Message);
                    return(item);
                }
            }

            try
            {
                XmlElement xDocEle = xDoc.DocumentElement;

                foreach (XmlElement xEle in xDocEle.ChildNodes)
                {
                    MenuWebLink link = new MenuWebLink(xEle.GetAttribute("Text"), xEle.GetAttribute("URL"));
                    link.Add(xEle);

                    item.DropDownItems.Add(link.MenuItem);
                }
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Error while creating help links");
            }

            return(item);
        }
Exemplo n.º 2
0
        public void Add(XmlElement xContainer)
        {
            foreach (XmlElement xEle in xContainer.ChildNodes)
            {
                MenuWebLink child = new MenuWebLink(xEle.GetAttribute("Text"), xEle.GetAttribute("URL"));

                children.Add(child);
                menuItem.DropDownItems.Add(child.MenuItem);

                child.Add(xEle);
            }
        }
        public void Add(XmlElement xContainer)
        {
            foreach (XmlElement xEle in xContainer.ChildNodes)
            {
                MenuWebLink child = new MenuWebLink(xEle.GetAttribute("Text"), xEle.GetAttribute("URL"));

                children.Add(child);
                menuItem.DropDownItems.Add(child.MenuItem);

                child.Add(xEle);
            }
        }
        public static ToolStripMenuItem GetMenuLinkRoot(string text, string filepath)
        {
            ToolStripMenuItem item = new ToolStripMenuItem(text);
            item.Image = global::AVRProjectIDE.Properties.Resources.web;

            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(filepath);
            XmlElement xDocEle = xDoc.DocumentElement;

            foreach (XmlElement xEle in xDocEle.ChildNodes)
            {
                MenuWebLink link = new MenuWebLink(xEle.GetAttribute("Text"), xEle.GetAttribute("URL"));
                link.Add(xEle);

                item.DropDownItems.Add(link.MenuItem);
            }

            return item;
        }
Exemplo n.º 5
0
        public static ToolStripMenuItem GetMenuLinkRoot(string text, string filepath)
        {
            ToolStripMenuItem item = new ToolStripMenuItem(text);

            item.Image = global::AVRProjectIDE.Properties.Resources.web;

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(filepath);
            XmlElement xDocEle = xDoc.DocumentElement;

            foreach (XmlElement xEle in xDocEle.ChildNodes)
            {
                MenuWebLink link = new MenuWebLink(xEle.GetAttribute("Text"), xEle.GetAttribute("URL"));
                link.Add(xEle);

                item.DropDownItems.Add(link.MenuItem);
            }

            return(item);
        }
Exemplo n.º 6
0
        public static ToolStripMenuItem GetMenuLinkRoot(string text)
        {
            ToolStripMenuItem item = new ToolStripMenuItem(text);
            item.Image = GraphicsResx.web;

            XmlDocument xDoc = new XmlDocument();

            if (File.Exists(SettingsManagement.AppDataPath + "helplinks.xml") == false)
            {
                try
                {
                    File.WriteAllText(SettingsManagement.AppDataPath + "helplinks.xml", Properties.Resources.helplinks);
                    xDoc.Load(SettingsManagement.AppDataPath + "helplinks.xml");
                }
                catch
                {
                    xDoc.LoadXml(Properties.Resources.helplinks);
                }
            }
            else
            {
                try
                {
                    xDoc.Load(SettingsManagement.AppDataPath + "helplinks.xml");
                }
                catch (XmlException ex)
                {
                    MessageBox.Show("Error while reading helplinks.xml: " + ex.Message);
                    return item;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error while reading helplinks.xml: " + ex.Message);
                    return item;
                }
            }

            try
            {
                XmlElement xDocEle = xDoc.DocumentElement;

                foreach (XmlElement xEle in xDocEle.ChildNodes)
                {
                    MenuWebLink link = new MenuWebLink(xEle.GetAttribute("Text"), xEle.GetAttribute("URL"));
                    link.Add(xEle);

                    item.DropDownItems.Add(link.MenuItem);
                }
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Error while creating help links");
            }

            return item;
        }