private void CreateLanguageDropDownList() { var redirectQs = new QueryString(Page); redirectQs.RemoveParameter("lang"); var jsRedirect = redirectQs.AllUrl; if (redirectQs.Parameters.Count == 0) { jsRedirect += "?lang="; } else { jsRedirect += "&lang="; } jsRedirect = HttpUtility.HtmlEncode(jsRedirect); var sb = new StringBuilder(); sb.Append("<form method=\"get\" action=\"" + redirectQs.AllUrl + "\">"); foreach (string key in redirectQs.Parameters.Keys) { sb.Append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + redirectQs[key] + "\" />"); } sb.Append("<select id=\"LanguageDropDownList\" name=\"lang\" onchange=\"javascript:location='" + jsRedirect + "' + this.options[this.selectedIndex].value\" >"); foreach (var language in AvailableLanguages) { var selected = string.Empty; if (language.ISOCode.ToLower() == SelectedLanguage.ToLower()) { selected = " selected=\"selected\" "; } sb.Append(string.Format("<option value=\"{0}\"" + selected + ">{1}</option>", language.ISOCode, language.Description)); } sb.Append("</select>"); sb.Append("<noscript><input type=\"submit\" value=\">\" /></noscript>"); sb.Append("</form>"); LanguageDropDownListLiteral.Text = sb.ToString(); }
public App() { try { InitializeComponent(); Constants.InitConstatns(); InitCryptMethod(); CrossMultilingual.Current.CurrentCultureInfo = new CultureInfo(SelectedLanguage.ToLower()); AppResources.Culture = CrossMultilingual.Current.CurrentCultureInfo; NavigationService.Configure("MainPage", typeof(MainPage)); NavigationService.Configure("DetailsPage", typeof(DetailsPage)); NavigationService.Configure("SettingsPage", typeof(SettingsPage)); NavigationService.Configure("LoginPage", typeof(LoginPage)); NavigationService.Configure("PasswordChangePage", typeof(PasswordChangePage)); NavigationService.Configure("PasswordSetPage", typeof(PasswordSetPage)); NavigationService.Configure("AboutPage", typeof(AboutPage)); NavigationService.Configure("HelpPage", typeof(HelpPage)); if (!IsUserLoggedIn) { if (!string.IsNullOrWhiteSpace(UserPassword)) { MainPage = NavigationService.SetRootPage("LoginPage"); } else { MainPage = NavigationService.SetRootPage("PasswordSetPage"); } } else { MainPage = NavigationService.SetRootPage("MainPage"); } } catch (Exception ex) { UserDialogsService.DisplayException(ex); } }