Exemplo n.º 1
0
        internal static async Task LoadDictionary(Enum_Engine Engine)
        {
            switch (Engine)
            {
            case Enum_Engine.Local:
                DictionaryStatus = Enum_DictionaryStatus.Loading;
                if (Settings.VocabularyCorrection)
                {
                    await ChineseConverter.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dictionary.csv"));
                }
                else
                {
                    CleanDictionary();
                }
                DictionaryStatus = Enum_DictionaryStatus.Loaded;
                break;

            case Enum_Engine.Fanhuaji:
                if (Fanhuaji.CheckConnection())
                {
                    Fanhuaji = new Fanhuaji(true, Fanhuaji_API.Fanhuaji.Terms_of_Service);
                }
                break;
            }
        }
Exemplo n.º 2
0
 public App()
 {
     App.Reload(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ConvertZZ.json"));
     Task.Run(() => {
         foreach (string p in System.IO.Directory.GetFiles(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Dictionary")))
         {
             ChineseConverter.Load(p);
         }
         ChineseConverter.ReloadFastReplaceDic();
         DicLoaded = true;
     });
     nIcon.Icon    = ConvertZZ.Properties.Resources.icon;
     nIcon.Visible = true;
     if (Settings.CheckVersion)
     {
         Task.Run(() =>
         {
             var versionReport = UpdateChecker.ChecktVersion();
             if (versionReport != null && versionReport.HaveNew)
             {
                 if (MessageBox.Show(String.Format("發現新版本{0}(目前版本:{1})\r\n前往官網下載更新?", versionReport.Newst.ToString(), versionReport.Current.ToString()), "發現更新", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                 {
                     Process.Start("https://github.com/flier268/ConvertZZ/releases");
                 }
             }
         });
     }
 }
Exemplo n.º 3
0
 internal static void CleanDictionary()
 {
     ChineseConverter.Lines.Clear();
     ChineseConverter.Reload();
     DictionaryStatus = Enum_DictionaryStatus.NotLoad;
 }