示例#1
0
        void LoadSideBarConfig(XmlElement el)
        {
            foreach (XmlElement sideTabEl in el.ChildNodes)
            {
                SideTab tab = new SideTab(this, sideTabEl.GetAttribute("text"));
                tab.DisplayName = StringParser.Parse(tab.Name);
                if (tab.Name == el.GetAttribute("activetab"))
                {
                    ActiveTab = tab;
                }
                else
                {
                    if (ActiveTab == null)
                    {
                        ActiveTab = tab;
                    }
                }

                foreach (XmlElement sideTabItemEl in sideTabEl.ChildNodes)
                {
                    tab.Items.Add(SideTabItemFactory.CreateSideTabItem(sideTabItemEl.GetAttribute("text"),
                                                                       sideTabItemEl.GetAttribute("value")));
                }

                if (sideTabEl.GetAttribute("clipboardring") == "true")
                {
                    tab.CanBeDeleted = false;
                    tab.CanDragDrop  = false;
                    tab.Name         = "${res:SharpDevelop.SideBar.ClipboardRing}";
                    tab.DisplayName  = StringParser.Parse(tab.Name);
                    clipboardRing    = tab;
                }
                Tabs.Add(tab);
            }
        }
示例#2
0
        private void Initialize()
        {
            try
            {
                foreach (TextTemplate template in TextTemplate.TextTemplates)
                {
                    SideTab tab = new SideTab(this, template.Name);
                    tab.DisplayName = StringParser.Parse(tab.Name);
                    tab.CanSaved    = false;
                    foreach (TextTemplate.Entry entry in template.Entries)
                    {
                        tab.Items.Add(SideTabItemFactory.CreateSideTabItem(entry.Display, entry.Value));
                    }
                    tab.CanBeDeleted = tab.CanDragDrop = false;
                    Tabs.Add(tab);
                }
            }
            catch
            {
                //string s = ex.Message;
            }


            try {
                XmlDocument doc = new XmlDocument();

                doc.Load(Path.Combine(PropertyService.ConfigDirectory, "SideBarConfig.xml"));
                if (doc.DocumentElement.GetAttribute("version") != "1.0")
                {
                    GenerateStandardSideBar();
                }
                else
                {
                    LoadSideBarConfig(doc.DocumentElement["SideBar"]);
                }
            } catch (FileNotFoundException) {
                // do not show a warning when the side bar file does not exist
                GenerateStandardSideBar();
            } catch (Exception ex) {
                MessageService.ShowWarning(ex.ToString());
                GenerateStandardSideBar();
            }

            WorkbenchSingleton.WorkbenchUnloaded += delegate { SaveSideBarViewConfig(); };
        }
        private void Initialize()
        {
            foreach (TextTemplate template in TextTemplate.TextTemplates)
            {
                SideTab tab = new SideTab(this, template.Name);
                tab.DisplayName = StringParser.Parse(tab.Name);
                tab.CanSaved    = false;
                foreach (TextTemplate.Entry entry in template.Entries)
                {
                    tab.Items.Add(SideTabItemFactory.CreateSideTabItem(entry.Display, entry.Value));
                }
                tab.CanBeDeleted = tab.CanDragDrop = false;
                Tabs.Add(tab);
            }

            try {
                XmlDocument doc = new XmlDocument();

                doc.Load(Path.Combine(PropertyService.ConfigDirectory, "SideBarConfig.xml"));
                if (doc.DocumentElement.GetAttribute("version") != "1.0")
                {
                    GenerateStandardSideBar();
                }
                else
                {
                    LoadSideBarConfig(doc.DocumentElement["SideBar"]);
                }
            } catch (FileNotFoundException) {
                // do not show a warning when the side bar file does not exist
                GenerateStandardSideBar();
            } catch (Exception ex) {
                LoggingService.Warn("Error loading SideBarConfig.xml", ex);
                // We cannot show the error to the user; it's possible that this code is called
                // while dispatcher processing is suspended.
                // http://community.sharpdevelop.net/forums/t/19984.aspx
                //MessageService.ShowWarning(ex.ToString());
                GenerateStandardSideBar();
            }

            WorkbenchSingleton.WorkbenchUnloaded += delegate { SaveSideBarViewConfig(); };
        }