コード例 #1
0
        public PreferenceWindow()
        {
            InitializeComponent();
            HelpButton.Click += HelpButton_Click;
            SaveState();
            LoadState();

            var optionModels = GisEditorHelper.GetManagers().Select(m => m.GetSettingsUI()).Where(c => c != null)
                               .Concat(GisEditorHelper.GetManagers().OfType <PluginManager>().SelectMany(m => m.GetPlugins().Where(p => p.IsActive).OrderByDescending(p => p.Index)
                                                                                                         .Select(p => p.GetSettingsUI()).Where(c => c != null)))
                               .Select(c => new TreeViewItemModel(c)).ToList();

            GroupTreeViewItems(optionModels);

            foreach (var optionModel in optionModels)
            {
                PreferenceTreeView.Items.Add(optionModel.ToTreeViewItem());
            }

            if (PreferenceTreeView.HasItems)
            {
                TreeViewItem item = PreferenceTreeView.Items[0] as TreeViewItem;
                if (item != null)
                {
                    item.IsSelected = true;
                }
            }
        }
コード例 #2
0
        private static IEnumerable <IStorableSettings> GetSettings()
        {
            var managerSettings = GisEditorHelper.GetManagers().Cast <IStorableSettings>();
            var pluginSettings  = GisEditor.InfrastructureManager.GetManagers()
                                  .OfType <PluginManager>()
                                  .SelectMany(m => m.GetPlugins());

            return(managerSettings.Concat(pluginSettings));
        }