示例#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 MainWindowViewModel()
        {
            languageDatabase = new LanguageDatabase();
            settingsDatabase = new SettingsDatabase();
            //Importing settings
            settingsDatabase.LoadSettingsFile();
            //Importing language
            if (!settingsDatabase.Database.ContainsKey("Language"))
            {
                languageDatabase.ImportLanguage("en_EN");
            }
            else
            {
                languageDatabase.ImportLanguage(settingsDatabase.Database["Language"]);
            }

            MainMenu = new UlConnectViewModel(this.languageDatabase);
            MainMenu.ConnectionInfoDatabase.CreateConnectionText = languageDatabase.Database["CreateConnectionText"];
            Content = MainMenu;
        }
示例#3
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);
     });
 }