public MainWindow() { InitializeComponent(); #region Binding button to the localiztion system // Creating GUI content. var content = new GUIContent() { // Adding the title that will displayed in case if localization key not found via loaded. DefaultTitle = "Native title", // Adding the key that will be looking into the loaded dictionaries. TitleLocalizationResourseKey = "localizedLabelCustomKey" }; // Binding the content to the button's label. content.BindToLabel(localizedButton); #endregion #region Loading localization dictionaries LocalizationHandler.LoadDictionaries( // Getting local lang folder from the source project. langDictsPath, // Request english localization as prior. new CultureInfo("en-US"), // Request russian localization as secondary in case if english not found. new CultureInfo("ru-RU")); #endregion // Subscribing on the event of the language change. langPanel.ValueChanged += LangPanel_ValueChanged; }
protected override void OnStartup(StartupEventArgs e) { App.AppSettings = ApplicationSettings.Load(); this.SwitchTheme(App.AppSettings.ColorScheme, App.AppSettings.BackgroundColor, App.AppSettings.FullThemeName); LocalizationHandler.SetCurrentLanguage(App.AppSettings.Language); DesktopServicesHandler desktopServicesHandler = new DesktopServicesHandler(); desktopServicesHandler.Initialize(); Logger.Initialize(desktopServicesHandler.FileService); DispatcherHelper.RegisterDispatcher(async(func) => { await this.Dispatcher.Invoke(async() => { await func(); }); }); SerializerHelper.Initialize(desktopServicesHandler.FileService); DialogHelper.Initialize(new WPFDialogShower()); Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ChannelSession.Initialize(desktopServicesHandler); Logger.Log("Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion()); base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { App.AppSettings = ApplicationSettings.Load(); this.SwitchTheme(App.AppSettings.ColorScheme, App.AppSettings.BackgroundColor, App.AppSettings.FullThemeName); LocalizationHandler.SetCurrentLanguage(App.AppSettings.Language); DesktopServicesHandler desktopServicesHandler = new DesktopServicesHandler(); desktopServicesHandler.Initialize(); Logger.Initialize(desktopServicesHandler.FileService); SerializerHelper.Initialize(desktopServicesHandler.FileService); DialogHelper.Initialize(new WPFDialogShower()); Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ChannelSession.Initialize(desktopServicesHandler); Logger.Log("Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion()); base.OnStartup(e); // Create mutex _mutex = new Mutex(true, "{" + Guid + "}"); var mutexIsAquired = _mutex.WaitOne(TimeSpan.Zero, true); // Release mutex if (mutexIsAquired) { _mutex.ReleaseMutex(); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var key = parameter as string; if (!string.IsNullOrEmpty(key)) { return(LocalizationHandler.GetLocalizationString(key)); } return(string.Empty); }
public override void OnLoaded() { LocalizationHandler.LoadDictionaries( // Getting local lang folder from the source project. langDictsPath, // Request english localization as prior. new CultureInfo("en-US"), // Request russian localization as secondary in case if english not found. new CultureInfo("ru-RU")); // Subdcribing on lang value update. GetField("lang").ValueChanged += OnLanguageChanged; }
/// <summary> /// Occurs when language changed. /// </summary> /// <param name="arg1"></param> /// <param name="arg2"></param> private void OnLanguageChanged(IGUIField arg1, object[] arg2) { switch (lang) { case LangOptions.En: LocalizationHandler.LoadDictionaries( langDictsPath, new CultureInfo("en-US")); break; case LangOptions.Ru: LocalizationHandler.LoadDictionaries( langDictsPath, new CultureInfo("ru-RU")); break; } }
/// <summary> /// Occurs when user decide to change the current app's language. /// </summary> /// <param name="obj"></param> private void LangPanel_ValueChanged(IGUIField obj, object[] args) { var togglePanel = obj as FlatTogglesGroup; switch (togglePanel.Index) { case 0: LocalizationHandler.LoadDictionaries(langDictsPath, new CultureInfo("en-US")); break; case 1: LocalizationHandler.LoadDictionaries(langDictsPath, new CultureInfo("ru-RU")); break; default: LocalizationHandler.UnloadDictionaries(); break; } // Buferizing current index. LangIndex = togglePanel.Index; }
protected override void OnStartup(StartupEventArgs e) { App.AppSettings = ApplicationSettings.Load(); this.SwitchTheme(App.AppSettings.ColorScheme, App.AppSettings.ThemeName, App.AppSettings.IsDarkColoring); LocalizationHandler.SetCurrentLanguage(App.AppSettings.Language); DesktopServicesHandler desktopServicesHandler = new DesktopServicesHandler(); desktopServicesHandler.Initialize(); Logger.Initialize(desktopServicesHandler.FileService); SerializerHelper.Initialize(desktopServicesHandler.FileService); Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ChannelSession.Initialize(desktopServicesHandler); Logger.Log("Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion()); base.OnStartup(e); }
public AccountCreationException(string message) : base(LocalizationHandler.Localize(message)) { }
public AccountDetailsIncorrectException(string error = null) : base(LocalizationHandler.Localize(error ?? "username_or_password_incorrect")) { }
public AccountEmailNotConfirmedException() : base(LocalizationHandler.Localize("email_not_confirmed")) { }
public PersistentStorageInvalidException(Exception inner) : base(LocalizationHandler.Localize("persistent_storage_invalid"), inner) { }
/// <summary> /// An exception that occurred somewhere between the client library and the account server. /// It could be a bug in the library or it could be a bug in the account server. Either way, /// report it to us so we can figure it out. This is (almost) never caused by your code. /// </summary> /// <param name="inner"></param> public AccountServerException(Exception inner = null) : base(LocalizationHandler.Localize("unknown_error"), inner) { }
public NotInitializedException() : base(LocalizationHandler.Localize("not_initialized")) { }
public ProductKeyAlreadyRedeemedException() : base(LocalizationHandler.Localize("product_key_already_redeemed")) { }
public MultiplayerAuthTokenInvalidException(string message) : base(LocalizationHandler.Localize(message)) { }
public ProductKeyNotFoundException() : base(LocalizationHandler.Localize("product_key_not_found")) { }
public UnableToAccessAccountServerException(Exception inner = null) : base(LocalizationHandler.Localize("timed_out"), inner) { }
public NotLoggedInException() : base(LocalizationHandler.Localize("not_logged_in")) { }
public MvcHtmlString RenderLocalizationIncludes(bool admin) { return(MvcHtmlString.Create(LocalizationHandler.RenderIncludes(admin, LocalizationManager.Instance.GetScope()))); }
public InvalidAccountServerResponseException(Exception inner = null) : base(LocalizationHandler.Localize("invalid_response"), inner) { }
private void ChineseButton_Click(object sender, RoutedEventArgs e) { LocalizationHandler.SetLanguage(LocalizationHandler.Language.Chinese); DialogResult = true; Close(); }