private async void Button_Save_CheckedAsync(object sender, RoutedEventArgs e)
        {
            if (Window_MessageBoxEx.ShowDialog("注意!此操作將不可逆,請先做好備份(Dictionary.csv)", "儲存字典?", "儲存", "取消") == Window_MessageBoxEx.MessageBoxExResult.A)
            {
                await DictionaryFile_Helper.Save(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dictionary.csv"), DataGrid_ItemSource);

                await App.ChineseConverter.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dictionary.csv"));

                new Toast("已儲存!").Show();
            }
        }
Exemple #2
0
        public async Task Load(string fileName)
        {
            Lines.AddRange(await DictionaryFile_Helper.Load(fileName));

            var lines = Lines.ToLookup(x => x.SimplifiedChinese).Select(coll => coll.First()).ToList();

            FR = new FastReplace(lines.Where(x => x.Enable).OrderByDescending(x => x.SimplifiedChinese_Priority).ThenByDescending(x => x.SimplifiedChinese.Length).ToDictionary(x => x.SimplifiedChinese, x => x.TraditionalChinese));

            lines    = Lines.ToLookup(x => x.TraditionalChinese).Select(coll => coll.First()).ToList();
            FRRevert = new FastReplace(lines.Where(x => x.Enable).OrderByDescending(x => x.TraditionalChinese_Priority).ThenByDescending(x => x.TraditionalChinese.Length).ToDictionary(x => x.TraditionalChinese, x => x.SimplifiedChinese));
        }
Exemple #3
0
 public async Task Load(string fileName)
 {
     Lines.AddRange(await DictionaryFile_Helper.Load(fileName));
     Reload();
 }