public OptionsDialog()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            // These used to have [ImportMany(..., RequiredCreationPolicy = CreationPolicy.NonShared)], so they use their own
            // ExportProvider instance.
            // FIXME: Ideally, the export provider should be disposed when it's no longer needed.
            var ep = App.ExportProviderFactory.CreateExportProvider();
            this.optionPages = ep.GetExports <IControl, IOptionsMetadata>("OptionPages").ToArray();
            ILSpySettings settings = ILSpySettings.Load();
            var           tabItems = new List <TabItem>();
            foreach (var optionPage in optionPages.OrderBy(p => p.Metadata.Order))
            {
                TabItem tabItem = new TabItem();
                tabItem.Header  = MainWindow.GetResourceString(optionPage.Metadata.Title);
                tabItem.Content = optionPage.Value;
                tabItems.Add(tabItem);

                IOptionPage page = optionPage.Value as IOptionPage;
                if (page != null)
                {
                    page.Load(settings);
                }
            }
            tabControl.Items = tabItems;
        }
示例#2
0
        public OptionsDialog()
        {
            InitializeComponent();
            App.CompositionContainer.ComposeParts(this);
            ILSpySettings settings = ILSpySettings.Load();

            foreach (var optionPage in optionPages)
            {
                TabItem tabItem = new TabItem();
                tabItem.Header  = optionPage.Metadata.Title;
                tabItem.Content = optionPage.Value;
                tabControl.Items.Add(tabItem);

                IOptionPage page = optionPage.Value as IOptionPage;
                if (page != null)
                {
                    page.Load(settings);
                }
            }
        }