Skip to content

Commit

Permalink
Fix the Missing Part in Unit Converter Constructor (#1579)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzhang54 authored Jun 11, 2021
1 parent 88715b4 commit 9017f07
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/Calculator/Views/UnitConverter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,32 @@ public sealed partial class UnitConverter : UserControl
{
public UnitConverter()
{
this.InitializeComponent();
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");
}

public Windows.UI.Xaml.HorizontalAlignment FlowDirectionHorizontalAlignment
Expand Down Expand Up @@ -185,7 +210,6 @@ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)

private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
// CSHARP_MIGRATION: TODO: double check the original code with below migrated code
Model.PropertyChanged -= OnPropertyChanged;
Model.PropertyChanged += OnPropertyChanged;

Expand Down

0 comments on commit 9017f07

Please sign in to comment.