示例#1
0
 public SettingsViewModel(LanguageDatabase languageDatabase, SettingsDatabase settingsDatabase, ConnectionInfoDatabase connectionInfoDatabase)
 {
     UpdateSettingsVisual(languageDatabase);
     FileNames = FileOperations.GetFileNames("lang", FileOperations.IsJsonChecker);
     if (FileNames.Count == 0)
     {
         FileOperations.AddUnsucessfullImportTask("Missing language files in \nlang folder");
         FileOperations.UnsuccessImportTaskStack.Pop().Start();
     }
     if (settingsDatabase.Database.ContainsKey("Language"))
     {
         if (fileNames.Contains(settingsDatabase.Database["Language"]))
         {
             selectedIndex = FileNames.IndexOf(settingsDatabase.Database["Language"]);
         }
     }
     else
     {
         selectedIndex = 0;
     }
     SaveSettingsCommand = ReactiveCommand.Create(() => {
         settingsDatabase.ChangeParameter("Language", FileNames[selectedIndex]);
         languageDatabase.ImportLanguage(FileNames[selectedIndex]);
         UpdateSettingsVisual(languageDatabase);
         connectionInfoDatabase.CreateConnectionText = languageDatabase.Database["CreateConnectionText"];
         languageDatabase.SetLanguageForConnDatabaseElements(connectionInfoDatabase.Database);
     });
 }
示例#2
0
 public SettingsViewModel(LanguageDatabase languageDatabase, SettingsDatabase settingsDatabase, ConnectionInfoDatabase connectionInfoDatabase)
 {
     UpdateSettingsVisual(languageDatabase);
     FileNames = FileOperations.GetFileNames("lang");
     if (fileNames.Contains(settingsDatabase.Database["Language"]))
     {
         selectedIndex = FileNames.IndexOf(settingsDatabase.Database["Language"]);
     }
     SaveSettingsCommand = ReactiveCommand.Create(() => {
         settingsDatabase.ChangeParameter("Language", FileNames[selectedIndex]);
         languageDatabase.ImportLanguage(FileNames[selectedIndex]);
         UpdateSettingsVisual(languageDatabase);
         connectionInfoDatabase.CreateConnectionText = languageDatabase.Database["CreateConnectionText"];
         languageDatabase.SetLanguageForAllElementsInDatabase(connectionInfoDatabase.Database);
     });
 }