コード例 #1
0
ファイル: App.xaml.cs プロジェクト: KamilOles1997/TicTacToe
        static App()
        {
            DispatcherHelper.Initialize();

            string lang = MainSettings.LoadFromXML().Language;

            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lang);
        }
コード例 #2
0
 private void SetCurrentView(ViewModelBase vm)
 {
     if (vm is GameViewModel)
     {
     }
     else if (vm is SettingsViewModel)
     {
         MessengerInstance.Send <MainSettings>(MainSettings.LoadFromXML(), Tokens.OpenSettings);
     }
     CurrentViewModel = vm;
 }
コード例 #3
0
 public void GetMainSettings(Action <MainSettings, Exception> callback)
 {
     try
     {
         MainSettings settings = MainSettings.LoadFromXML();
         callback(settings, null);
     }
     catch (Exception ex)
     {
         callback(null, ex);
     }
 }
コード例 #4
0
        public void TestSaveToXml()
        {
            MainSettings settings = new MainSettings();

            settings.GameAreaSize = 10;
            settings.InRowToWin   = 10;
            settings.Language     = "pl";
            settings.SaveToXML("TestConfig\\Settings.xml");

            settings = MainSettings.LoadFromXML("TestConfig\\Settings.xml");
            Assert.AreEqual(settings.InRowToWin, 10);
        }
コード例 #5
0
        public void TestLoadFromXMLDefaultValues()
        {
            MainSettings settings = MainSettings.LoadFromXML("NonExistingFile.xml");

            Assert.AreEqual(settings.InRowToWin, 3);
        }
コード例 #6
0
        public void TestLoadFromXML()
        {
            MainSettings settings = MainSettings.LoadFromXML("TestConfig\\Settings.xml");

            Assert.AreEqual(settings.Language, "PL");
        }