예제 #1
0
        private void CreateEditables()
        {
            var factory   = new SettingsFactory();
            var editables = factory.Reflect(Configuration, out var changeTrackingManager).ToList();

            var connectionEditables = new List <IEditableConfig>();
            var projectsEditables   = new List <IEditableConfig>();

            foreach (var config in editables)
            {
                if (config.PropertyInfo.Name == nameof(IConfiguration.Connections))
                {
                    connectionEditables.Add(config);
                    continue;
                }

                if (config.PropertyInfo.Name == nameof(IConfiguration.Projects))
                {
                    projectsEditables.Add(config);
                    continue;
                }

                Configs.Add(config);
            }

            ConnectionsSubSet = new SettingsSubSetViewModel(connectionEditables);
            ProjectsSubSet    = new SettingsSubSetViewModel(projectsEditables);

            changeTrackingManager.ConfigurationChanged += (sender, args) =>
            {
                _saveMethod.Invoke();
                SettingsChanged?.Invoke(this, EventArgs.Empty);
            };
        }
예제 #2
0
        public ConnectionsAndProjectsSettingsViewModel(SettingsSubSetViewModel connectionSettings, SettingsSubSetViewModel projectsSettings, IPluginRepository pluginRepository)
        {
            Items = new ObservableCollection <IButtonNavigationItem>();
            connectionSettings.DataTemplateSelector = ConnectionsAndProjectsTemplateSelector.Instance;
            projectsSettings.DataTemplateSelector   = ConnectionsAndProjectsTemplateSelector.Instance;

            foreach (var config in connectionSettings.Configs)
            {
                config.AdditionalData = pluginRepository;
            }

            foreach (var config in projectsSettings.Configs)
            {
                config.AdditionalData = pluginRepository;
            }

            Items.Add(new ButtonNavigationItem(connectionSettings, "Connections", IconType.Connection));
            Items.Add(new ButtonNavigationItem(projectsSettings, "Projects", IconType.GroupingEmpty));
        }