예제 #1
0
        public SettingsLanguageViewModel()
        {
            _languages = CollectionViewSource.GetDefaultView(LocalizationManager.List);
            _languages.SortDescriptions.Add(new SortDescription(nameof(LocalizationInfo.Name), ListSortDirection.Ascending));

            _languages.Filter = o =>
            {
                if (string.IsNullOrEmpty(Search))
                {
                    return(true);
                }

                LocalizationInfo info = o as LocalizationInfo;

                string search = Search.Trim();

                // Search by: Name
                return(info.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1 || info.NativeName.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1);
            };

            SelectedLangauge = Languages.Cast <LocalizationInfo>().FirstOrDefault(x => x.Code == LocalizationManager.Current.Code);

            LoadSettings();

            _isLoading = false;
        }