private async void windowLoaded(object sender, RoutedEventArgs e) { Tx.LoadFromEmbeddedResource("osu_rank.Translation.osu_rank.txd"); if (Settings.Default.apikey == "" && Settings.Default.RippleOnly == false) { osuExpander.IsEnabled = true; hasApiKey = false; apiDialog.IsOpen = true; } else if (Settings.Default.RippleOnly == true) { osuExpander.IsEnabled = false; hasApiKey = false; drawerUnbold(); goRippleOnePlayer.FontWeight = FontWeights.SemiBold; actionBar_Text.Content = "Ripple!rank - " + Tx.T("osu rank.One player"); WindowContent.Navigate(new RipplePages.OneUser()); } else if (Settings.Default.apikey != "" && Settings.Default.RippleOnly == false) { osuExpander.IsEnabled = true; hasApiKey = true; } await checkForDictUpdate(); if (Convert.ToInt32(File.ReadAllText(osuRankAppdata + @"\txdVersion.txt")) > App.minTxdVersionRequired) { Tx.LoadFromXmlFile(osuRankAppdata + @"\osu_rank.txd"); } if (App.HasCheckedForUpdates == false) { App.HasCheckedForUpdates = true; try { string webVersion = await new HttpClient().GetStringAsync("https://raw.githubusercontent.com/Jeremiidesu/osu-rank/master/osu-rank/osu-rank/version.txt"); if (Convert.ToInt32(webVersion) > App.version) { // New release available var updateYesNo = MessageBox.Show(Tx.T("update.text"), Tx.T("update.Title"), MessageBoxButton.YesNo, MessageBoxImage.Information); if (updateYesNo == MessageBoxResult.Yes) { Process.Start("https://github.com/Jeremiidesu/osu-rank/releases"); } } } catch (Exception) { } } Ping myPing = new Ping(); string host = "osu.ppy.sh"; byte[] buffer = new byte[32]; int timeout = 5000; PingOptions pingOptions = new PingOptions(); PingReply reply = myPing.Send(host, timeout, buffer, pingOptions); if (reply.Status != IPStatus.Success) { MessageBox.Show(Tx.T("osu rank.Servers unavailable"), Tx.T("errors.Error"), MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } }
private void OK_Click(object sender, RoutedEventArgs e) { saveSettings(); #region language if (Settings.Default.LanguageCode != "") { System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(Settings.Default.LanguageCode); } else if (Settings.Default.LanguageCode == "") { System.Threading.Thread.CurrentThread.CurrentCulture = App.systemCulture; } if (Convert.ToInt32(File.ReadAllText(osuRankAppdata + @"\txdVersion.txt")) > App.minTxdVersionRequired) { Tx.LoadFromXmlFile(osuRankAppdata + @"\osu_rank.txd"); } else { Tx.LoadFromEmbeddedResource("osu_rank.Translation.osu_rank.txd"); } #endregion if (Settings.Default.RefreshEnable == false) { AutorefreshStatus.Content = Tx.T("options.state.Disabled"); } else { AutorefreshStatus.Content = Tx.T("options.autorefresh.Delay", Convert.ToInt32(delay.Value)); } Storyboard animation = TryFindResource("settingsSaved") as Storyboard; animation.Begin(); }
protected override DependencyObject CreateShell() { // Let's do other initializations here. var settings = Container.Resolve <SettingsService>(); settings.Load(); Tx.LoadFromXmlFile(GlobalConfigurations.TranslationDictionaryFile); // Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); LoadSyntaxHighlighters(); RegisterTextEditors(); return(Container.Resolve <MainWindow>()); }
private static void InitializeLocalisation() { // Setup translation data try { // Set the XML file's build action to "Embedded Resource" and "Never copy" for this to work. Tx.LoadFromEmbeddedResource("Unclassified.TxEditor.Dictionary.txd"); } catch (ArgumentException) { // The file was not embedded, try reading the file. This enables file change notifications. Tx.UseFileSystemWatcher = true; Tx.LoadFromXmlFile("Dictionary.txd"); } string appCulture = App.Settings.AppCulture; if (!string.IsNullOrWhiteSpace(appCulture)) { try { Tx.SetCulture(appCulture); } catch (Exception ex) { App.ErrorMessage("The configured application UI culture cannot be set.", ex, "Setting application culture from configuration"); } } // FieldLog application error dialog localisation FL.AppErrorDialogTitle = Tx.T("fieldlog.AppErrorDialogTitle"); FL.AppErrorDialogContinuable = Tx.T("fieldlog.AppErrorDialogContinuable"); FL.AppErrorDialogTerminating = Tx.T("fieldlog.AppErrorDialogTerminating"); FL.AppErrorDialogContext = Tx.T("fieldlog.AppErrorDialogContext"); FL.AppErrorDialogLogPath = Tx.T("fieldlog.AppErrorDialogLogPath"); FL.AppErrorDialogNoLog = Tx.T("fieldlog.AppErrorDialogNoLog"); FL.AppErrorDialogConsoleAction = Tx.T("fieldlog.AppErrorDialogConsoleAction"); FL.AppErrorDialogTimerNote = Tx.T("fieldlog.AppErrorDialogTimerNote"); FL.AppErrorDialogDetails = Tx.T("fieldlog.AppErrorDialogDetails"); FL.AppErrorDialogSendLogs = Tx.T("fieldlog.AppErrorDialogSendLogs"); FL.AppErrorDialogNext = Tx.T("fieldlog.AppErrorDialogNext"); FL.AppErrorDialogTerminate = Tx.T("fieldlog.AppErrorDialogTerminate"); FL.AppErrorDialogContinue = Tx.T("fieldlog.AppErrorDialogContinue"); // Common error message box localisation App.UnexpectedError = Tx.T("msg.error.unexpected error"); App.DetailsLogged = Tx.T("msg.error.details logged"); }
public MainWindow() { // Setup logging Tx.LogFileName = "tx.log"; //Tx.LogFileName = ""; //Environment.SetEnvironmentVariable("TX_LOG_UNUSED", "1", EnvironmentVariableTarget.User); //Environment.SetEnvironmentVariable("TX_LOG_UNUSED", null, EnvironmentVariableTarget.User); // Setup translation data try { // Set the XML file's build action to "Embedded Resource" and "Never copy" for this to work. Tx.LoadFromEmbeddedResource("WpfDemo.lang.languages.txd"); } catch (ArgumentException) { // The file was not embedded, try reading the file. This enables file change notifications. Tx.UseFileSystemWatcher = true; Tx.LoadFromXmlFile(@"lang\languages.txd"); } // Simulate web environment //Tx.SetWebCulture("de-de;q=1,de-at;q=0.8,de;q=0.7,en-us;q=0.5,en;q=0.3"); //Tx.SetWebCulture("en-us;q=1,en-gb;q=0.8,en;q=0.7,de-de;q=0.5,de;q=0.3"); InitializeComponent(); //Info2Text.Text = Tx.QT("errors and warnings", "err", "5", "warn", "1"); //Info2Text.Text = Tx.Time(DateTime.Now, TxTime.fr); //Info2Text.Text = Tx.RelativeTime(DateTime.Now.AddMinutes(-4).AddSeconds(-10)); //Info2Text.Text = Tx.TimeSpan(DateTime.Now.AddMinutes(-1).AddSeconds(-10)); //Info2Text.Text = Tx.TimeSpan(TimeSpan.FromDays(3.4)); //Info2Text.Text = Tx.DataSize(123456); Info2Text.Text = Tx.T("months"); DataContext = this; }
public SettingsWindow() { Tx.LoadFromXmlFile("Dictionary.txd"); InitializeComponent(); }