示例#1
0
        private void Init(string directory)
        {
            _rows.Clear();
            _fileProvider.LoadFiles(directory);
            if (_fileProvider.Locales.Count == 0)
            {
                MessageBox.Show("No Locale file was found");
                return;
            }

            dgTranslations.Columns.Clear();
            dgTranslations.Columns.Add(new DataGridTextColumn
            {
                Binding        = new Binding("[0]"),
                Header         = "Key",
                Width          = new DataGridLength(2, DataGridLengthUnitType.Star),
                IsReadOnly     = true,
                CanUserReorder = false
            });
            var i = 1;

            foreach (var locale in _fileProvider.Translations.GetLocalesByCountOfValues())
            {
                dgTranslations.Columns.Add(new DataGridTextColumn
                {
                    Binding = new Binding($"[{i}]"),
                    Header  = locale,
                    Width   = new DataGridLength(1, DataGridLengthUnitType.Star)
                });
                i++;
            }
            RefreshGridData();
        }