public UnitConverter() { m_meteredConnectionOverride = false; m_layoutDirection = LocalizationService.GetInstance().GetFlowDirection(); m_FlowDirectionHorizontalAlignment = m_layoutDirection == FlowDirection.RightToLeft ? HorizontalAlignment.Right : HorizontalAlignment.Left; InitializeComponent(); // adding ESC key shortcut binding to clear button ClearEntryButtonPos0.SetValue(KeyboardShortcutManager.VirtualKeyProperty, MyVirtualKey.Escape); // Is currency symbol preference set to right side bool preferRight = LocalizationSettings.GetInstance().GetCurrencySymbolPrecedence() == 0; VisualStateManager.GoToState(this, preferRight ? "CurrencySymbolRightState" : "CurrencySymbolLeftState", false); var resLoader = AppResourceProvider.GetInstance(); m_chargesMayApplyText = resLoader.GetResourceString("DataChargesMayApply"); m_failedToRefreshText = resLoader.GetResourceString("FailedToRefresh"); InitializeOfflineStatusTextBlock(); if (Resources.TryGetValue("CalculationResultContextMenu", out var value)) { m_resultsFlyout = (MenuFlyout)value; } CopyMenuItem.Text = resLoader.GetResourceString("copyMenuItem"); PasteMenuItem.Text = resLoader.GetResourceString("pasteMenuItem"); }
private static Frame CreateFrame() { var frame = new Frame(); frame.FlowDirection = LocalizationService.GetInstance().GetFlowDirection(); return(frame); }
public Calculator() { this.InitializeComponent(); m_doAnimate = false; m_isLastAnimatedInScientific = false; m_isLastAnimatedInProgrammer = false; m_resultAnimate = false; HistoryButtonPressed = new DelegateCommand(ToggleHistoryFlyout); SetFontSizeResources(); LoadResourceStrings(); if (LocalizationService.GetInstance().IsRtlLayout()) { HistoryButton.HorizontalAlignment = HorizontalAlignment.Left; } m_displayFlyout = (MenuFlyout)(Resources["DisplayContextMenu"]); var resLoader = AppResourceProvider.GetInstance(); // UNO TODO // CopyMenuItem.Text = resLoader.GetResourceString("copyMenuItem"); // PasteMenuItem.Text = resLoader.GetResourceString("pasteMenuItem"); }
private void OnIsInErrorPropertyChanged(bool oldValue, bool newValue) { // We need to have a good template for this to work if (m_textBlock == null) { return; } if (newValue) { // If there's an error message we need to override the normal display font // with the font appropriate for this language. This is because the error // message is localized and therefore can contain characters that are not // available in the normal font. // We use UIText as the font type because this is the most common font type to use m_textBlock.FontFamily = LocalizationService.GetInstance().GetLanguageFontFamilyForType(LanguageFontType.UIText); } else { // The error result is no longer an error so we will restore the // value to FontFamily property to the value provided in the style // for the TextBlock in the template. m_textBlock.ClearValue(TextBlock.FontFamilyProperty); } }
protected override void OnAttached() { base.OnAttached(); _control = AssociatedObject; InitHostingControl(); LocalizationService.GetInstance().OnCultureChanged += Translator_LanguageChanged; }
public DateCalculator() { InitializeComponent(); // Set Calendar Identifier DateDiff_FromDate.CalendarIdentifier = localizationSettings.GetCalendarIdentifier(); DateDiff_ToDate.CalendarIdentifier = localizationSettings.GetCalendarIdentifier(); // Setting the FirstDayofWeek DateDiff_FromDate.FirstDayOfWeek = localizationSettings.GetFirstDayOfWeek(); DateDiff_ToDate.FirstDayOfWeek = localizationSettings.GetFirstDayOfWeek(); // Setting the Language explicitly is not required, // this is a workaround for the bug in the control due to which // the displayed date is incorrect for non Gregorian Calendar Systems // The displayed date doesn't honor the shortdate format, on setting the Language the format is refreshed DateDiff_FromDate.Language = localizationSettings.GetLocaleName(); DateDiff_ToDate.Language = localizationSettings.GetLocaleName(); // Set Min and Max Dates according to the Gregorian Calendar(1601 & 9999) var calendar = new Calendar(); var today = calendar.GetDateTime(); calendar.ChangeCalendarSystem(CalendarIdentifiers.Gregorian); calendar.Day = 1; calendar.Month = 1; calendar.Year = c_minYear; var minYear = calendar.GetDateTime(); // 1st January, 1601 DateDiff_FromDate.MinDate = minYear; DateDiff_ToDate.MinDate = minYear; calendar.Day = 31; calendar.Month = 12; calendar.Year = c_maxYear; var maxYear = calendar.GetDateTime(); // 31st December, 9878 DateDiff_FromDate.MaxDate = maxYear; DateDiff_ToDate.MaxDate = maxYear; // Set the PlaceHolderText for CalendarDatePicker DateTimeFormatter dateTimeFormatter = LocalizationService.GetInstance().GetRegionalSettingsAwareDateTimeFormatter( "day month year", localizationSettings.GetCalendarIdentifier(), ClockIdentifiers.TwentyFourHour); // Clock Identifier is not used DateDiff_FromDate.DateFormat = "day month year"; DateDiff_ToDate.DateFormat = "day month year"; var placeholderText = dateTimeFormatter.Format(today); DateDiff_FromDate.PlaceholderText = placeholderText; DateDiff_ToDate.PlaceholderText = placeholderText; CopyMenuItem.Text = AppResourceProvider.GetInstance().GetResourceString("copyMenuItem"); DateCalculationOption.SelectionChanged += DateCalcOption_Changed; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is DateTime dateTime)) { return(""); } var today = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 0, 0, 0); return(dateTime == today ? LocalizationService.GetInstance()["Today"] : dateTime.ToString("ddd, dd.MM", LocalizationService.GetInstance().CurrentCulture)); }
public MainWindow() { ConfigurationHelper.ConfigurationRoot = new ConfigurationBuilder() .AddJsonFile("appsettings.terminal.json") .Build(); IServiceFactory serviceFactory = new ServiceFactory("Apollo_Database"); LocalizationService.GetInstance().SetSystemCulture(); RegisterOnScreenKeyboard(); DataContext = new MainViewModel(serviceFactory); InitializeComponent(); }
public Settings() { var locService = LocalizationService.GetInstance(); var resourceLoader = AppResourceProvider.GetInstance(); InitializeComponent(); Language = locService.GetLanguage(); InitializeAboutContentTextBlock(); var copyrightText = LocalizationStringUtil.GetLocalizedString(resourceLoader.GetResourceString("AboutControlCopyright"), BUILD_YEAR); AboutControlCopyrightRun.Text = copyrightText; InitializeContributeTextBlock(); }
public Calculator() { m_doAnimate = false; m_isLastAnimatedInScientific = false; m_isLastAnimatedInProgrammer = false; m_resultAnimate = false; SetFontSizeResources(); InitializeComponent(); LoadResourceStrings(); if (LocalizationService.GetInstance().IsRtlLayout()) { HistoryButton.HorizontalAlignment = HorizontalAlignment.Left; } m_displayFlyout = (MenuFlyout)Resources["DisplayContextMenu"]; var resLoader = AppResourceProvider.GetInstance(); CopyMenuItem.Text = resLoader.GetResourceString("copyMenuItem"); PasteMenuItem.Text = resLoader.GetResourceString("pasteMenuItem"); this.SizeChanged += Calculator_SizeChanged; }
private static void SelectLanguage(object language) { LocalizationService.GetInstance().CurrentCulture = new CultureInfo((string)language); }
public TranslationControl() { SelectLanguageCommand = new DelegateCommand <string>(SelectLanguage, language => LocalizationService.GetInstance().CurrentCulture.TwoLetterISOLanguageName != language); InitializeComponent(); DataContext = this; }
public HistoryList() { InitializeComponent(); HistoryEmpty.FlowDirection = LocalizationService.GetInstance().GetFlowDirection(); }
protected BaseViewModel() { SetConfigurationPath(); _localization = LocalizationService.GetInstance(); }
public Memory() { InitializeComponent(); MemoryPaneEmpty.FlowDirection = LocalizationService.GetInstance().GetFlowDirection(); }
protected override void OnDetaching() { LocalizationService.GetInstance().OnCultureChanged -= Translator_LanguageChanged; base.OnDetaching(); }