Esempio n. 1
0
        public SettingsPageViewModel(IConfigurationSettingCollection settings, ICoreShell coreShell, IFileSystem fileSystem) {
            Check.ArgumentNull(nameof(settings), settings);
            Check.ArgumentNull(nameof(coreShell), coreShell);
            Check.ArgumentNull(nameof(fileSystem), fileSystem);

            _settings = settings;
            _coreShell = coreShell;
            _fileSystem = fileSystem;
        }
Esempio n. 2
0
        public SettingsPageViewModel(IConfigurationSettingCollection settings, ICoreShell coreShell, IFileSystem fileSystem)
        {
            Check.ArgumentNull(nameof(settings), settings);
            Check.ArgumentNull(nameof(coreShell), coreShell);
            Check.ArgumentNull(nameof(fileSystem), fileSystem);

            _settings   = settings;
            _coreShell  = coreShell;
            _fileSystem = fileSystem;
        }
        public static string FindNextAvailableSettingName(this IConfigurationSettingCollection settings, string nameTemplate)
        {
            var names         = new HashSet <string>();
            var existingNames = settings.Where(s => s.Name.StartsWithOrdinal(nameTemplate)).Select(s => s.Name);

            foreach (var n in existingNames)
            {
                names.Add(n);
            }
            if (names.Count > 0)
            {
                for (int i = 1; i < 1000; i++)
                {
                    var candidate = nameTemplate + i.ToString(CultureInfo.InvariantCulture);
                    if (!names.Contains(candidate))
                    {
                        return(candidate);
                    }
                }
            }
            return(nameTemplate);
        }
Esempio n. 4
0
 public SettingsTypeDescriptor(ICoreShell coreShell, IConfigurationSettingCollection settings)
 {
     _coreShell = coreShell;
     _settings  = settings;
 }
Esempio n. 5
0
 public SettingsTypeDescriptor(ICoreShell coreShell, IConfigurationSettingCollection settings) {
     _coreShell = coreShell;
     _settings = settings;
 }