Beispiel #1
0
        private void Reset()
        {
            {
                CurrentBrush = null;
                brushes.Clear();
                namedBrushes.Clear();
                Dictionaries.Clear();
                Lists.Clear();
                if (all != null)
                {
                    all.Clear();
                }
            }
            {
                Dictionary <int, Brush> pyramids   = new Dictionary <int, Brush>();
                Dictionary <int, Brush> prisms     = new Dictionary <int, Brush>();
                Dictionary <int, Brush> antiprisms = new Dictionary <int, Brush>();
                Dictionary <int, Brush> cupolas    = new Dictionary <int, Brush>();
                Dictionary <int, Brush> rotund     = new Dictionary <int, Brush>();
                Dictionary <int, Brush> diminished = new Dictionary <int, Brush>();
                Dictionary <int, Brush> stella     = new Dictionary <int, Brush>();
                //Dictionary<int, Brush> all          = new Dictionary<int,Brush>();

                Dictionaries["pyramid"]    = pyramids;
                Dictionaries["prism"]      = prisms;
                Dictionaries["antiprism"]  = antiprisms;
                Dictionaries["cupola"]     = cupolas;
                Dictionaries["rotund"]     = rotund;
                Dictionaries["diminished"] = diminished;
                Dictionaries["stella"]     = stella;
                Dictionaries["all"]        = all;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Scan for all dicitionaries (default resx files, without culture identification)
        /// </summary>
        private void ScanForDefaultDictionaries()
        {
            Dictionaries.Clear();

            var culturInfoList = CultureInfo.GetCultures(CultureTypes.AllCultures).Where(c => c.Name.Length > 0);

            _resourceDirectory = SelectedProjectDirectory.GetDirectories("Resources").Single();
            var resxFiles = _resourceDirectory.GetFiles("*.resx");

            foreach (FileInfo resxFile in resxFiles)
            {
                if (culturInfoList.Any(ci => resxFile.Name.EndsWith(ci.Name + ".resx")))
                {
                    continue;
                }

                Dictionaries.Add(resxFile.Name.Replace(".resx", String.Empty));
            }

            if (Dictionaries.Any())
            {
                string lastUsedDictionary = AppRegistry.GetValue(RegistryKeys.SelectedDictionary);
                if (String.IsNullOrEmpty(lastUsedDictionary))
                {
                    SelectedDictionary = Dictionaries.First();
                }
                else
                {
                    SelectedDictionary = Dictionaries.First(dict => dict == lastUsedDictionary);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Scan for alle dicitionaries (default resx files, without culture identification)
        /// </summary>
        private void ScanForDictionaries()
        {
            Dictionaries.Clear();

            var culturInfoList = CultureInfo.GetCultures(CultureTypes.AllCultures).Where(c => c.Name.Length > 0);

            _resourceDirectory = ProjectDirectory.GetDirectories("Resources").Single();
            var resxFiles = _resourceDirectory.GetFiles("*.resx");

            foreach (FileInfo resxFile in resxFiles)
            {
                if (culturInfoList.Any(ci => resxFile.Name.EndsWith(ci.Name + ".resx")))
                {
                    continue;
                }

                Dictionaries.Add(resxFile.Name.Replace(".resx", String.Empty));
            }

            if (Dictionaries.Any())
            {
                if (!_settingsCache.Keys.Contains("dictionary"))
                {
                    SelectedDictionary = Dictionaries.First();
                }
                else
                {
                    SelectedDictionary = Dictionaries.First(d => d == _settingsCache["dictionary"]);
                }
            }
        }
Beispiel #4
0
        public async Task Load()
        {
            Dictionaries.Clear();

            foreach (Dictionary dictionary in await DatabaseManager.Instance.GetDictionaries())
            {
                Dictionaries.Add(new DictionaryViewModel(dictionary));
            }
        }
Beispiel #5
0
        public void Dispose()
        {
            if (Dictionaries != null)
            {
                Dictionaries.Clear();
                Dictionaries = null;
            }

            if (Collections != null)
            {
                Collections.Clear();
                Collections = null;
            }
        }
Beispiel #6
0
        public virtual void Initialize(IServiceProvider serviceProvider)
        {
            var context = new LocalizationResourceInitializationContext(this, serviceProvider);

            Dictionaries.Clear();
            InitializeContributors(context);

            foreach (var contributor in Contributors)
            {
                contributor.Updated += (sender, args) =>
                {
                    Dictionaries.Clear();
                    InitializeContributors(context);
                };
            }
        }
        private void CreateDictionaries(IFileProvider fileProvider)
        {
            Dictionaries.Clear();

            foreach (var file in fileProvider.GetDirectoryContents(_virtualPath))
            {
                if (file.IsDirectory || !CanParseFile(file))
                {
                    continue;
                }

                var dictionary = CreateDictionaryFromFile(file);
                if (Dictionaries.ContainsKey(dictionary.CultureName))
                {
                    throw new AbpException($"{file.PhysicalPath} dictionary has a culture name '{dictionary.CultureName}' which is already defined!");
                }

                Dictionaries[dictionary.CultureName] = dictionary;
            }
        }