Merge master into feature/GraphingCalculator branch (#585)
* Merge master into feature/GraphingCalculator branch
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:model="using:CalculatorApp.ViewModel"
|
||||
Loaded="OnLoaded"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -19,241 +18,82 @@
|
||||
<TextBlock Margin="2,0,0,0"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
||||
IsTextScaleFactorEnabled="False"
|
||||
Text="{Binding Token, Mode=OneWay}"/>
|
||||
Text="{x:Bind Token, Mode=OneWay}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="Operator" x:DataType="common:DisplayExpressionToken">
|
||||
<TextBlock Margin="2,0,0,0"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
||||
IsTextScaleFactorEnabled="False"
|
||||
Text="{Binding Token, Mode=OneWay}"/>
|
||||
Text="{x:Bind Token, Mode=OneWay}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="Separator" x:DataType="common:DisplayExpressionToken">
|
||||
<TextBlock x:Name="MainText"
|
||||
IsTextScaleFactorEnabled="False"
|
||||
Text="{Binding Token, Mode=OneWay}"/>
|
||||
Text="{x:Bind Token, Mode=OneWay}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- TextBox Styles -->
|
||||
|
||||
<Style x:Key="OperandTextBoxStyle" TargetType="controls:OperandTextBox">
|
||||
<Setter Property="MinWidth" Value="32"/>
|
||||
<Setter Property="MinHeight" Value="20"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="SelectionHighlightColor" Value="{ThemeResource SystemControlBackgroundAccentBrush}"/>
|
||||
<Setter Property="FontSize" Value="{ThemeResource BodyFontSize}"/>
|
||||
<Setter Property="IsTextScaleFactorEnabled" Value="False"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="2,0,3,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:OperandTextBox">
|
||||
<Grid x:Name="BackgroundElement" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Disabled"/>
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ContentElement.Foreground" Value="{ThemeResource SystemControlForegroundAccentBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightListAccentLowBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Focused">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlForegroundChromeWhiteBrush}"/>
|
||||
<Setter Target="ContentElement.Foreground" Value="{ThemeResource SystemControlBackgroundChromeBlackHighBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ScrollViewer x:Name="ContentElement"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
HorizontalScrollMode="Disabled"
|
||||
IsDeferredScrollingEnabled="False"
|
||||
IsHorizontalRailEnabled="True"
|
||||
IsTabStop="False"
|
||||
IsVerticalRailEnabled="False"
|
||||
VerticalScrollBarVisibility="Disabled"
|
||||
VerticalScrollMode="Disabled"
|
||||
ZoomMode="Disabled"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OperatorTextBoxStyle" TargetType="controls:OperatorTextBox">
|
||||
<Setter Property="MinWidth" Value="4"/>
|
||||
<Setter Property="MinHeight" Value="20"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:OperatorTextBox">
|
||||
<Grid x:Name="BackgroundElement" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Disabled"/>
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="textElement.Foreground" Value="{ThemeResource SystemControlPageTextBaseMediumBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightListAccentLowBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Focused">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlBackgroundAccentBrush}"/>
|
||||
<Setter Target="textElement.Foreground" Value="{ThemeResource SystemControlForegroundChromeWhiteBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<TextBlock x:Name="textElement"
|
||||
Margin="0,-2,0,2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
FontSize="16"
|
||||
IsHitTestVisible="True"
|
||||
IsTextScaleFactorEnabled="False"
|
||||
Text="{Binding Token}"
|
||||
TextAlignment="Center"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style TargetType="controls:OverflowTextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:OverflowTextBlock">
|
||||
<Border x:Name="expressionborder" Background="Transparent">
|
||||
<Grid x:Name="tokenContainer" Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer x:Name="expressionContainer"
|
||||
Grid.Column="1"
|
||||
Padding="0,0,0,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Style="{StaticResource ResultsScrollerSnapped}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
LayoutUpdated="expressionContainer_LayoutUpdated">
|
||||
<ListView x:Name="TokenList"
|
||||
<Grid x:Name="TokenContainer" Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="12"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer x:Name="ExpressionContainer"
|
||||
Grid.Column="1"
|
||||
Padding="0,0,0,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Style="{StaticResource ResultsScrollerSnapped}"
|
||||
AutomationProperties.AccessibilityView="Raw">
|
||||
<ItemsControl x:Name="TokenList"
|
||||
Padding="0"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Right"
|
||||
VerticalContentAlignment="Stretch"
|
||||
IsTabStop="False"
|
||||
ItemContainerStyleSelector="{StaticResource ExpressionItemContainerStyle}"
|
||||
ItemTemplateSelector="{StaticResource ExpressionItemTemplateSelector}"
|
||||
ItemsSource="{Binding ExpressionTokens}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
||||
ScrollViewer.HorizontalScrollMode="Enabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollMode="Disabled"
|
||||
SelectionMode="None">
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
<ListView.ItemContainerTransitions>
|
||||
<TransitionCollection/>
|
||||
</ListView.ItemContainerTransitions>
|
||||
</ListView>
|
||||
</ScrollViewer>
|
||||
<Button x:Name="scrollLeft"
|
||||
x:Uid="scrollLeft"
|
||||
Grid.Column="0"
|
||||
Margin="-4,3,-4,0"
|
||||
Style="{StaticResource ScrollButtonStyle}">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
<Button x:Name="scrollRight"
|
||||
x:Uid="scrollRight"
|
||||
Grid.Column="2"
|
||||
Margin="0,3,-9,0"
|
||||
Style="{StaticResource ScrollButtonStyle}">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
ItemsSource="{Binding ExpressionTokens}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<ItemsStackPanel HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
<Button x:Name="ScrollLeft"
|
||||
x:Uid="scrollLeft"
|
||||
Grid.Column="0"
|
||||
Margin="-4,3,-4,0"
|
||||
Style="{StaticResource ScrollButtonStyle}">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
<Button x:Name="ScrollRight"
|
||||
x:Uid="scrollRight"
|
||||
Grid.Column="2"
|
||||
Margin="0,3,-9,0"
|
||||
Style="{StaticResource ScrollButtonStyle}">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ListViewItem Styles -->
|
||||
|
||||
<Style x:Key="ExpressionBaseContainerStyle" TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="MinWidth" Value="0"/>
|
||||
<Setter Property="MinHeight" Value="0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListViewItem">
|
||||
<ListViewItemPresenter Padding="0"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
ContentMargin="0"
|
||||
DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}"
|
||||
DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}"
|
||||
PointerOverBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
|
||||
PointerOverBackgroundMargin="0"
|
||||
SelectedBackground="{ThemeResource SystemControlBackgroundAccentBrush}"
|
||||
SelectedBorderThickness="0"
|
||||
SelectedForeground="{ThemeResource SystemControlForegroundChromeWhiteBrush}"
|
||||
SelectedPointerOverBackground="{ThemeResource SystemControlHighlightListAccentLowBrush}"
|
||||
SelectedPointerOverBorderBrush="Transparent"
|
||||
SelectionCheckMarkVisualEnabled="False"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="NonEditableOperatorContainerStyle"
|
||||
BasedOn="{StaticResource ExpressionBaseContainerStyle}"
|
||||
TargetType="ListViewItem">
|
||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="MinWidth" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="EditableOperatorContainerStyle"
|
||||
BasedOn="{StaticResource ExpressionBaseContainerStyle}"
|
||||
TargetType="ListViewItem">
|
||||
<Setter Property="IsHitTestVisible" Value="True"/>
|
||||
<Setter Property="MinWidth" Value="32"/>
|
||||
</Style>
|
||||
|
||||
<!-- Calculation Result Styles -->
|
||||
<Style x:Key="ResultsStyle"
|
||||
BasedOn="{StaticResource CalculationResultStyle}"
|
||||
@@ -332,11 +172,6 @@
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"/>
|
||||
|
||||
<Border x:Name="CustomTitleBar"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{ThemeResource TitleBarBackgroundTransparentBrush}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
@@ -412,12 +247,6 @@
|
||||
OperatorTemplate="{StaticResource Operator}"
|
||||
SeparatorTemplate="{StaticResource Separator}"/>
|
||||
|
||||
<converters:ExpressionItemContainerStyle x:Key="ExpressionItemContainerStyle"
|
||||
EditableOperatorStyle="{StaticResource NonEditableOperatorContainerStyle}"
|
||||
NonEditableOperatorStyle="{StaticResource NonEditableOperatorContainerStyle}"
|
||||
OperandStyle="{StaticResource NonEditableOperatorContainerStyle}"
|
||||
SeparatorStyle="{StaticResource NonEditableOperatorContainerStyle}"/>
|
||||
|
||||
<!-- Miscellaneous Resources -->
|
||||
|
||||
<automation:NarratorNotifier x:Name="NarratorNotifier" Announcement="{x:Bind Model.Announcement, Mode=OneWay}"/>
|
||||
@@ -455,7 +284,7 @@
|
||||
<Setter Target="MemRecall.IsEnabled" Value="False"/>
|
||||
<Setter Target="MemPlus.IsEnabled" Value="False"/>
|
||||
<Setter Target="MemMinus.IsEnabled" Value="False"/>
|
||||
<Setter Target="memButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MemButton.IsEnabled" Value="False"/>
|
||||
</VisualState.Setters>
|
||||
<Storyboard Completed="OnErrorLayoutCompleted"/>
|
||||
</VisualState>
|
||||
@@ -482,7 +311,7 @@
|
||||
<Setter Target="M4.MaxWidth" Value="99999"/>
|
||||
<Setter Target="M5.Width" Value="1*"/>
|
||||
<Setter Target="M5.MaxWidth" Value="80"/>
|
||||
<Setter Target="memButton.(Grid.Column)" Value="5"/>
|
||||
<Setter Target="MemButton.(Grid.Column)" Value="5"/>
|
||||
<Setter Target="MemoryButton.(Grid.Column)" Value="6"/>
|
||||
<Setter Target="HistoryButton.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
@@ -542,7 +371,7 @@
|
||||
<Setter Target="MemRecall.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
||||
<Setter Target="MemPlus.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
||||
<Setter Target="MemMinus.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
||||
<Setter Target="memButton.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
||||
<Setter Target="MemButton.Style" Value="{StaticResource CaptionButtonStyle}"/>
|
||||
<Setter Target="MemoryButton.MinHeight" Value="0"/>
|
||||
</VisualState.Setters>
|
||||
<Storyboard Completed="OnLayoutStateChanged"/>
|
||||
@@ -620,14 +449,14 @@
|
||||
IsInError="{x:Bind Model.IsInError, Mode=OneWay}"
|
||||
IsOperatorCommand="{x:Bind Model.IsOperatorCommand, Mode=OneWay}"
|
||||
TabIndex="1"/>
|
||||
<controls:OverflowTextBlock x:Name="expressionText"
|
||||
<controls:OverflowTextBlock x:Name="ExpressionText"
|
||||
Grid.Row="1"
|
||||
Margin="6,0,6,0"
|
||||
VerticalAlignment="Bottom"
|
||||
AutomationProperties.AutomationId="CalculatorExpression"
|
||||
AutomationProperties.Name="{x:Bind Model.CalculationExpressionAutomationName, Mode=OneWay}"
|
||||
IsTabStop="False"
|
||||
TokensUpdated="{Binding AreTokensUpdated, Mode=OneWay}"/>
|
||||
TokensUpdated="{x:Bind Model.AreTokensUpdated, Mode=OneWay}"/>
|
||||
|
||||
<!-- Programmer display panel controls -->
|
||||
<local:CalculatorProgrammerOperators x:Name="ProgrammerOperators"
|
||||
@@ -729,7 +558,7 @@
|
||||
Content="M-"
|
||||
TabIndex="13"
|
||||
Visibility="{Binding IsProgrammer, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="memButton"
|
||||
<controls:CalculatorButton x:Name="MemButton"
|
||||
x:Uid="memButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource CaptionButtonStyle}"
|
||||
|
||||
@@ -41,11 +41,11 @@ DEPENDENCY_PROPERTY_INITIALIZATION(Calculator, IsStandard);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(Calculator, IsScientific);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(Calculator, IsProgrammer);
|
||||
|
||||
Calculator::Calculator() :
|
||||
m_doAnimate(false),
|
||||
m_isLastAnimatedInScientific(false),
|
||||
m_isLastAnimatedInProgrammer(false),
|
||||
m_resultAnimate(false)
|
||||
Calculator::Calculator()
|
||||
: m_doAnimate(false)
|
||||
, m_isLastAnimatedInScientific(false)
|
||||
, m_isLastAnimatedInProgrammer(false)
|
||||
, m_resultAnimate(false)
|
||||
{
|
||||
SetFontSizeResources();
|
||||
InitializeComponent();
|
||||
@@ -56,7 +56,7 @@ m_resultAnimate(false)
|
||||
HistoryButton->HorizontalAlignment = ::HorizontalAlignment::Left;
|
||||
}
|
||||
|
||||
m_displayFlyout = static_cast<MenuFlyout^>(Resources->Lookup(L"DisplayContextMenu"));
|
||||
m_displayFlyout = static_cast<MenuFlyout ^>(Resources->Lookup(L"DisplayContextMenu"));
|
||||
auto resLoader = AppResourceProvider::GetInstance();
|
||||
CopyMenuItem->Text = resLoader.GetResourceString(L"copyMenuItem");
|
||||
PasteMenuItem->Text = resLoader.GetResourceString(L"pasteMenuItem");
|
||||
@@ -73,7 +73,7 @@ void Calculator::LoadResourceStrings()
|
||||
AutomationProperties::SetName(HistoryButton, m_openHistoryFlyoutAutomationName);
|
||||
}
|
||||
|
||||
void Calculator::InitializeHistoryView(_In_ HistoryViewModel^ historyVM)
|
||||
void Calculator::InitializeHistoryView(_In_ HistoryViewModel ^ historyVM)
|
||||
{
|
||||
if (m_historyList == nullptr)
|
||||
{
|
||||
@@ -89,30 +89,18 @@ void Calculator::SetFontSizeResources()
|
||||
// Since we need different font sizes for different numeric system,
|
||||
// we use a table of optimal font sizes for each numeric system.
|
||||
static const FontTable fontTables[] = {
|
||||
{ L"Arab", 104, 29.333, 23, 40, 56, 40, 56 },
|
||||
{ L"ArabExt", 104, 29.333, 23, 40, 56, 40, 56 },
|
||||
{ L"Beng", 104, 26, 17, 40, 56, 40, 56 },
|
||||
{ L"Deva", 104, 29.333, 20.5, 40, 56, 40, 56 },
|
||||
{ L"Gujr", 104, 29.333, 18.5, 40, 56, 40, 56 },
|
||||
{ L"Khmr", 104, 29.333, 19.5, 40, 56, 40, 56 },
|
||||
{ L"Knda", 104, 25, 17, 40, 56, 40, 56 },
|
||||
{ L"Laoo", 104, 28, 18, 40, 56, 40, 56 },
|
||||
{ L"Latn", 104, 29.333, 23, 40, 56, 40, 56 },
|
||||
{ L"Mlym", 80, 22, 15.5, 30, 56, 35, 48 },
|
||||
{ L"Mymr", 104, 29.333, 20, 35, 48, 36, 48 },
|
||||
{ L"Orya", 88, 26, 20, 40, 56, 40, 56 },
|
||||
{ L"TamlDec", 77, 25, 16, 28, 48, 34, 48 },
|
||||
{ L"Telu", 104, 25, 16.5, 40, 56, 40, 56 },
|
||||
{ L"Thai", 104, 28, 18, 40, 56, 40, 56 },
|
||||
{ L"Tibt", 104, 29.333, 20, 40, 56, 40, 56 },
|
||||
{ L"Default", 104, 29.333, 23, 40, 56, 40, 56 }
|
||||
{ L"Arab", 104, 29.333, 23, 40, 56, 40, 56 }, { L"ArabExt", 104, 29.333, 23, 40, 56, 40, 56 }, { L"Beng", 104, 26, 17, 40, 56, 40, 56 },
|
||||
{ L"Deva", 104, 29.333, 20.5, 40, 56, 40, 56 }, { L"Gujr", 104, 29.333, 18.5, 40, 56, 40, 56 }, { L"Khmr", 104, 29.333, 19.5, 40, 56, 40, 56 },
|
||||
{ L"Knda", 104, 25, 17, 40, 56, 40, 56 }, { L"Laoo", 104, 28, 18, 40, 56, 40, 56 }, { L"Latn", 104, 29.333, 23, 40, 56, 40, 56 },
|
||||
{ L"Mlym", 80, 22, 15.5, 30, 56, 35, 48 }, { L"Mymr", 104, 29.333, 20, 35, 48, 36, 48 }, { L"Orya", 88, 26, 20, 40, 56, 40, 56 },
|
||||
{ L"TamlDec", 77, 25, 16, 28, 48, 34, 48 }, { L"Telu", 104, 25, 16.5, 40, 56, 40, 56 }, { L"Thai", 104, 28, 18, 40, 56, 40, 56 },
|
||||
{ L"Tibt", 104, 29.333, 20, 40, 56, 40, 56 }, { L"Default", 104, 29.333, 23, 40, 56, 40, 56 }
|
||||
};
|
||||
|
||||
DecimalFormatter^ formatter = LocalizationService::GetRegionalSettingsAwareDecimalFormatter();
|
||||
DecimalFormatter^ formatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter();
|
||||
|
||||
const FontTable* currentItem = fontTables;
|
||||
while (currentItem->numericSystem.compare(std::wstring(L"Default")) != 0 &&
|
||||
currentItem->numericSystem.compare(formatter->NumeralSystem->Data()) != 0)
|
||||
while (currentItem->numericSystem.compare(std::wstring(L"Default")) != 0 && currentItem->numericSystem.compare(formatter->NumeralSystem->Data()) != 0)
|
||||
{
|
||||
currentItem++;
|
||||
}
|
||||
@@ -126,36 +114,36 @@ void Calculator::SetFontSizeResources()
|
||||
this->Resources->Insert(StringReference(L"CalcButtonScientificPortraitCaptionSizeOverride"), currentItem->portraitScientificNumPadFont);
|
||||
}
|
||||
|
||||
void Calculator::OnLoaded(_In_ Object^, _In_ RoutedEventArgs^)
|
||||
void Calculator::OnLoaded(_In_ Object ^, _In_ RoutedEventArgs ^)
|
||||
{
|
||||
Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &Calculator::OnCalcPropertyChanged);
|
||||
Model->HideMemoryClicked += ref new HideMemoryClickedHandler(this, &Calculator::OnHideMemoryClicked);
|
||||
|
||||
InitializeHistoryView(Model->HistoryVM);
|
||||
String^ historyPaneName = AppResourceProvider::GetInstance().GetResourceString(L"HistoryPane");
|
||||
String ^ historyPaneName = AppResourceProvider::GetInstance().GetResourceString(L"HistoryPane");
|
||||
HistoryFlyout->FlyoutPresenterStyle->Setters->Append(ref new Setter(AutomationProperties::NameProperty, historyPaneName));
|
||||
String^ memoryPaneName = AppResourceProvider::GetInstance().GetResourceString(L"MemoryPane");
|
||||
String ^ memoryPaneName = AppResourceProvider::GetInstance().GetResourceString(L"MemoryPane");
|
||||
MemoryFlyout->FlyoutPresenterStyle->Setters->Append(ref new Setter(AutomationProperties::NameProperty, memoryPaneName));
|
||||
|
||||
if (Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Controls.Primitives.FlyoutBase", L"Closing"))
|
||||
{
|
||||
HistoryFlyout->Closing += ref new TypedEventHandler<FlyoutBase^, FlyoutBaseClosingEventArgs^>(this, &Calculator::HistoryFlyout_Closing);
|
||||
MemoryFlyout->Closing += ref new TypedEventHandler<FlyoutBase^, FlyoutBaseClosingEventArgs^>(this, &Calculator::OnMemoryFlyoutClosing);
|
||||
HistoryFlyout->Closing += ref new TypedEventHandler<FlyoutBase ^, FlyoutBaseClosingEventArgs ^>(this, &Calculator::HistoryFlyout_Closing);
|
||||
MemoryFlyout->Closing += ref new TypedEventHandler<FlyoutBase ^, FlyoutBaseClosingEventArgs ^>(this, &Calculator::OnMemoryFlyoutClosing);
|
||||
}
|
||||
|
||||
// Delay load things later when we get a chance.
|
||||
WeakReference weakThis(this);
|
||||
this->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([weakThis]()
|
||||
{
|
||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||
{
|
||||
auto refThis = weakThis.Resolve<Calculator>();
|
||||
if (refThis != nullptr)
|
||||
this->Dispatcher->RunAsync(
|
||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([weakThis]() {
|
||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||
{
|
||||
refThis->GetMemory();
|
||||
auto refThis = weakThis.Resolve<Calculator>();
|
||||
if (refThis != nullptr)
|
||||
{
|
||||
refThis->GetMemory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
std::wstring Calculator::GetCurrentLayoutState()
|
||||
@@ -203,17 +191,17 @@ void Calculator::UpdateViewState()
|
||||
CloseHistoryFlyout();
|
||||
CloseMemoryFlyout();
|
||||
|
||||
VisualStateManager::GoToState(this, ref new String(state.c_str()), true/*useTransitions*/);
|
||||
VisualStateManager::GoToState(this, ref new String(state.c_str()), true /*useTransitions*/);
|
||||
}
|
||||
|
||||
|
||||
void Calculator::AnimateCalculator(bool resultAnimate)
|
||||
{
|
||||
if (App::IsAnimationEnabled())
|
||||
{
|
||||
m_doAnimate = true;
|
||||
m_resultAnimate = resultAnimate;
|
||||
if (((m_isLastAnimatedInScientific && IsScientific) || (!m_isLastAnimatedInScientific && !IsScientific)) && ((m_isLastAnimatedInProgrammer && IsProgrammer) || (!m_isLastAnimatedInProgrammer && !IsProgrammer)))
|
||||
if (((m_isLastAnimatedInScientific && IsScientific) || (!m_isLastAnimatedInScientific && !IsScientific))
|
||||
&& ((m_isLastAnimatedInProgrammer && IsProgrammer) || (!m_isLastAnimatedInProgrammer && !IsProgrammer)))
|
||||
{
|
||||
// We are forcing the animation here
|
||||
// It's because if last animation was in standard, then go to unit converter, then comes back to standard
|
||||
@@ -223,9 +211,9 @@ void Calculator::AnimateCalculator(bool resultAnimate)
|
||||
}
|
||||
}
|
||||
|
||||
void Calculator::OnContextRequested(UIElement^ sender, ContextRequestedEventArgs^ e)
|
||||
void Calculator::OnContextRequested(UIElement ^ sender, ContextRequestedEventArgs ^ e)
|
||||
{
|
||||
auto requestedElement = safe_cast<FrameworkElement^>(e->OriginalSource);
|
||||
auto requestedElement = safe_cast<FrameworkElement ^>(e->OriginalSource);
|
||||
|
||||
PasteMenuItem->IsEnabled = CopyPasteManager::HasStringToPaste();
|
||||
|
||||
@@ -243,12 +231,12 @@ void Calculator::OnContextRequested(UIElement^ sender, ContextRequestedEventArgs
|
||||
e->Handled = true;
|
||||
}
|
||||
|
||||
void Calculator::OnContextCanceled(UIElement^ sender, RoutedEventArgs^ e)
|
||||
void Calculator::OnContextCanceled(UIElement ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
m_displayFlyout->Hide();
|
||||
}
|
||||
|
||||
void Calculator::OnLayoutStateChanged(_In_ Object^ sender, _In_ Object^ e)
|
||||
void Calculator::OnLayoutStateChanged(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
UpdatePanelViewState();
|
||||
}
|
||||
@@ -275,7 +263,7 @@ void Calculator::OnIsProgrammerPropertyChanged(bool /*oldValue*/, bool newValue)
|
||||
if (newValue)
|
||||
{
|
||||
EnsureProgrammer();
|
||||
m_pivotItem = static_cast<Windows::UI::Xaml::Controls::PivotItem^>(DockPivot->Items->GetAt(0));
|
||||
m_pivotItem = static_cast<Windows::UI::Xaml::Controls::PivotItem ^>(DockPivot->Items->GetAt(0));
|
||||
DockPivot->Items->RemoveAt(0);
|
||||
}
|
||||
else
|
||||
@@ -295,7 +283,7 @@ void Calculator::OnIsInErrorPropertyChanged()
|
||||
{
|
||||
bool isError = Model->IsInError;
|
||||
|
||||
String^ newState = isError ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = isError ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
|
||||
if (m_memory != nullptr)
|
||||
@@ -316,7 +304,7 @@ void Calculator::OnIsInErrorPropertyChanged()
|
||||
|
||||
// Once the storyboard that rearranges the buttons completed,
|
||||
// We do the animation based on the Mode or Orientation change.
|
||||
void Calculator::OnStoryboardCompleted(_In_ Object^ sender, _In_ Object^ e)
|
||||
void Calculator::OnStoryboardCompleted(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
m_isLastAnimatedInScientific = IsScientific;
|
||||
m_isLastAnimatedInProgrammer = IsProgrammer;
|
||||
@@ -361,9 +349,9 @@ void Calculator::EnsureProgrammer()
|
||||
ProgrammerOperators->SetRadixButton(Model->GetCurrentRadixType());
|
||||
}
|
||||
|
||||
void Calculator::OnCalcPropertyChanged(_In_ Object^ sender, _In_ PropertyChangedEventArgs^ e)
|
||||
void Calculator::OnCalcPropertyChanged(_In_ Object ^ sender, _In_ PropertyChangedEventArgs ^ e)
|
||||
{
|
||||
String^ prop = e->PropertyName;
|
||||
String ^ prop = e->PropertyName;
|
||||
if (prop == StandardCalculatorViewModel::IsMemoryEmptyPropertyName)
|
||||
{
|
||||
UpdateMemoryState();
|
||||
@@ -382,7 +370,7 @@ void Calculator::UpdatePanelViewState()
|
||||
|
||||
void Calculator::UpdateHistoryState()
|
||||
{
|
||||
String^ viewState = App::GetAppViewState();
|
||||
String ^ viewState = App::GetAppViewState();
|
||||
if (viewState == ViewState::DockedView)
|
||||
{
|
||||
// docked view
|
||||
@@ -396,7 +384,7 @@ void Calculator::UpdateHistoryState()
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // flyout view
|
||||
{ // flyout view
|
||||
DockHistoryHolder->Child = nullptr;
|
||||
if (!IsProgrammer)
|
||||
{
|
||||
@@ -418,7 +406,7 @@ void Calculator::UpdateMemoryState()
|
||||
ClearMemoryButton->IsEnabled = false;
|
||||
}
|
||||
|
||||
String^ viewState = App::GetAppViewState();
|
||||
String ^ viewState = App::GetAppViewState();
|
||||
if (viewState == ViewState::DockedView)
|
||||
{
|
||||
CloseMemoryFlyout();
|
||||
@@ -457,7 +445,7 @@ void Calculator::OnHideHistoryClicked()
|
||||
ToggleHistoryFlyout(nullptr);
|
||||
}
|
||||
|
||||
void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel^ e)
|
||||
void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel ^ e)
|
||||
{
|
||||
unsigned int tokenSize;
|
||||
assert(e->GetTokens() != nullptr);
|
||||
@@ -473,7 +461,7 @@ void Calculator::OnHistoryItemClicked(_In_ HistoryItemViewModel^ e)
|
||||
this->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
|
||||
void Calculator::HistoryFlyout_Opened(_In_ Object ^sender, _In_ Object ^args)
|
||||
void Calculator::HistoryFlyout_Opened(_In_ Object ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
m_fIsHistoryFlyoutOpen = true;
|
||||
m_IsLastFlyoutMemory = false;
|
||||
@@ -484,13 +472,13 @@ void Calculator::HistoryFlyout_Opened(_In_ Object ^sender, _In_ Object ^args)
|
||||
TraceLogger::GetInstance().LogHistoryBodyOpened();
|
||||
}
|
||||
|
||||
void Calculator::HistoryFlyout_Closing(_In_ FlyoutBase^ sender, _In_ FlyoutBaseClosingEventArgs^ args)
|
||||
void Calculator::HistoryFlyout_Closing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args)
|
||||
{
|
||||
// Set in the Closing event so the new name is available when the Flyout has Closed.
|
||||
AutomationProperties::SetName(HistoryButton, m_openHistoryFlyoutAutomationName);
|
||||
}
|
||||
|
||||
void Calculator::HistoryFlyout_Closed(_In_ Object ^sender, _In_ Object ^args)
|
||||
void Calculator::HistoryFlyout_Closed(_In_ Object ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
// Ideally, this would be renamed in the Closing event because the Closed event is too late.
|
||||
// Closing is not available until RS1+ so we set the name again here for TH2 support.
|
||||
@@ -526,9 +514,9 @@ void Calculator::SetDefaultFocus()
|
||||
Results->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
|
||||
void Calculator::ToggleHistoryFlyout(Object^ /*parameter*/)
|
||||
void Calculator::ToggleHistoryFlyout(Object ^ /*parameter*/)
|
||||
{
|
||||
String^ viewState = App::GetAppViewState();
|
||||
String ^ viewState = App::GetAppViewState();
|
||||
// If app starts correctly in snap mode and shortcut is used for history then we need to load history if not yet initialized.
|
||||
if (viewState != ViewState::DockedView)
|
||||
{
|
||||
@@ -548,7 +536,7 @@ void Calculator::ToggleHistoryFlyout(Object^ /*parameter*/)
|
||||
|
||||
void Calculator::ToggleMemoryFlyout()
|
||||
{
|
||||
String^ viewState = App::GetAppViewState();
|
||||
String ^ viewState = App::GetAppViewState();
|
||||
if (viewState != ViewState::DockedView)
|
||||
{
|
||||
if (m_fIsMemoryFlyoutOpen)
|
||||
@@ -565,7 +553,7 @@ void Calculator::ToggleMemoryFlyout()
|
||||
}
|
||||
}
|
||||
|
||||
void Calculator::OnMemoryFlyoutOpened(_In_ Object ^sender, _In_ Object ^args)
|
||||
void Calculator::OnMemoryFlyoutOpened(_In_ Object ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
TraceLogger::GetInstance().LogMemoryFlyoutOpenEnd(Model->MemorizedNumbers->Size);
|
||||
m_IsLastFlyoutMemory = true;
|
||||
@@ -576,13 +564,13 @@ void Calculator::OnMemoryFlyoutOpened(_In_ Object ^sender, _In_ Object ^args)
|
||||
TraceLogger::GetInstance().LogMemoryBodyOpened();
|
||||
}
|
||||
|
||||
void Calculator::OnMemoryFlyoutClosing(_In_ FlyoutBase^ sender, _In_ FlyoutBaseClosingEventArgs^ args)
|
||||
void Calculator::OnMemoryFlyoutClosing(_In_ FlyoutBase ^ sender, _In_ FlyoutBaseClosingEventArgs ^ args)
|
||||
{
|
||||
// Set in the Closing event so the new name is available when the Flyout has Closed.
|
||||
AutomationProperties::SetName(MemoryButton, m_openMemoryFlyoutAutomationName);
|
||||
}
|
||||
|
||||
void Calculator::OnMemoryFlyoutClosed(_In_ Object ^sender, _In_ Object ^args)
|
||||
void Calculator::OnMemoryFlyoutClosed(_In_ Object ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
// Ideally, this would be renamed in the Closing event because the Closed event is too late.
|
||||
// Closing is not available until RS1+ so we set the name again here for TH2 support.
|
||||
@@ -597,12 +585,12 @@ void Calculator::OnMemoryFlyoutClosed(_In_ Object ^sender, _In_ Object ^args)
|
||||
FullscreenFlyoutClosed();
|
||||
}
|
||||
|
||||
Memory^ Calculator::GetMemory()
|
||||
Memory ^ Calculator::GetMemory()
|
||||
{
|
||||
if (m_memory == nullptr)
|
||||
{
|
||||
m_memory = ref new Memory();
|
||||
VisualStateManager::GoToState(m_memory, ref new String(GetCurrentLayoutState().c_str()), true/*useTransitions*/);
|
||||
VisualStateManager::GoToState(m_memory, ref new String(GetCurrentLayoutState().c_str()), true /*useTransitions*/);
|
||||
}
|
||||
|
||||
return m_memory;
|
||||
@@ -620,7 +608,7 @@ void Calculator::OnHideMemoryClicked()
|
||||
|
||||
void Calculator::EnableMemoryControls(bool enable)
|
||||
{
|
||||
memButton->IsEnabled = enable;
|
||||
MemButton->IsEnabled = enable;
|
||||
MemMinus->IsEnabled = enable;
|
||||
MemPlus->IsEnabled = enable;
|
||||
if (!Model->IsMemoryEmpty)
|
||||
@@ -636,9 +624,9 @@ void Calculator::EnableControls(bool enable)
|
||||
EnableMemoryControls(enable);
|
||||
}
|
||||
|
||||
void Calculator::OnMemoryFlyOutTapped(_In_ Object^ sender, _In_ TappedRoutedEventArgs^ e)
|
||||
void Calculator::OnMemoryFlyOutTapped(_In_ Object ^ sender, _In_ TappedRoutedEventArgs ^ e)
|
||||
{
|
||||
Grid^ grid = safe_cast<Grid^> (sender);
|
||||
Grid ^ grid = safe_cast<Grid ^>(sender);
|
||||
Point point = e->GetPosition(nullptr);
|
||||
|
||||
if (point.Y < (grid->ActualHeight - NumpadPanel->ActualHeight))
|
||||
@@ -647,10 +635,9 @@ void Calculator::OnMemoryFlyOutTapped(_In_ Object^ sender, _In_ TappedRoutedEven
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Calculator::OnHistoryFlyOutTapped(_In_ Object^ sender, _In_ TappedRoutedEventArgs^ e)
|
||||
void Calculator::OnHistoryFlyOutTapped(_In_ Object ^ sender, _In_ TappedRoutedEventArgs ^ e)
|
||||
{
|
||||
Grid^ grid = safe_cast<Grid^> (sender);
|
||||
Grid ^ grid = safe_cast<Grid ^>(sender);
|
||||
Point point = e->GetPosition(nullptr);
|
||||
|
||||
if (point.Y < (grid->ActualHeight - NumpadPanel->ActualHeight))
|
||||
@@ -659,11 +646,6 @@ void Calculator::OnHistoryFlyOutTapped(_In_ Object^ sender, _In_ TappedRoutedEve
|
||||
}
|
||||
}
|
||||
|
||||
void Calculator::expressionContainer_LayoutUpdated(_In_ Object^ sender, _In_ Object^ e)
|
||||
{
|
||||
expressionText->UpdateScrollButtons();
|
||||
}
|
||||
|
||||
bool Calculator::IsValidRegularExpression(std::wstring str)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -673,7 +655,7 @@ bool Calculator::IsValidRegularExpression(std::wstring str)
|
||||
regexPatterns[2] = L"[-]{0,1}[0-9]{0,}[.]{0,1}[0-9]{0,}[e]{1}[-]{1}[0-9]{1,}";
|
||||
|
||||
const auto& localizer = LocalizationSettings::GetInstance();
|
||||
String^ englishString = localizer.GetEnglishValueFromLocalizedDigits(str);
|
||||
String ^ englishString = localizer.GetEnglishValueFromLocalizedDigits(str);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
@@ -686,7 +668,7 @@ bool Calculator::IsValidRegularExpression(std::wstring str)
|
||||
return result;
|
||||
}
|
||||
|
||||
void Calculator::DockPanelTapped(_In_ TappedRoutedEventArgs^ e)
|
||||
void Calculator::DockPanelTapped(_In_ TappedRoutedEventArgs ^ e)
|
||||
{
|
||||
int index = DockPivot->SelectedIndex;
|
||||
if (index == 1 && !IsProgrammer)
|
||||
@@ -700,26 +682,25 @@ void Calculator::DockPanelTapped(_In_ TappedRoutedEventArgs^ e)
|
||||
|
||||
void Calculator::UnregisterEventHandlers()
|
||||
{
|
||||
expressionText->UnregisterEventHandlers();
|
||||
ExpressionText->UnregisterEventHandlers();
|
||||
}
|
||||
|
||||
void Calculator::OnErrorLayoutCompleted(_In_ Object^ sender, _In_ Object^ e)
|
||||
void Calculator::OnErrorLayoutCompleted(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
SetDefaultFocus();
|
||||
}
|
||||
|
||||
void Calculator::OnHistoryAccessKeyInvoked(_In_ UIElement^ sender, _In_ AccessKeyInvokedEventArgs^ args)
|
||||
void Calculator::OnHistoryAccessKeyInvoked(_In_ UIElement ^ sender, _In_ AccessKeyInvokedEventArgs ^ args)
|
||||
{
|
||||
DockPivot->SelectedItem = HistoryPivotItem;
|
||||
}
|
||||
|
||||
void Calculator::OnMemoryAccessKeyInvoked(_In_ UIElement^ sender, _In_ AccessKeyInvokedEventArgs^ args)
|
||||
void Calculator::OnMemoryAccessKeyInvoked(_In_ UIElement ^ sender, _In_ AccessKeyInvokedEventArgs ^ args)
|
||||
{
|
||||
DockPivot->SelectedItem = MemoryPivotItem;
|
||||
}
|
||||
|
||||
|
||||
void CalculatorApp::Calculator::DockPivot_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e)
|
||||
void CalculatorApp::Calculator::DockPivot_SelectionChanged(Platform::Object ^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e)
|
||||
{
|
||||
if (DockPivot->SelectedIndex == 0)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "Views/Calculator.g.h"
|
||||
#include "Converters/BooleanNegationConverter.h"
|
||||
#include "Converters/ExpressionItemContainerStyle.h"
|
||||
#include "Converters/ExpressionItemTemplateSelector.h"
|
||||
#include "Converters/VisibilityNegationConverter.h"
|
||||
#include "CalcViewModel/Common/Automation/NarratorNotifier.h"
|
||||
@@ -35,13 +34,13 @@ namespace CalculatorApp
|
||||
double portraitScientificNumPadFont;
|
||||
};
|
||||
|
||||
public delegate void FullscreenFlyoutClosedEventHandler();
|
||||
public
|
||||
delegate void FullscreenFlyoutClosedEventHandler();
|
||||
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class Calculator sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class Calculator sealed
|
||||
{
|
||||
public:
|
||||
event FullscreenFlyoutClosedEventHandler^ FullscreenFlyoutClosed;
|
||||
event FullscreenFlyoutClosedEventHandler ^ FullscreenFlyoutClosed;
|
||||
|
||||
Calculator();
|
||||
property CalculatorApp::ViewModel::StandardCalculatorViewModel^ Model
|
||||
@@ -59,7 +58,7 @@ namespace CalculatorApp
|
||||
COMMAND_FOR_METHOD(HistoryButtonPressed, Calculator::ToggleHistoryFlyout);
|
||||
|
||||
void AnimateCalculator(bool resultAnimate);
|
||||
void InitializeHistoryView(CalculatorApp::ViewModel::HistoryViewModel^ historyVM);
|
||||
void InitializeHistoryView(CalculatorApp::ViewModel::HistoryViewModel ^ historyVM);
|
||||
void UpdatePanelViewState();
|
||||
void UnregisterEventHandlers();
|
||||
|
||||
@@ -69,7 +68,7 @@ namespace CalculatorApp
|
||||
void SetDefaultFocus();
|
||||
|
||||
private:
|
||||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
void LoadResourceStrings();
|
||||
|
||||
@@ -77,24 +76,24 @@ namespace CalculatorApp
|
||||
void UpdateMemoryState();
|
||||
void UpdateHistoryState();
|
||||
|
||||
void CalculationResultsOnSelected(_In_ Platform::Object^ sender);
|
||||
void OnContextRequested(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs^ e);
|
||||
void OnContextCanceled(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void CalculationResultsOnSelected(_In_ Platform::Object ^ sender);
|
||||
void OnContextRequested(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs ^ e);
|
||||
void OnContextCanceled(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnIsScientificPropertyChanged(bool oldValue, bool newValue);
|
||||
void OnIsProgrammerPropertyChanged(bool oldValue, bool newValue);
|
||||
void OnIsStandardPropertyChanged(bool oldValue, bool newValue);
|
||||
void OnIsInErrorPropertyChanged();
|
||||
void OnCalcPropertyChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e);
|
||||
void OnStoryboardCompleted(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnLayoutStateChanged(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnCalcPropertyChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
void OnStoryboardCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void OnLayoutStateChanged(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void EnsureScientific();
|
||||
void EnsureProgrammer();
|
||||
void SetFontSizeResources();
|
||||
std::wstring GetCurrentLayoutState();
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::Controls::ListView^ m_tokenList;
|
||||
Windows::UI::Xaml::Controls::MenuFlyout^ m_displayFlyout;
|
||||
Windows::UI::Xaml::Controls::ListView ^ m_tokenList;
|
||||
Windows::UI::Xaml::Controls::MenuFlyout ^ m_displayFlyout;
|
||||
bool m_doAnimate;
|
||||
bool m_resultAnimate;
|
||||
bool m_isLastAnimatedInScientific;
|
||||
@@ -102,41 +101,44 @@ namespace CalculatorApp
|
||||
bool m_IsLastFlyoutMemory = false;
|
||||
bool m_IsLastFlyoutHistory = false;
|
||||
|
||||
Platform::String^ m_openMemoryFlyoutAutomationName;
|
||||
Platform::String^ m_closeMemoryFlyoutAutomationName;
|
||||
Platform::String^ m_openHistoryFlyoutAutomationName;
|
||||
Platform::String^ m_closeHistoryFlyoutAutomationName;
|
||||
Platform::String ^ m_openMemoryFlyoutAutomationName;
|
||||
Platform::String ^ m_closeMemoryFlyoutAutomationName;
|
||||
Platform::String ^ m_openHistoryFlyoutAutomationName;
|
||||
Platform::String ^ m_closeHistoryFlyoutAutomationName;
|
||||
|
||||
Windows::UI::Xaml::Controls::PivotItem^ m_pivotItem;
|
||||
Windows::UI::Xaml::Controls::PivotItem ^ m_pivotItem;
|
||||
bool m_IsDigit = false;
|
||||
Memory^ m_memory;
|
||||
void HistoryFlyout_Opened(_In_ Platform::Object ^sender, _In_ Platform::Object ^args);
|
||||
void HistoryFlyout_Closing(_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase^ sender, _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs^ args);
|
||||
void HistoryFlyout_Closed(_In_ Platform::Object ^sender, _In_ Platform::Object ^args);
|
||||
Memory ^ m_memory;
|
||||
void HistoryFlyout_Opened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void HistoryFlyout_Closing(
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
|
||||
void HistoryFlyout_Closed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnHideHistoryClicked();
|
||||
void OnHideMemoryClicked();
|
||||
void OnHistoryItemClicked(_In_ CalculatorApp::ViewModel::HistoryItemViewModel^ e);
|
||||
void ToggleHistoryFlyout(Platform::Object^ parameter);
|
||||
void OnHistoryItemClicked(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
||||
void ToggleHistoryFlyout(Platform::Object ^ parameter);
|
||||
void ToggleMemoryFlyout();
|
||||
CalculatorApp::HistoryList^ m_historyList;
|
||||
CalculatorApp::HistoryList ^ m_historyList;
|
||||
bool m_fIsHistoryFlyoutOpen;
|
||||
bool m_fIsMemoryFlyoutOpen;
|
||||
void OnMemoryFlyoutOpened(_In_ Platform::Object ^sender, _In_ Platform::Object ^args);
|
||||
void OnMemoryFlyoutClosing(_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase^ sender, _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs^ args);
|
||||
void OnMemoryFlyoutClosed(_In_ Platform::Object ^sender, _In_ Platform::Object ^args);
|
||||
void OnMemoryFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnMemoryFlyoutClosing(
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
|
||||
void OnMemoryFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void SetChildAsMemory();
|
||||
void SetChildAsHistory();
|
||||
Memory^ GetMemory();
|
||||
Memory ^ GetMemory();
|
||||
void EnableControls(bool enable);
|
||||
void EnableMemoryControls(bool enable);
|
||||
void OnMemoryFlyOutTapped(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
|
||||
void OnHistoryFlyOutTapped(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
|
||||
void expressionContainer_LayoutUpdated(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnMemoryFlyOutTapped(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e);
|
||||
void OnHistoryFlyOutTapped(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e);
|
||||
bool IsValidRegularExpression(std::wstring str);
|
||||
void DockPanelTapped(_In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
|
||||
void OnErrorLayoutCompleted(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs^ args);
|
||||
void OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs^ args);
|
||||
void DockPivot_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
|
||||
};
|
||||
void DockPanelTapped(_In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e);
|
||||
void OnErrorLayoutCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args);
|
||||
void OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args);
|
||||
void DockPivot_SelectionChanged(Platform::Object ^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ using namespace Windows::UI::Xaml::Input;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
CalculatorProgrammerBitFlipPanel::CalculatorProgrammerBitFlipPanel() :
|
||||
m_updatingCheckedStates(false)
|
||||
CalculatorProgrammerBitFlipPanel::CalculatorProgrammerBitFlipPanel()
|
||||
: m_updatingCheckedStates(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
auto booleanToVisibilityConverter = ref new Converters::BooleanToVisibilityConverter;
|
||||
@@ -35,13 +35,13 @@ CalculatorProgrammerBitFlipPanel::CalculatorProgrammerBitFlipPanel() :
|
||||
AssignFlipButtons();
|
||||
}
|
||||
|
||||
void CalculatorProgrammerBitFlipPanel::OnLoaded(Object^ sender, RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerBitFlipPanel::OnLoaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
UnsubscribePropertyChanged();
|
||||
SubscribePropertyChanged();
|
||||
}
|
||||
|
||||
void CalculatorProgrammerBitFlipPanel::OnUnloaded(Object^ sender, RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerBitFlipPanel::OnUnloaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
UnsubscribePropertyChanged();
|
||||
}
|
||||
@@ -50,8 +50,7 @@ void CalculatorProgrammerBitFlipPanel::SubscribePropertyChanged()
|
||||
{
|
||||
if (Model != nullptr)
|
||||
{
|
||||
m_propertyChangedToken =
|
||||
Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerBitFlipPanel::OnPropertyChanged);
|
||||
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerBitFlipPanel::OnPropertyChanged);
|
||||
|
||||
UpdateCheckedStates();
|
||||
}
|
||||
@@ -66,7 +65,7 @@ void CalculatorProgrammerBitFlipPanel::UnsubscribePropertyChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerBitFlipPanel::OnPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||
void CalculatorProgrammerBitFlipPanel::OnPropertyChanged(Object ^ sender, PropertyChangedEventArgs ^ e)
|
||||
{
|
||||
if (e->PropertyName == StandardCalculatorViewModel::BinaryDisplayValuePropertyName)
|
||||
{
|
||||
@@ -74,25 +73,25 @@ void CalculatorProgrammerBitFlipPanel::OnPropertyChanged(Object^ sender, Propert
|
||||
}
|
||||
}
|
||||
|
||||
StandardCalculatorViewModel^ CalculatorProgrammerBitFlipPanel::Model::get()
|
||||
StandardCalculatorViewModel ^ CalculatorProgrammerBitFlipPanel::Model::get()
|
||||
{
|
||||
return static_cast<StandardCalculatorViewModel^>(this->DataContext);
|
||||
return static_cast<StandardCalculatorViewModel ^>(this->DataContext);
|
||||
}
|
||||
|
||||
void CalculatorProgrammerBitFlipPanel::AssignFlipButtons()
|
||||
{
|
||||
assert(m_flipButtons.size() == 64);
|
||||
|
||||
m_flipButtons[0] = this->Bit0;
|
||||
m_flipButtons[1] = this->Bit1;
|
||||
m_flipButtons[2] = this->Bit2;
|
||||
m_flipButtons[3] = this->Bit3;
|
||||
m_flipButtons[4] = this->Bit4;
|
||||
m_flipButtons[5] = this->Bit5;
|
||||
m_flipButtons[6] = this->Bit6;
|
||||
m_flipButtons[7] = this->Bit7;
|
||||
m_flipButtons[8] = this->Bit8;
|
||||
m_flipButtons[9] = this->Bit9;
|
||||
m_flipButtons[0] = this->Bit0;
|
||||
m_flipButtons[1] = this->Bit1;
|
||||
m_flipButtons[2] = this->Bit2;
|
||||
m_flipButtons[3] = this->Bit3;
|
||||
m_flipButtons[4] = this->Bit4;
|
||||
m_flipButtons[5] = this->Bit5;
|
||||
m_flipButtons[6] = this->Bit6;
|
||||
m_flipButtons[7] = this->Bit7;
|
||||
m_flipButtons[8] = this->Bit8;
|
||||
m_flipButtons[9] = this->Bit9;
|
||||
m_flipButtons[10] = this->Bit10;
|
||||
m_flipButtons[11] = this->Bit11;
|
||||
m_flipButtons[12] = this->Bit12;
|
||||
@@ -149,29 +148,31 @@ void CalculatorProgrammerBitFlipPanel::AssignFlipButtons()
|
||||
m_flipButtons[63] = this->Bit63;
|
||||
}
|
||||
|
||||
void CalculatorProgrammerBitFlipPanel::SetVisibilityBinding(_In_ FrameworkElement^ element, _In_ String^ path, _In_ IValueConverter^ converter)
|
||||
void CalculatorProgrammerBitFlipPanel::SetVisibilityBinding(_In_ FrameworkElement ^ element, _In_ String ^ path, _In_ IValueConverter ^ converter)
|
||||
{
|
||||
Binding^ commandBinding = ref new Binding();
|
||||
Binding ^ commandBinding = ref new Binding();
|
||||
commandBinding->Path = ref new PropertyPath(path);
|
||||
commandBinding->Converter = converter;
|
||||
element->SetBinding(VisibilityProperty, commandBinding);
|
||||
}
|
||||
|
||||
void CalculatorProgrammerBitFlipPanel::OnBitToggled(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerBitFlipPanel::OnBitToggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
if (m_updatingCheckedStates) { return; }
|
||||
if (m_updatingCheckedStates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle this the bit toggled event only if it is coming from BitFlip mode.
|
||||
// Any input from the Numpad may also result in toggling the bit as their state is bound to the BinaryDisplayValue.
|
||||
// Also, if the mode is switched to other Calculator modes when the BitFlip panel is open,
|
||||
// a race condition exists in which the IsProgrammerMode property is still true and the UpdatePrimaryResult() is called,
|
||||
// which continuously alters the Display Value and the state of the Bit Flip buttons.
|
||||
if ((Model->IsBitFlipChecked)
|
||||
&& Model->IsProgrammer)
|
||||
if ((Model->IsBitFlipChecked) && Model->IsProgrammer)
|
||||
{
|
||||
TraceLogger::GetInstance().LogBitFlipUsed();
|
||||
|
||||
auto flipButton = static_cast<FlipButtons^>(sender);
|
||||
auto flipButton = static_cast<FlipButtons ^>(sender);
|
||||
Model->ButtonPressed->Execute(flipButton->ButtonId);
|
||||
}
|
||||
}
|
||||
@@ -181,17 +182,15 @@ void CalculatorProgrammerBitFlipPanel::UpdateCheckedStates()
|
||||
assert(!m_updatingCheckedStates);
|
||||
assert(m_flipButtons.size() == s_numBits);
|
||||
|
||||
if (Model == nullptr) { return; }
|
||||
if (Model == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static const wchar_t ch0 = LocalizationSettings::GetInstance().GetDigitSymbolFromEnUsDigit(L'0');
|
||||
|
||||
// Filter any unwanted characters from the displayed string.
|
||||
static constexpr array<wchar_t, 4> unwantedChars = {
|
||||
L' ',
|
||||
Utils::LRE,
|
||||
Utils::PDF,
|
||||
Utils::LRO
|
||||
};
|
||||
static constexpr array<wchar_t, 4> unwantedChars = { L' ', Utils::LRE, Utils::PDF, Utils::LRO };
|
||||
|
||||
wstringstream stream;
|
||||
wstring displayValue = Model->BinaryDisplayValue->Data();
|
||||
|
||||
@@ -17,36 +17,35 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorProgrammerBitFlipPanel sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorProgrammerBitFlipPanel sealed
|
||||
{
|
||||
public:
|
||||
CalculatorProgrammerBitFlipPanel();
|
||||
|
||||
property CalculatorApp::ViewModel::StandardCalculatorViewModel^ Model
|
||||
{
|
||||
CalculatorApp::ViewModel::StandardCalculatorViewModel^ get();
|
||||
}
|
||||
property CalculatorApp::ViewModel::StandardCalculatorViewModel
|
||||
^ Model { CalculatorApp::ViewModel::StandardCalculatorViewModel ^ get(); }
|
||||
|
||||
private:
|
||||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
private : void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnUnloaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
void SubscribePropertyChanged();
|
||||
void UnsubscribePropertyChanged();
|
||||
void OnPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e);
|
||||
void OnPropertyChanged(Platform::Object ^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
|
||||
void AssignFlipButtons();
|
||||
|
||||
void SetVisibilityBinding(_In_ Windows::UI::Xaml::FrameworkElement^ element, _In_ Platform::String^ path, _In_ Windows::UI::Xaml::Data::IValueConverter^ converter);
|
||||
void OnBitToggled(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void SetVisibilityBinding(
|
||||
_In_ Windows::UI::Xaml::FrameworkElement ^ element,
|
||||
_In_ Platform::String ^ path,
|
||||
_In_ Windows::UI::Xaml::Data::IValueConverter ^ converter);
|
||||
void OnBitToggled(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void UpdateCheckedStates();
|
||||
|
||||
private:
|
||||
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||
|
||||
static const unsigned int s_numBits = 64;
|
||||
std::array<CalculatorApp::Controls::FlipButtons^, s_numBits> m_flipButtons;
|
||||
std::array<CalculatorApp::Controls::FlipButtons ^, s_numBits> m_flipButtons;
|
||||
bool m_updatingCheckedStates;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
<VisualState x:Name="NoErrorLayout"/>
|
||||
<VisualState x:Name="ErrorLayout">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="qwordButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="dwordButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="wordButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="byteButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="QwordButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DwordButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="WordButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="ByteButton.IsEnabled" Value="False"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -59,13 +59,13 @@
|
||||
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<RadioButton x:Name="fullKeypad"
|
||||
<RadioButton x:Name="FullKeypad"
|
||||
x:Uid="fullKeypad"
|
||||
Style="{StaticResource ProgKeypadRadioButtonStyle}"
|
||||
AutomationProperties.AutomationId="fullKeypad"
|
||||
Content=""
|
||||
IsChecked="{x:Bind Model.IsBitFlipChecked, Converter={StaticResource BooleanNegationConverter}, Mode=TwoWay}"/>
|
||||
<RadioButton x:Name="bitFlip"
|
||||
<RadioButton x:Name="BitFlip"
|
||||
x:Uid="bitFlip"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource ProgKeypadRadioButtonStyle}"
|
||||
@@ -75,7 +75,7 @@
|
||||
IsChecked="{x:Bind Model.IsBitFlipChecked, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
|
||||
<Button x:Name="qwordButton"
|
||||
<Button x:Name="QwordButton"
|
||||
x:Uid="qwordButton"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="7"
|
||||
@@ -84,7 +84,7 @@
|
||||
Command="{x:Bind BitLengthButtonPressed, Mode=OneTime}"
|
||||
CommandParameter="0"
|
||||
Content="QWORD"/>
|
||||
<Button x:Name="dwordButton"
|
||||
<Button x:Name="DwordButton"
|
||||
x:Uid="dwordButton"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="7"
|
||||
@@ -94,7 +94,7 @@
|
||||
CommandParameter="1"
|
||||
Content="DWORD"
|
||||
Visibility="Collapsed"/>
|
||||
<Button x:Name="wordButton"
|
||||
<Button x:Name="WordButton"
|
||||
x:Uid="wordButton"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="7"
|
||||
@@ -104,7 +104,7 @@
|
||||
CommandParameter="2"
|
||||
Content="WORD"
|
||||
Visibility="Collapsed"/>
|
||||
<Button x:Name="byteButton"
|
||||
<Button x:Name="ByteButton"
|
||||
x:Uid="byteButton"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="7"
|
||||
|
||||
@@ -20,31 +20,31 @@ using namespace Windows::UI::Xaml::Navigation;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Core;
|
||||
|
||||
CalculatorProgrammerDisplayPanel::CalculatorProgrammerDisplayPanel() :
|
||||
m_isErrorVisualState(false)
|
||||
CalculatorProgrammerDisplayPanel::CalculatorProgrammerDisplayPanel()
|
||||
: m_isErrorVisualState(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void CalculatorProgrammerDisplayPanel::ShowBitFlip(Object^ sender, RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerDisplayPanel::ShowBitFlip(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogBitFlipPaneClicked();
|
||||
}
|
||||
|
||||
void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object^ parameter)
|
||||
void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object ^ parameter)
|
||||
{
|
||||
TraceLogger::GetInstance().LogBitLengthButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
String^ buttonId = parameter->ToString();
|
||||
String ^ buttonId = parameter->ToString();
|
||||
|
||||
qwordButton->Visibility = ::Visibility::Collapsed;
|
||||
dwordButton->Visibility = ::Visibility::Collapsed;
|
||||
wordButton->Visibility = ::Visibility::Collapsed;
|
||||
byteButton->Visibility = ::Visibility::Collapsed;
|
||||
QwordButton->Visibility = ::Visibility::Collapsed;
|
||||
DwordButton->Visibility = ::Visibility::Collapsed;
|
||||
WordButton->Visibility = ::Visibility::Collapsed;
|
||||
ByteButton->Visibility = ::Visibility::Collapsed;
|
||||
if (buttonId == "0")
|
||||
{
|
||||
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Dword);
|
||||
dwordButton->Visibility = ::Visibility::Visible;
|
||||
dwordButton->Focus(::FocusState::Programmatic);
|
||||
DwordButton->Visibility = ::Visibility::Visible;
|
||||
DwordButton->Focus(::FocusState::Programmatic);
|
||||
Model->IsQwordEnabled = false;
|
||||
Model->IsDwordEnabled = true;
|
||||
Model->IsWordEnabled = true;
|
||||
@@ -52,8 +52,8 @@ void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object^ paramete
|
||||
else if (buttonId == "1")
|
||||
{
|
||||
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Word);
|
||||
wordButton->Visibility = ::Visibility::Visible;
|
||||
wordButton->Focus(::FocusState::Programmatic);
|
||||
WordButton->Visibility = ::Visibility::Visible;
|
||||
WordButton->Focus(::FocusState::Programmatic);
|
||||
Model->IsQwordEnabled = false;
|
||||
Model->IsDwordEnabled = false;
|
||||
Model->IsWordEnabled = true;
|
||||
@@ -61,8 +61,8 @@ void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object^ paramete
|
||||
else if (buttonId == "2")
|
||||
{
|
||||
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Byte);
|
||||
byteButton->Visibility = ::Visibility::Visible;
|
||||
byteButton->Focus(::FocusState::Programmatic);
|
||||
ByteButton->Visibility = ::Visibility::Visible;
|
||||
ByteButton->Focus(::FocusState::Programmatic);
|
||||
Model->IsQwordEnabled = false;
|
||||
Model->IsDwordEnabled = false;
|
||||
Model->IsWordEnabled = false;
|
||||
@@ -70,8 +70,8 @@ void CalculatorProgrammerDisplayPanel::OnBitLengthButtonPressed(Object^ paramete
|
||||
else if (buttonId == "3")
|
||||
{
|
||||
Model->ButtonPressed->Execute(NumbersAndOperatorsEnum::Qword);
|
||||
qwordButton->Visibility = ::Visibility::Visible;
|
||||
qwordButton->Focus(::FocusState::Programmatic);
|
||||
QwordButton->Visibility = ::Visibility::Visible;
|
||||
QwordButton->Focus(::FocusState::Programmatic);
|
||||
Model->IsQwordEnabled = true;
|
||||
Model->IsDwordEnabled = true;
|
||||
Model->IsWordEnabled = true;
|
||||
@@ -90,7 +90,7 @@ void CalculatorProgrammerDisplayPanel::IsErrorVisualState::set(bool value)
|
||||
if (m_isErrorVisualState != value)
|
||||
{
|
||||
m_isErrorVisualState = value;
|
||||
String^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorProgrammerDisplayPanel sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorProgrammerDisplayPanel sealed
|
||||
{
|
||||
public:
|
||||
CalculatorProgrammerDisplayPanel();
|
||||
@@ -23,14 +22,15 @@ namespace CalculatorApp
|
||||
}
|
||||
}
|
||||
|
||||
property bool IsErrorVisualState {
|
||||
property bool IsErrorVisualState
|
||||
{
|
||||
bool get();
|
||||
void set(bool value);
|
||||
}
|
||||
|
||||
private:
|
||||
void ShowBitFlip(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnBitLengthButtonPressed(Platform::Object^ parameter);
|
||||
void ShowBitFlip(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnBitLengthButtonPressed(Platform::Object ^ parameter);
|
||||
|
||||
bool m_isErrorVisualState;
|
||||
};
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
<RowDefinition Height="1*" MinHeight="0"/>
|
||||
<RowDefinition Height="1*" MinHeight="0"/>
|
||||
<RowDefinition Height="1*" MinHeight="0"/>
|
||||
<RowDefinition Height="1*" MinHeight="{Binding ActualHeight, ElementName=binaryButton, FallbackValue=16, Mode=OneWay}"/>
|
||||
<RowDefinition Height="1*" MinHeight="{Binding ActualHeight, ElementName=BinaryButton, FallbackValue=16, Mode=OneWay}"/>
|
||||
<RowDefinition Height="4"/>
|
||||
</Grid.RowDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
@@ -192,7 +192,7 @@
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<controls:RadixButton x:Name="hexButton"
|
||||
<controls:RadixButton x:Name="HexButton"
|
||||
x:Uid="hexButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{ThemeResource ProgModeRadioButtonStyle}"
|
||||
@@ -202,7 +202,7 @@
|
||||
Content="{x:Bind Model.HexDisplayValue, Mode=OneWay}"
|
||||
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
|
||||
GroupName="BaseConversion"/>
|
||||
<controls:RadixButton x:Name="decimalButton"
|
||||
<controls:RadixButton x:Name="DecimalButton"
|
||||
x:Uid="decimalButton"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -214,7 +214,7 @@
|
||||
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
|
||||
GroupName="BaseConversion"
|
||||
IsChecked="true"/>
|
||||
<controls:RadixButton x:Name="octButton"
|
||||
<controls:RadixButton x:Name="OctButton"
|
||||
x:Uid="octButton"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -225,7 +225,7 @@
|
||||
Content="{x:Bind Model.OctalDisplayValue, Mode=OneWay}"
|
||||
ContextFlyout="{StaticResource ProgrammerOperatorsContextMenu}"
|
||||
GroupName="BaseConversion"/>
|
||||
<controls:RadixButton x:Name="binaryButton"
|
||||
<controls:RadixButton x:Name="BinaryButton"
|
||||
x:Uid="binaryButton"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
|
||||
@@ -36,7 +36,7 @@ CalculatorProgrammerOperators::CalculatorProgrammerOperators()
|
||||
CopyMenuItem->Text = AppResourceProvider::GetInstance().GetResourceString(L"copyMenuItem");
|
||||
}
|
||||
|
||||
void CalculatorProgrammerOperators::HexButtonChecked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerOperators::HexButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
if (Model)
|
||||
@@ -45,7 +45,7 @@ void CalculatorProgrammerOperators::HexButtonChecked(_In_ Object^ sender, _In_ R
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerOperators::DecButtonChecked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerOperators::DecButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
if (Model)
|
||||
@@ -54,7 +54,7 @@ void CalculatorProgrammerOperators::DecButtonChecked(_In_ Object^ sender, _In_ R
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerOperators::OctButtonChecked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerOperators::OctButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
if (Model)
|
||||
@@ -63,7 +63,7 @@ void CalculatorProgrammerOperators::OctButtonChecked(_In_ Object^ sender, _In_ R
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerOperators::BinButtonChecked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerOperators::BinButtonChecked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogRadixButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
if (Model)
|
||||
@@ -78,22 +78,22 @@ void CalculatorProgrammerOperators::SetRadixButton(RADIX_TYPE radixType)
|
||||
{
|
||||
case RADIX_TYPE::DEC_RADIX:
|
||||
{
|
||||
decimalButton->IsChecked = true;
|
||||
DecimalButton->IsChecked = true;
|
||||
break;
|
||||
}
|
||||
case RADIX_TYPE::HEX_RADIX:
|
||||
{
|
||||
hexButton->IsChecked = true;
|
||||
HexButton->IsChecked = true;
|
||||
break;
|
||||
}
|
||||
case RADIX_TYPE::OCT_RADIX:
|
||||
{
|
||||
octButton->IsChecked = true;
|
||||
OctButton->IsChecked = true;
|
||||
break;
|
||||
}
|
||||
case RADIX_TYPE::BIN_RADIX:
|
||||
{
|
||||
binaryButton->IsChecked = true;
|
||||
BinaryButton->IsChecked = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -101,9 +101,9 @@ void CalculatorProgrammerOperators::SetRadixButton(RADIX_TYPE radixType)
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerOperators::OnCopyMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerOperators::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
auto source = safe_cast<RadixButton^>(ProgrammerOperatorsContextMenu->Target);
|
||||
auto source = safe_cast<RadixButton ^>(ProgrammerOperatorsContextMenu->Target);
|
||||
|
||||
CopyPasteManager::CopyToClipboard(source->GetRawDisplayValue());
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorProgrammerOperators sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorProgrammerOperators sealed
|
||||
{
|
||||
public:
|
||||
CalculatorProgrammerOperators();
|
||||
@@ -23,16 +22,15 @@ namespace CalculatorApp
|
||||
|
||||
DEPENDENCY_PROPERTY_OWNER(CalculatorProgrammerOperators);
|
||||
|
||||
DEPENDENCY_PROPERTY(_In_ Windows::UI::Xaml::Style^, SymbolButtonStyle);
|
||||
DEPENDENCY_PROPERTY(_In_ Windows::UI::Xaml::Style ^, SymbolButtonStyle);
|
||||
|
||||
internal:
|
||||
void SetRadixButton(RADIX_TYPE radixType);
|
||||
internal : void SetRadixButton(RADIX_TYPE radixType);
|
||||
|
||||
private:
|
||||
void DecButtonChecked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void HexButtonChecked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void BinButtonChecked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OctButtonChecked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void DecButtonChecked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void HexButtonChecked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void BinButtonChecked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OctButtonChecked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,26 +38,26 @@
|
||||
<VisualState x:Name="NoErrorLayout"/>
|
||||
<VisualState x:Name="ErrorLayout">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="rolButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="rorButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="lshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="rshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="orButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="xorButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="notButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="andButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="RolButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="RorButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="LshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="RshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="OrButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="XorButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="NotButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="AndButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="shiftButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="modButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="ShiftButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="ModButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="divideButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="multiplyButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="minusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="plusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DivideButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MultiplyButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MinusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PlusButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="openParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="closeParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="negateButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="OpenParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="CloseParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="NegateButton.IsEnabled" Value="False"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -67,21 +67,21 @@
|
||||
<AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="aButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="bButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="cButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="dButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="eButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="fButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="AButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="BButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="CButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="DButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="EButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
<Setter Target="FButton.FontSize" Value="{StaticResource TitleFontSize}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle24}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -104,20 +104,20 @@
|
||||
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="openParenthesisButton.FontSize" Value="12"/>
|
||||
<Setter Target="openParenthesisButton.Padding" Value="0"/>
|
||||
<Setter Target="closeParenthesisButton.FontSize" Value="12"/>
|
||||
<Setter Target="closeParenthesisButton.Padding" Value="0"/>
|
||||
<Setter Target="OpenParenthesisButton.FontSize" Value="12"/>
|
||||
<Setter Target="OpenParenthesisButton.Padding" Value="0"/>
|
||||
<Setter Target="CloseParenthesisButton.FontSize" Value="12"/>
|
||||
<Setter Target="CloseParenthesisButton.Padding" Value="0"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="aButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="bButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="cButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="dButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="eButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="fButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="AButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="BButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="CButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="DButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="EButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
<Setter Target="FButton.Style" Value="{StaticResource NumericButtonStyle12}"/>
|
||||
|
||||
<Setter Target="shiftButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
<Setter Target="ShiftButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -135,7 +135,7 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="rolButton"
|
||||
<controls:CalculatorButton x:Name="RolButton"
|
||||
x:Uid="rolButton"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -145,7 +145,7 @@
|
||||
ButtonId="Rol"
|
||||
Content="RoL"
|
||||
Visibility="Collapsed"/>
|
||||
<controls:CalculatorButton x:Name="rorButton"
|
||||
<controls:CalculatorButton x:Name="RorButton"
|
||||
x:Uid="rorButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -155,7 +155,7 @@
|
||||
ButtonId="Ror"
|
||||
Content="RoR"
|
||||
Visibility="Collapsed"/>
|
||||
<controls:CalculatorButton x:Name="lshButton"
|
||||
<controls:CalculatorButton x:Name="LshButton"
|
||||
x:Uid="lshButton"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -163,7 +163,7 @@
|
||||
AutomationProperties.AutomationId="lshButton"
|
||||
ButtonId="Lsh"
|
||||
Content="Lsh"/>
|
||||
<controls:CalculatorButton x:Name="rshButton"
|
||||
<controls:CalculatorButton x:Name="RshButton"
|
||||
x:Uid="rshButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -171,7 +171,7 @@
|
||||
AutomationProperties.AutomationId="rshButton"
|
||||
ButtonId="Rsh"
|
||||
Content="Rsh"/>
|
||||
<controls:CalculatorButton x:Name="orButton"
|
||||
<controls:CalculatorButton x:Name="OrButton"
|
||||
x:Uid="orButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -179,7 +179,7 @@
|
||||
AutomationProperties.AutomationId="orButton"
|
||||
ButtonId="Or"
|
||||
Content="Or"/>
|
||||
<controls:CalculatorButton x:Name="xorButton"
|
||||
<controls:CalculatorButton x:Name="XorButton"
|
||||
x:Uid="xorButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -187,7 +187,7 @@
|
||||
AutomationProperties.AutomationId="xorButton"
|
||||
ButtonId="Xor"
|
||||
Content="Xor"/>
|
||||
<controls:CalculatorButton x:Name="notButton"
|
||||
<controls:CalculatorButton x:Name="NotButton"
|
||||
x:Uid="notButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -195,7 +195,7 @@
|
||||
AutomationProperties.AutomationId="notButton"
|
||||
ButtonId="Not"
|
||||
Content="Not"/>
|
||||
<controls:CalculatorButton x:Name="andButton"
|
||||
<controls:CalculatorButton x:Name="AndButton"
|
||||
x:Uid="andButton"
|
||||
Grid.Column="5"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -205,7 +205,7 @@
|
||||
Content="And"/>
|
||||
</Grid>
|
||||
|
||||
<ToggleButton x:Name="shiftButton"
|
||||
<ToggleButton x:Name="ShiftButton"
|
||||
x:Uid="shiftButton"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
@@ -218,7 +218,7 @@
|
||||
Checked="Shift_Clicked"
|
||||
Content=""
|
||||
Unchecked="Shift_Clicked"/>
|
||||
<controls:CalculatorButton x:Name="modButton"
|
||||
<controls:CalculatorButton x:Name="ModButton"
|
||||
x:Uid="modButton"
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
@@ -240,7 +240,7 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<controls:CalculatorButton x:Name="divideButton"
|
||||
<controls:CalculatorButton x:Name="DivideButton"
|
||||
x:Uid="divideButton"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -248,7 +248,7 @@
|
||||
AutomationProperties.AutomationId="divideButton"
|
||||
ButtonId="Divide"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="multiplyButton"
|
||||
<controls:CalculatorButton x:Name="MultiplyButton"
|
||||
x:Uid="multiplyButton"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -256,7 +256,7 @@
|
||||
AutomationProperties.AutomationId="multiplyButton"
|
||||
ButtonId="Multiply"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="minusButton"
|
||||
<controls:CalculatorButton x:Name="MinusButton"
|
||||
x:Uid="minusButton"
|
||||
Grid.Row="2"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -264,7 +264,7 @@
|
||||
AutomationProperties.AutomationId="minusButton"
|
||||
ButtonId="Subtract"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="plusButton"
|
||||
<controls:CalculatorButton x:Name="PlusButton"
|
||||
x:Uid="plusButton"
|
||||
Grid.Row="3"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -272,7 +272,7 @@
|
||||
AutomationProperties.AutomationId="plusButton"
|
||||
ButtonId="Add"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="equalButton"
|
||||
<controls:CalculatorButton x:Name="EqualButton"
|
||||
x:Uid="equalButton"
|
||||
Grid.Row="4"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -292,7 +292,7 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="clearEntryButton"
|
||||
<controls:CalculatorButton x:Name="ClearEntryButton"
|
||||
x:Uid="clearEntryButton"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -301,7 +301,7 @@
|
||||
AutomationProperties.AutomationId="clearEntryButton"
|
||||
ButtonId="ClearEntry"
|
||||
Content="CE"/>
|
||||
<controls:CalculatorButton x:Name="clearButton"
|
||||
<controls:CalculatorButton x:Name="ClearButton"
|
||||
x:Uid="clearButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -310,7 +310,7 @@
|
||||
AutomationProperties.AutomationId="clearButton"
|
||||
ButtonId="Clear"
|
||||
Content="C"/>
|
||||
<controls:CalculatorButton x:Name="backSpaceButton"
|
||||
<controls:CalculatorButton x:Name="BackSpaceButton"
|
||||
x:Uid="backSpaceButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -346,7 +346,7 @@
|
||||
Grid.ColumnSpan="3"
|
||||
ButtonStyle="{StaticResource NumericButtonStyle18}"/>
|
||||
|
||||
<controls:CalculatorButton x:Name="aButton"
|
||||
<controls:CalculatorButton x:Name="AButton"
|
||||
x:Uid="aButton"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
@@ -355,7 +355,7 @@
|
||||
ButtonId="A"
|
||||
Content="A"
|
||||
IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="bButton"
|
||||
<controls:CalculatorButton x:Name="BButton"
|
||||
x:Uid="bButton"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
@@ -364,7 +364,7 @@
|
||||
ButtonId="B"
|
||||
Content="B"
|
||||
IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="cButton"
|
||||
<controls:CalculatorButton x:Name="CButton"
|
||||
x:Uid="cButton"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
@@ -373,7 +373,7 @@
|
||||
ButtonId="C"
|
||||
Content="C"
|
||||
IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="dButton"
|
||||
<controls:CalculatorButton x:Name="DButton"
|
||||
x:Uid="dButton"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
@@ -382,7 +382,7 @@
|
||||
ButtonId="D"
|
||||
Content="D"
|
||||
IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="eButton"
|
||||
<controls:CalculatorButton x:Name="EButton"
|
||||
x:Uid="eButton"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
@@ -391,7 +391,7 @@
|
||||
ButtonId="E"
|
||||
Content="E"
|
||||
IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="fButton"
|
||||
<controls:CalculatorButton x:Name="FButton"
|
||||
x:Uid="fButton"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
@@ -402,18 +402,18 @@
|
||||
IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
|
||||
<controls:CalculatorButton x:Name="openParenthesisButton"
|
||||
<controls:CalculatorButton x:Name="OpenParenthesisButton"
|
||||
x:Uid="openParenthesisButton"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource ParenthesisCalcButtonStyle}"
|
||||
FontSize="18"
|
||||
AutomationProperties.AutomationId="openParenthesisButton"
|
||||
AutomationProperties.Name="{Binding LeftParenthesisAutomationName}"
|
||||
ButtonId="OpenParenthesis"
|
||||
Content="("
|
||||
Tag="{x:Bind Model.OpenParenthesisCount, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="closeParenthesisButton"
|
||||
GotFocus="OpenParenthesisButton_GotFocus"
|
||||
Tag="{x:Bind ParenthesisCountToString(Model.OpenParenthesisCount), Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="CloseParenthesisButton"
|
||||
x:Uid="closeParenthesisButton"
|
||||
Grid.Row="5"
|
||||
Grid.Column="2"
|
||||
@@ -422,7 +422,7 @@
|
||||
AutomationProperties.AutomationId="closeParenthesisButton"
|
||||
ButtonId="CloseParenthesis"
|
||||
Content=")"/>
|
||||
<controls:CalculatorButton x:Name="negateButton"
|
||||
<controls:CalculatorButton x:Name="NegateButton"
|
||||
x:Uid="negateButton"
|
||||
Grid.Row="5"
|
||||
Grid.Column="3"
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "Converters/BooleanToVisibilityConverter.h"
|
||||
#include "Views/NumberPad.xaml.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace CalculatorApp;
|
||||
|
||||
using namespace CalculatorApp::ViewModel;
|
||||
using namespace Platform;
|
||||
using namespace Windows::UI::Xaml;
|
||||
@@ -23,8 +23,8 @@ using namespace Windows::UI::Xaml::Data;
|
||||
using namespace CalculatorApp::Common;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
|
||||
CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() :
|
||||
m_isErrorVisualState(false)
|
||||
CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators()
|
||||
: m_isErrorVisualState(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -32,48 +32,47 @@ CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() :
|
||||
SetVisibilityBinding(ProgRadixOps, L"IsBinaryBitFlippingEnabled", booleanToVisibilityNegationConverter);
|
||||
}
|
||||
|
||||
void CalculatorProgrammerRadixOperators::OnLoaded(Object^, RoutedEventArgs^)
|
||||
void CalculatorProgrammerRadixOperators::OnLoaded(Object ^, RoutedEventArgs ^)
|
||||
{
|
||||
m_progModeRadixChangeToken = Model->ProgModeRadixChange += ref new ProgModeRadixChangeHandler(this, &CalculatorProgrammerRadixOperators::ProgModeRadixChange);
|
||||
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged);
|
||||
m_progModeRadixChangeToken = Model->ProgModeRadixChange +=
|
||||
ref new ProgModeRadixChangeHandler(this, &CalculatorProgrammerRadixOperators::ProgModeRadixChange);
|
||||
}
|
||||
void CalculatorProgrammerRadixOperators::OnUnloaded(Object^, RoutedEventArgs^)
|
||||
void CalculatorProgrammerRadixOperators::OnUnloaded(Object ^, RoutedEventArgs ^)
|
||||
{
|
||||
Model->ProgModeRadixChange -= m_progModeRadixChangeToken;
|
||||
Model->PropertyChanged -= m_propertyChangedToken;
|
||||
}
|
||||
|
||||
void CalculatorProgrammerRadixOperators::Shift_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
void CalculatorProgrammerRadixOperators::Shift_Clicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||
{
|
||||
bool isShiftChecked = static_cast<ToggleButton^>(sender)->IsChecked->Value;
|
||||
auto scvm = safe_cast<StandardCalculatorViewModel^>(this->DataContext);
|
||||
bool isShiftChecked = static_cast<ToggleButton ^>(sender)->IsChecked->Value;
|
||||
auto scvm = safe_cast<StandardCalculatorViewModel ^>(this->DataContext);
|
||||
scvm->IsShiftProgrammerChecked = isShiftChecked;
|
||||
|
||||
if (rolButton == nullptr)
|
||||
if (RolButton == nullptr)
|
||||
{
|
||||
FindName("rolButton");
|
||||
FindName("rorButton");
|
||||
FindName("RolButton");
|
||||
FindName("RorButton");
|
||||
}
|
||||
|
||||
if (isShiftChecked)
|
||||
{
|
||||
rolButton->Visibility = ::Visibility::Visible;
|
||||
rorButton->Visibility = ::Visibility::Visible;
|
||||
lshButton->Visibility = ::Visibility::Collapsed;
|
||||
rshButton->Visibility = ::Visibility::Collapsed;
|
||||
RolButton->Visibility = ::Visibility::Visible;
|
||||
RorButton->Visibility = ::Visibility::Visible;
|
||||
LshButton->Visibility = ::Visibility::Collapsed;
|
||||
RshButton->Visibility = ::Visibility::Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
rolButton->Visibility = ::Visibility::Collapsed;
|
||||
rorButton->Visibility = ::Visibility::Collapsed;
|
||||
lshButton->Visibility = ::Visibility::Visible;
|
||||
rshButton->Visibility = ::Visibility::Visible;
|
||||
RolButton->Visibility = ::Visibility::Collapsed;
|
||||
RorButton->Visibility = ::Visibility::Collapsed;
|
||||
LshButton->Visibility = ::Visibility::Visible;
|
||||
RshButton->Visibility = ::Visibility::Visible;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerRadixOperators::SetVisibilityBinding(FrameworkElement^ element, String^ path, IValueConverter^ converter)
|
||||
void CalculatorProgrammerRadixOperators::SetVisibilityBinding(FrameworkElement ^ element, String ^ path, IValueConverter ^ converter)
|
||||
{
|
||||
Binding^ commandBinding = ref new Binding();
|
||||
Binding ^ commandBinding = ref new Binding();
|
||||
commandBinding->Path = ref new PropertyPath(path);
|
||||
commandBinding->Converter = converter;
|
||||
element->SetBinding(VisibilityProperty, commandBinding);
|
||||
@@ -94,16 +93,18 @@ void CalculatorProgrammerRadixOperators::IsErrorVisualState::set(bool value)
|
||||
if (m_isErrorVisualState != value)
|
||||
{
|
||||
m_isErrorVisualState = value;
|
||||
String^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
NumberPad->IsErrorVisualState = m_isErrorVisualState;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||
String ^ CalculatorProgrammerRadixOperators::ParenthesisCountToString(unsigned int count)
|
||||
{
|
||||
if (e->PropertyName == StandardCalculatorViewModel::OpenParenthesisCountPropertyName && closeParenthesisButton->FocusState != ::FocusState::Unfocused)
|
||||
{
|
||||
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
return (count == 0) ? ref new String() : ref new String(to_wstring(count).data());
|
||||
}
|
||||
|
||||
void CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators::OpenParenthesisButton_GotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorProgrammerRadixOperators sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorProgrammerRadixOperators sealed
|
||||
{
|
||||
public:
|
||||
CalculatorProgrammerRadixOperators();
|
||||
@@ -22,23 +21,24 @@ namespace CalculatorApp
|
||||
}
|
||||
}
|
||||
|
||||
property bool IsErrorVisualState {
|
||||
property bool IsErrorVisualState
|
||||
{
|
||||
bool get();
|
||||
void set(bool value);
|
||||
}
|
||||
Platform::String ^ ParenthesisCountToString(unsigned int count);
|
||||
|
||||
DEPENDENCY_PROPERTY_OWNER(CalculatorProgrammerRadixOperators);
|
||||
|
||||
private:
|
||||
void Shift_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void SetVisibilityBinding(Windows::UI::Xaml::FrameworkElement^ element, Platform::String^ path, Windows::UI::Xaml::Data::IValueConverter^ converter);
|
||||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void Shift_Clicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void SetVisibilityBinding(Windows::UI::Xaml::FrameworkElement ^ element, Platform::String ^ path, Windows::UI::Xaml::Data::IValueConverter ^ converter);
|
||||
void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnUnloaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void ProgModeRadixChange();
|
||||
void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
|
||||
bool m_isErrorVisualState;
|
||||
Windows::Foundation::EventRegistrationToken m_progModeRadixChangeToken;
|
||||
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||
void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,12 +44,12 @@
|
||||
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="degreeButton.Style" Value="{StaticResource CaptionButtonSmallStyle}"/>
|
||||
<Setter Target="radianButton.Style" Value="{StaticResource CaptionButtonSmallStyle}"/>
|
||||
<Setter Target="gradsButton.Style" Value="{StaticResource CaptionButtonSmallStyle}"/>
|
||||
<Setter Target="DegreeButton.Style" Value="{StaticResource CaptionButtonSmallStyle}"/>
|
||||
<Setter Target="RadianButton.Style" Value="{StaticResource CaptionButtonSmallStyle}"/>
|
||||
<Setter Target="GradsButton.Style" Value="{StaticResource CaptionButtonSmallStyle}"/>
|
||||
|
||||
<Setter Target="hyperbolicButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
<Setter Target="ftoeButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
<Setter Target="HyperbolicButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
<Setter Target="FtoeButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -57,23 +57,23 @@
|
||||
<VisualState x:Name="NoErrorLayout"/>
|
||||
<VisualState x:Name="ErrorLayout">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="degreeButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="radianButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="gradsButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="hyperbolicButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="ftoeButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DegreeButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="RadianButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="GradsButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="HyperbolicButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="FtoeButton.IsEnabled" Value="False"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Button x:Name="degreeButton"
|
||||
<Button x:Name="DegreeButton"
|
||||
x:Uid="degButton"
|
||||
Style="{StaticResource CaptionButtonStyle}"
|
||||
AutomationProperties.AutomationId="degButton"
|
||||
Command="{x:Bind ButtonPressed}"
|
||||
CommandParameter="0"
|
||||
Content="DEG"/>
|
||||
<Button x:Name="radianButton"
|
||||
<Button x:Name="RadianButton"
|
||||
x:Uid="radButton"
|
||||
Style="{StaticResource CaptionButtonStyle}"
|
||||
AutomationProperties.AutomationId="radButton"
|
||||
@@ -81,7 +81,7 @@
|
||||
CommandParameter="1"
|
||||
Content="RAD"
|
||||
Visibility="Collapsed"/>
|
||||
<Button x:Name="gradsButton"
|
||||
<Button x:Name="GradsButton"
|
||||
x:Uid="gradButton"
|
||||
Style="{StaticResource CaptionButtonStyle}"
|
||||
AutomationProperties.AutomationId="gradButton"
|
||||
@@ -89,7 +89,7 @@
|
||||
CommandParameter="2"
|
||||
Content="GRAD"
|
||||
Visibility="Collapsed"/>
|
||||
<ToggleButton x:Name="hyperbolicButton"
|
||||
<ToggleButton x:Name="HyperbolicButton"
|
||||
x:Uid="hyperbolicButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource CaptionToggleButtonStyle}"
|
||||
@@ -100,7 +100,7 @@
|
||||
Content="HYP"
|
||||
IsChecked="{Binding IsHyperbolicChecked, Mode=TwoWay}"
|
||||
Unchecked="HypButton_Toggled"/>
|
||||
<ToggleButton x:Name="ftoeButton"
|
||||
<ToggleButton x:Name="FtoeButton"
|
||||
x:Uid="ftoeButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource CaptionToggleButtonStyle}"
|
||||
|
||||
@@ -29,49 +29,49 @@ using namespace Windows::UI::Core;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
CalculatorScientificAngleButtons::CalculatorScientificAngleButtons() :
|
||||
m_isErrorVisualState(false)
|
||||
CalculatorScientificAngleButtons::CalculatorScientificAngleButtons()
|
||||
: m_isErrorVisualState(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void CalculatorScientificAngleButtons::HypButton_Toggled(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void CalculatorScientificAngleButtons::HypButton_Toggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
TraceLogger::GetInstance().LogHypButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
}
|
||||
|
||||
void CalculatorScientificAngleButtons::FToEButton_Toggled(_In_ Object^ sender,_In_ RoutedEventArgs^ e)
|
||||
void CalculatorScientificAngleButtons::FToEButton_Toggled(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
auto viewModel = safe_cast<StandardCalculatorViewModel^>(this->DataContext);
|
||||
auto viewModel = safe_cast<StandardCalculatorViewModel ^>(this->DataContext);
|
||||
viewModel->FtoEButtonToggled();
|
||||
}
|
||||
|
||||
void CalculatorApp::CalculatorScientificAngleButtons::OnAngleButtonPressed(_In_ Object^ commandParameter)
|
||||
void CalculatorApp::CalculatorScientificAngleButtons::OnAngleButtonPressed(_In_ Object ^ commandParameter)
|
||||
{
|
||||
TraceLogger::GetInstance().LogAngleButtonUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
String^ buttonId = static_cast<String^>(commandParameter);
|
||||
String ^ buttonId = static_cast<String ^>(commandParameter);
|
||||
|
||||
degreeButton->Visibility = ::Visibility::Collapsed;
|
||||
radianButton->Visibility = ::Visibility::Collapsed;
|
||||
gradsButton->Visibility = ::Visibility::Collapsed;
|
||||
DegreeButton->Visibility = ::Visibility::Collapsed;
|
||||
RadianButton->Visibility = ::Visibility::Collapsed;
|
||||
GradsButton->Visibility = ::Visibility::Collapsed;
|
||||
|
||||
if (buttonId == L"0")
|
||||
{
|
||||
Model->SwitchAngleType(NumbersAndOperatorsEnum::Radians);
|
||||
radianButton->Visibility = ::Visibility::Visible;
|
||||
radianButton->Focus(::FocusState::Programmatic);
|
||||
RadianButton->Visibility = ::Visibility::Visible;
|
||||
RadianButton->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
else if (buttonId == L"1")
|
||||
{
|
||||
Model->SwitchAngleType(NumbersAndOperatorsEnum::Grads);
|
||||
gradsButton->Visibility = ::Visibility::Visible;
|
||||
gradsButton->Focus(::FocusState::Programmatic);
|
||||
GradsButton->Visibility = ::Visibility::Visible;
|
||||
GradsButton->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
else if (buttonId == L"2")
|
||||
{
|
||||
Model->SwitchAngleType(NumbersAndOperatorsEnum::Degree);
|
||||
degreeButton->Visibility = ::Visibility::Visible;
|
||||
degreeButton->Focus(::FocusState::Programmatic);
|
||||
DegreeButton->Visibility = ::Visibility::Visible;
|
||||
DegreeButton->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void CalculatorScientificAngleButtons::IsErrorVisualState::set(bool value)
|
||||
if (m_isErrorVisualState != value)
|
||||
{
|
||||
m_isErrorVisualState = value;
|
||||
String^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorScientificAngleButtons sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorScientificAngleButtons sealed
|
||||
{
|
||||
public:
|
||||
CalculatorScientificAngleButtons();
|
||||
@@ -27,16 +26,17 @@ namespace CalculatorApp
|
||||
|
||||
COMMAND_FOR_METHOD(ButtonPressed, CalculatorScientificAngleButtons::OnAngleButtonPressed)
|
||||
|
||||
property bool IsErrorVisualState {
|
||||
property bool IsErrorVisualState
|
||||
{
|
||||
bool get();
|
||||
void set(bool value);
|
||||
}
|
||||
|
||||
private:
|
||||
void OnAngleButtonPressed(_In_ Platform::Object^ commandParameter);
|
||||
void FToEButton_Toggled(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void HypButton_Toggled(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnAngleButtonPressed(_In_ Platform::Object ^ commandParameter);
|
||||
void FToEButton_Toggled(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void HypButton_Toggled(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
bool m_isErrorVisualState;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
x:Name="ControlRoot"
|
||||
d:DesignHeight="400"
|
||||
d:DesignWidth="315"
|
||||
Loaded="OnLoaded"
|
||||
Unloaded="OnUnloaded"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
|
||||
@@ -50,48 +48,48 @@
|
||||
<VisualState x:Name="NoErrorLayout"/>
|
||||
<VisualState x:Name="ErrorLayout">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="xpower2Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="powerButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="sinButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="cosButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="tanButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="sinhButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="coshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="tanhButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="XPower2Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="PowerButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="SinButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="CosButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="TanButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="SinhButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="CoshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="TanhButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="xpower3Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="ySquareRootButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="invsinButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="invcosButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="invtanButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="invsinhButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="invcoshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="invtanhButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="XPower3Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="YSquareRootButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvsinButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvcosButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvtanButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvsinhButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvcoshButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvtanhButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="squareRootButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="powerOf10Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="logBase10Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="expButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="modButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="SquareRootButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PowerOf10Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="LogBase10Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="ExpButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="ModButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="invertButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="powerOfEButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="logBaseEButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="dmsButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="degreesButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvertButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PowerOfEButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="LogBaseEButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DmsButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DegreesButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="shiftButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="ShiftButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="divideButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="multiplyButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="minusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="plusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DivideButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MultiplyButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MinusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PlusButton.IsEnabled" Value="False"/>
|
||||
|
||||
<Setter Target="piButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="factorialButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="negateButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="openParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="closeParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PiButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="FactorialButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="NegateButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="OpenParenthesisButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="CloseParenthesisButton.IsEnabled" Value="False"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -113,47 +111,47 @@
|
||||
<Setter Target="InvRow1.Visibility" Value="Visible"/>
|
||||
<Setter Target="InvRow2.Visibility" Value="Visible"/>
|
||||
|
||||
<Setter Target="negateButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="piButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="factorialButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="openParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="closeParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="sinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="cosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="tanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="sinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="coshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="tanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PiButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="FactorialButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="OpenParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="CloseParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="CosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="TanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="CoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="TanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="invsinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invcosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invtanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invsinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invcoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invtanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="powerButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="powerOf10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="logBase10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="expButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="modButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ySquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="powerOfEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="logBaseEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="dmsButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="degreesButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower3Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvsinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvcosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvtanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvsinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvcoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvtanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PowerButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PowerOf10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="LogBase10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ExpButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ModButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="YSquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PowerOfEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="LogBaseEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DmsButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DegreesButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower3Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{ThemeResource NumericButtonStyle34}"/>
|
||||
</VisualState.Setters>
|
||||
<Storyboard Completed="WideLayout_Completed"/>
|
||||
@@ -169,8 +167,8 @@
|
||||
<Setter Target="C1.Width" Value="1*"/>
|
||||
<Setter Target="C2.Width" Value="1*"/>
|
||||
<Setter Target="C3.Width" Value="1*"/>
|
||||
<Setter Target="shiftButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="shiftButton.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="ShiftButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="ShiftButton.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="ScientificFunctions.(Grid.Row)" Value="4"/>
|
||||
<Setter Target="ScientificFunctions.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="OpR2.Height" Value="1*"/>
|
||||
@@ -183,58 +181,58 @@
|
||||
<Setter Target="InvRow1.Visibility" Value="Visible"/>
|
||||
<Setter Target="InvRow2.Visibility" Value="Visible"/>
|
||||
|
||||
<Setter Target="negateButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="negateButton.(Grid.Column)" Value="6"/>
|
||||
<Setter Target="piButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="piButton.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="factorialButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="factorialButton.(Grid.Column)" Value="3"/>
|
||||
<Setter Target="openParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="openParenthesisButton.(Grid.Column)" Value="4"/>
|
||||
<Setter Target="closeParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="closeParenthesisButton.(Grid.Column)" Value="5"/>
|
||||
<Setter Target="NegateButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="NegateButton.(Grid.Column)" Value="6"/>
|
||||
<Setter Target="PiButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="PiButton.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="FactorialButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="FactorialButton.(Grid.Column)" Value="3"/>
|
||||
<Setter Target="OpenParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="OpenParenthesisButton.(Grid.Column)" Value="4"/>
|
||||
<Setter Target="CloseParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="CloseParenthesisButton.(Grid.Column)" Value="5"/>
|
||||
|
||||
<Setter Target="negateButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="piButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="factorialButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="openParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="closeParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="sinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="cosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="tanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="sinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="coshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="tanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PiButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="FactorialButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="OpenParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="CloseParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="CosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="TanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="CoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="TanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="invsinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invcosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invtanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invsinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invcoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invtanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="powerButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="powerOf10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="logBase10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="expButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="modButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ySquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="powerOfEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="logBaseEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="dmsButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="degreesButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower3Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvsinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvcosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvtanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvsinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvcoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvtanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PowerButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PowerOf10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="LogBase10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ExpButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ModButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="YSquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PowerOfEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="LogBaseEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DmsButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DegreesButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower3Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{ThemeResource NumericButtonStyle34}"/>
|
||||
</VisualState.Setters>
|
||||
<Storyboard Completed="WideLayout_Completed"/>
|
||||
@@ -250,8 +248,8 @@
|
||||
<Setter Target="C1.Width" Value="1*"/>
|
||||
<Setter Target="C2.Width" Value="1*"/>
|
||||
<Setter Target="C3.Width" Value="1*"/>
|
||||
<Setter Target="shiftButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="shiftButton.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="ShiftButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="ShiftButton.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="ScientificFunctions.(Grid.Row)" Value="4"/>
|
||||
<Setter Target="ScientificFunctions.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="OpR2.Height" Value="1*"/>
|
||||
@@ -264,16 +262,16 @@
|
||||
<Setter Target="InvRow1.Visibility" Value="Visible"/>
|
||||
<Setter Target="InvRow2.Visibility" Value="Visible"/>
|
||||
|
||||
<Setter Target="negateButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="negateButton.(Grid.Column)" Value="6"/>
|
||||
<Setter Target="piButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="piButton.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="factorialButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="factorialButton.(Grid.Column)" Value="3"/>
|
||||
<Setter Target="openParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="openParenthesisButton.(Grid.Column)" Value="4"/>
|
||||
<Setter Target="closeParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="closeParenthesisButton.(Grid.Column)" Value="5"/>
|
||||
<Setter Target="NegateButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="NegateButton.(Grid.Column)" Value="6"/>
|
||||
<Setter Target="PiButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="PiButton.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="FactorialButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="FactorialButton.(Grid.Column)" Value="3"/>
|
||||
<Setter Target="OpenParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="OpenParenthesisButton.(Grid.Column)" Value="4"/>
|
||||
<Setter Target="CloseParenthesisButton.(Grid.Row)" Value="8"/>
|
||||
<Setter Target="CloseParenthesisButton.(Grid.Column)" Value="5"/>
|
||||
</VisualState.Setters>
|
||||
<Storyboard Completed="WideLayout_Completed"/>
|
||||
</VisualState>
|
||||
@@ -332,7 +330,7 @@
|
||||
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="shiftButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
<Setter Target="ShiftButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
|
||||
</VisualState.Setters>
|
||||
<Storyboard Completed="ShortLayout_Completed"/>
|
||||
</VisualState>
|
||||
@@ -362,20 +360,20 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:CalculatorButton x:Name="xpower2Button"
|
||||
<controls:CalculatorButton x:Name="XPower2Button"
|
||||
x:Uid="xpower2Button"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="xpower2Button"
|
||||
ButtonId="XPower2"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="powerButton"
|
||||
<controls:CalculatorButton x:Name="PowerButton"
|
||||
x:Uid="powerButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="powerButton"
|
||||
ButtonId="XPowerY"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="sinButton"
|
||||
<controls:CalculatorButton x:Name="SinButton"
|
||||
x:Uid="sinButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -383,7 +381,7 @@
|
||||
ButtonId="Sin"
|
||||
Content="sin"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="cosButton"
|
||||
<controls:CalculatorButton x:Name="CosButton"
|
||||
x:Uid="cosButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -391,7 +389,7 @@
|
||||
ButtonId="Cos"
|
||||
Content="cos"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="tanButton"
|
||||
<controls:CalculatorButton x:Name="TanButton"
|
||||
x:Uid="tanButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -399,7 +397,7 @@
|
||||
ButtonId="Tan"
|
||||
Content="tan"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="sinhButton"
|
||||
<controls:CalculatorButton x:Name="SinhButton"
|
||||
x:Uid="sinhButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -407,7 +405,7 @@
|
||||
ButtonId="Sinh"
|
||||
Content="sinh"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="coshButton"
|
||||
<controls:CalculatorButton x:Name="CoshButton"
|
||||
x:Uid="coshButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -415,7 +413,7 @@
|
||||
ButtonId="Cosh"
|
||||
Content="cosh"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="tanhButton"
|
||||
<controls:CalculatorButton x:Name="TanhButton"
|
||||
x:Uid="tanhButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -435,20 +433,20 @@
|
||||
<ColumnDefinition x:Name="CX4" Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:CalculatorButton x:Name="xpower3Button"
|
||||
<controls:CalculatorButton x:Name="XPower3Button"
|
||||
x:Uid="xpower3Button"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="xpower3Button"
|
||||
ButtonId="Cube"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="ySquareRootButton"
|
||||
<controls:CalculatorButton x:Name="YSquareRootButton"
|
||||
x:Uid="ySquareRootButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="ySquareRootButton"
|
||||
ButtonId="YRootX"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="invsinButton"
|
||||
<controls:CalculatorButton x:Name="InvsinButton"
|
||||
x:Uid="invsinButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -456,7 +454,7 @@
|
||||
ButtonId="InvSin"
|
||||
Content="sin⁻¹"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="invcosButton"
|
||||
<controls:CalculatorButton x:Name="InvcosButton"
|
||||
x:Uid="invcosButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -464,7 +462,7 @@
|
||||
ButtonId="InvCos"
|
||||
Content="cos⁻¹"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="invtanButton"
|
||||
<controls:CalculatorButton x:Name="InvtanButton"
|
||||
x:Uid="invtanButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -472,7 +470,7 @@
|
||||
ButtonId="InvTan"
|
||||
Content="tan⁻¹"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="invsinhButton"
|
||||
<controls:CalculatorButton x:Name="InvsinhButton"
|
||||
x:Uid="invsinhButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -480,7 +478,7 @@
|
||||
ButtonId="InvSinh"
|
||||
Content="sinh⁻¹"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="invcoshButton"
|
||||
<controls:CalculatorButton x:Name="InvcoshButton"
|
||||
x:Uid="invcoshButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -488,7 +486,7 @@
|
||||
ButtonId="InvCosh"
|
||||
Content="cosh⁻¹"
|
||||
Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<controls:CalculatorButton x:Name="invtanhButton"
|
||||
<controls:CalculatorButton x:Name="InvtanhButton"
|
||||
x:Uid="invtanhButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -508,34 +506,34 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:CalculatorButton x:Name="squareRootButton"
|
||||
<controls:CalculatorButton x:Name="SquareRootButton"
|
||||
x:Uid="squareRootButton"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="squareRootButton"
|
||||
ButtonId="Sqrt"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="powerOf10Button"
|
||||
<controls:CalculatorButton x:Name="PowerOf10Button"
|
||||
x:Uid="powerOf10Button"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="powerOf10Button"
|
||||
ButtonId="TenPowerX"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="logBase10Button"
|
||||
<controls:CalculatorButton x:Name="LogBase10Button"
|
||||
x:Uid="logBase10Button"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="logBase10Button"
|
||||
ButtonId="LogBase10"
|
||||
Content="log"/>
|
||||
<controls:CalculatorButton x:Name="expButton"
|
||||
<controls:CalculatorButton x:Name="ExpButton"
|
||||
x:Uid="expButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="expButton"
|
||||
ButtonId="Exp"
|
||||
Content="Exp"/>
|
||||
<controls:CalculatorButton x:Name="modButton"
|
||||
<controls:CalculatorButton x:Name="ModButton"
|
||||
x:Uid="modButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -556,34 +554,34 @@
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<controls:CalculatorButton x:Name="invertButton"
|
||||
<controls:CalculatorButton x:Name="InvertButton"
|
||||
x:Uid="invertButton"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="invertButton"
|
||||
ButtonId="Invert"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="powerOfEButton"
|
||||
<controls:CalculatorButton x:Name="PowerOfEButton"
|
||||
x:Uid="powerOfEButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="powerOfEButton"
|
||||
ButtonId="EPowerX"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="logBaseEButton"
|
||||
<controls:CalculatorButton x:Name="LogBaseEButton"
|
||||
x:Uid="logBaseEButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="logBaseEButton"
|
||||
ButtonId="LogBaseE"
|
||||
Content="ln"/>
|
||||
<controls:CalculatorButton x:Name="dmsButton"
|
||||
<controls:CalculatorButton x:Name="DmsButton"
|
||||
x:Uid="dmsButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="dmsButton"
|
||||
ButtonId="DMS"
|
||||
Content="dms"/>
|
||||
<controls:CalculatorButton x:Name="degreesButton"
|
||||
<controls:CalculatorButton x:Name="DegreesButton"
|
||||
x:Uid="degreesButton"
|
||||
Grid.Column="4"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -593,7 +591,7 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<ToggleButton x:Name="shiftButton"
|
||||
<ToggleButton x:Name="ShiftButton"
|
||||
x:Uid="shiftButton"
|
||||
Grid.Row="4"
|
||||
Grid.Column="5"
|
||||
@@ -620,35 +618,35 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<controls:CalculatorButton x:Name="divideButton"
|
||||
<controls:CalculatorButton x:Name="DivideButton"
|
||||
x:Uid="divideButton"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="divideButton"
|
||||
ButtonId="Divide"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="multiplyButton"
|
||||
<controls:CalculatorButton x:Name="MultiplyButton"
|
||||
x:Uid="multiplyButton"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="multiplyButton"
|
||||
ButtonId="Multiply"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="minusButton"
|
||||
<controls:CalculatorButton x:Name="MinusButton"
|
||||
x:Uid="minusButton"
|
||||
Grid.Row="2"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="minusButton"
|
||||
ButtonId="Subtract"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="plusButton"
|
||||
<controls:CalculatorButton x:Name="PlusButton"
|
||||
x:Uid="plusButton"
|
||||
Grid.Row="3"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="plusButton"
|
||||
ButtonId="Add"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="equalButton"
|
||||
<controls:CalculatorButton x:Name="EqualButton"
|
||||
x:Uid="equalButton"
|
||||
Grid.Row="4"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -668,14 +666,14 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="clearEntryButton"
|
||||
<controls:CalculatorButton x:Name="ClearEntryButton"
|
||||
x:Uid="clearEntryButton"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
FontSize="16"
|
||||
AutomationProperties.AutomationId="clearEntryButton"
|
||||
ButtonId="ClearEntry"
|
||||
Content="CE"/>
|
||||
<controls:CalculatorButton x:Name="clearButton"
|
||||
<controls:CalculatorButton x:Name="ClearButton"
|
||||
x:Uid="clearButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -683,7 +681,7 @@
|
||||
AutomationProperties.AutomationId="clearButton"
|
||||
ButtonId="Clear"
|
||||
Content="C"/>
|
||||
<controls:CalculatorButton x:Name="backSpaceButton"
|
||||
<controls:CalculatorButton x:Name="BackSpaceButton"
|
||||
x:Uid="backSpaceButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -694,7 +692,7 @@
|
||||
Content=""/>
|
||||
</Grid>
|
||||
|
||||
<controls:CalculatorButton x:Name="piButton"
|
||||
<controls:CalculatorButton x:Name="PiButton"
|
||||
x:Uid="piButton"
|
||||
Grid.Row="5"
|
||||
Grid.Column="5"
|
||||
@@ -703,7 +701,7 @@
|
||||
AutomationProperties.AutomationId="piButton"
|
||||
ButtonId="Pi"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="factorialButton"
|
||||
<controls:CalculatorButton x:Name="FactorialButton"
|
||||
x:Uid="factorialButton"
|
||||
Grid.Row="6"
|
||||
Grid.Column="5"
|
||||
@@ -712,7 +710,7 @@
|
||||
AutomationProperties.AutomationId="factorialButton"
|
||||
ButtonId="Factorial"
|
||||
Content="n!"/>
|
||||
<controls:CalculatorButton x:Name="negateButton"
|
||||
<controls:CalculatorButton x:Name="NegateButton"
|
||||
x:Uid="negateButton"
|
||||
Grid.Row="7"
|
||||
Grid.Column="5"
|
||||
@@ -722,18 +720,18 @@
|
||||
ButtonId="Negate"
|
||||
Content=""
|
||||
IsEnabled="{x:Bind Model.IsNegateEnabled, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="openParenthesisButton"
|
||||
<controls:CalculatorButton x:Name="OpenParenthesisButton"
|
||||
x:Uid="openParenthesisButton"
|
||||
Grid.Row="8"
|
||||
Grid.Column="5"
|
||||
Style="{StaticResource ParenthesisCalcButtonStyle}"
|
||||
FontSize="19"
|
||||
AutomationProperties.AutomationId="openParenthesisButton"
|
||||
AutomationProperties.Name="{Binding LeftParenthesisAutomationName}"
|
||||
ButtonId="OpenParenthesis"
|
||||
Content="("
|
||||
Tag="{x:Bind Model.OpenParenthesisCount, Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="closeParenthesisButton"
|
||||
GotFocus="OpenParenthesisButton_GotFocus"
|
||||
Tag="{x:Bind ParenthesisCountToString(Model.OpenParenthesisCount), Mode=OneWay}"/>
|
||||
<controls:CalculatorButton x:Name="CloseParenthesisButton"
|
||||
x:Uid="closeParenthesisButton"
|
||||
Grid.Row="8"
|
||||
Grid.Column="6"
|
||||
|
||||
@@ -16,6 +16,7 @@ using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::Common;
|
||||
using namespace CalculatorApp::ViewModel;
|
||||
|
||||
using namespace std;
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
@@ -34,27 +35,18 @@ CalculatorScientificOperators::CalculatorScientificOperators()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
expButton->SetValue(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::E);
|
||||
ExpButton->SetValue(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::E);
|
||||
Common::KeyboardShortcutManager::ShiftButtonChecked(false);
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::OnLoaded(Object^, RoutedEventArgs^)
|
||||
{
|
||||
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorScientificOperators::OnViewModelPropertyChanged);
|
||||
}
|
||||
void CalculatorScientificOperators::OnUnloaded(Object^, RoutedEventArgs^)
|
||||
{
|
||||
Model->PropertyChanged -= m_propertyChangedToken;
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::ShortLayout_Completed(_In_ Platform::Object^ /*sender*/, _In_ Platform::Object^ /*e*/)
|
||||
void CalculatorScientificOperators::ShortLayout_Completed(_In_ Platform::Object ^ /*sender*/, _In_ Platform::Object ^ /*e*/)
|
||||
{
|
||||
IsWideLayout = false;
|
||||
SetOperatorRowVisibility();
|
||||
Common::KeyboardShortcutManager::ShiftButtonChecked(Model->IsShiftChecked);
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::WideLayout_Completed(_In_ Platform::Object^ /*sender*/, _In_ Platform::Object^ /*e*/)
|
||||
void CalculatorScientificOperators::WideLayout_Completed(_In_ Platform::Object ^ /*sender*/, _In_ Platform::Object ^ /*e*/)
|
||||
{
|
||||
IsWideLayout = true;
|
||||
SetOperatorRowVisibility();
|
||||
@@ -63,23 +55,25 @@ void CalculatorScientificOperators::WideLayout_Completed(_In_ Platform::Object^
|
||||
|
||||
void CalculatorScientificOperators::OnIsErrorVisualStatePropertyChanged(bool /*oldValue*/, bool newValue)
|
||||
{
|
||||
String^ newState = newValue ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = newValue ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
NumberPad->IsErrorVisualState = newValue;
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::shiftButton_Check(_In_ Platform::Object^ /*sender*/, _In_ Windows::UI::Xaml::RoutedEventArgs^ /*e*/)
|
||||
void CalculatorScientificOperators::shiftButton_Check(_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Xaml::RoutedEventArgs ^ /*e*/)
|
||||
{
|
||||
bool isChecked = shiftButton->IsChecked->Value;
|
||||
bool isChecked = ShiftButton->IsChecked->Value;
|
||||
Model->IsShiftChecked = isChecked;
|
||||
Common::KeyboardShortcutManager::ShiftButtonChecked(isChecked);
|
||||
SetOperatorRowVisibility();
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::shiftButton_IsEnabledChanged(_In_ Platform::Object^ /*sender*/, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ /*e*/)
|
||||
void CalculatorScientificOperators::shiftButton_IsEnabledChanged(
|
||||
_In_ Platform::Object ^ /*sender*/,
|
||||
_In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ /*e*/)
|
||||
{
|
||||
SetOperatorRowVisibility();
|
||||
Common::KeyboardShortcutManager::ShiftButtonChecked(shiftButton->IsEnabled && shiftButton->IsChecked->Value);
|
||||
Common::KeyboardShortcutManager::ShiftButtonChecked(ShiftButton->IsEnabled && ShiftButton->IsChecked->Value);
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::SetOperatorRowVisibility()
|
||||
@@ -90,7 +84,7 @@ void CalculatorScientificOperators::SetOperatorRowVisibility()
|
||||
rowVis = ::Visibility::Visible;
|
||||
invRowVis = ::Visibility::Visible;
|
||||
}
|
||||
else if (shiftButton->IsChecked->Value)
|
||||
else if (ShiftButton->IsChecked->Value)
|
||||
{
|
||||
rowVis = ::Visibility::Collapsed;
|
||||
invRowVis = ::Visibility::Visible;
|
||||
@@ -107,10 +101,12 @@ void CalculatorScientificOperators::SetOperatorRowVisibility()
|
||||
InvRow2->Visibility = invRowVis;
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||
void CalculatorScientificOperators::OpenParenthesisButton_GotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
if (e->PropertyName == StandardCalculatorViewModel::OpenParenthesisCountPropertyName && closeParenthesisButton->FocusState != ::FocusState::Unfocused)
|
||||
{
|
||||
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
|
||||
String ^ CalculatorScientificOperators::ParenthesisCountToString(unsigned int count)
|
||||
{
|
||||
return (count == 0) ? ref new String() : ref new String(to_wstring(count).data());
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorScientificOperators sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorScientificOperators sealed
|
||||
{
|
||||
public:
|
||||
CalculatorScientificOperators();
|
||||
@@ -32,19 +31,19 @@ namespace CalculatorApp
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(bool, IsErrorVisualState, false);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT(bool, IsWideLayout, false);
|
||||
|
||||
bool IsShiftEnabled(bool isWideLayout, bool isErrorState) { return !(isWideLayout || isErrorState); }
|
||||
bool IsShiftEnabled(bool isWideLayout, bool isErrorState)
|
||||
{
|
||||
return !(isWideLayout || isErrorState);
|
||||
}
|
||||
void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
Platform::String ^ ParenthesisCountToString(unsigned int count);
|
||||
|
||||
private:
|
||||
void ShortLayout_Completed(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void WideLayout_Completed(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void ShortLayout_Completed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void WideLayout_Completed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void OnIsErrorVisualStatePropertyChanged(bool oldValue, bool newValue);
|
||||
void shiftButton_Check(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void shiftButton_IsEnabledChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ e);
|
||||
void shiftButton_Check(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void shiftButton_IsEnabledChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ e);
|
||||
void SetOperatorRowVisibility();
|
||||
void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
|
||||
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,16 +33,16 @@
|
||||
<VisualState x:Name="NoErrorLayout"/>
|
||||
<VisualState x:Name="ErrorLayout">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="percentButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="squareRootButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="xpower2Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="xpower3Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="invertButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="divideButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="multiplyButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="minusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="plusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="negateButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PercentButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="SquareRootButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="XPower2Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="XPower3Button.IsEnabled" Value="False"/>
|
||||
<Setter Target="InvertButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="DivideButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MultiplyButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="MinusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="PlusButton.IsEnabled" Value="False"/>
|
||||
<Setter Target="NegateButton.IsEnabled" Value="False"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -52,20 +52,20 @@
|
||||
<AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="percentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower3Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="negateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PercentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower3Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle46}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -90,30 +90,30 @@
|
||||
<Setter Target="FnC2.Width" Value="0"/>
|
||||
<Setter Target="FnC3.Width" Value="0"/>
|
||||
|
||||
<Setter Target="squareRootButton.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="squareRootButton.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="xpower2Button.(Grid.Row)" Value="2"/>
|
||||
<Setter Target="xpower2Button.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="xpower3Button.Visibility" Value="Visible"/>
|
||||
<Setter Target="invertButton.(Grid.Row)" Value="4"/>
|
||||
<Setter Target="invertButton.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SquareRootButton.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="SquareRootButton.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="XPower2Button.(Grid.Row)" Value="2"/>
|
||||
<Setter Target="XPower2Button.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="XPower3Button.Visibility" Value="Visible"/>
|
||||
<Setter Target="InvertButton.(Grid.Row)" Value="4"/>
|
||||
<Setter Target="InvertButton.(Grid.Column)" Value="0"/>
|
||||
|
||||
<Setter Target="negateButton.(Grid.Row)" Value="5"/>
|
||||
<Setter Target="negateButton.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="NegateButton.(Grid.Row)" Value="5"/>
|
||||
<Setter Target="NegateButton.(Grid.Column)" Value="2"/>
|
||||
|
||||
<Setter Target="percentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="negateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="PercentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -138,31 +138,31 @@
|
||||
<Setter Target="FnC2.Width" Value="0"/>
|
||||
<Setter Target="FnC3.Width" Value="0"/>
|
||||
|
||||
<Setter Target="squareRootButton.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="squareRootButton.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="xpower2Button.(Grid.Row)" Value="2"/>
|
||||
<Setter Target="xpower2Button.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="xpower3Button.Visibility" Value="Visible"/>
|
||||
<Setter Target="invertButton.(Grid.Row)" Value="4"/>
|
||||
<Setter Target="invertButton.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SquareRootButton.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="SquareRootButton.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="XPower2Button.(Grid.Row)" Value="2"/>
|
||||
<Setter Target="XPower2Button.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="XPower3Button.Visibility" Value="Visible"/>
|
||||
<Setter Target="InvertButton.(Grid.Row)" Value="4"/>
|
||||
<Setter Target="InvertButton.(Grid.Column)" Value="0"/>
|
||||
|
||||
<Setter Target="negateButton.(Grid.Row)" Value="5"/>
|
||||
<Setter Target="negateButton.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="NegateButton.(Grid.Row)" Value="5"/>
|
||||
<Setter Target="NegateButton.(Grid.Column)" Value="2"/>
|
||||
|
||||
<Setter Target="percentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower3Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="negateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PercentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower3Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle28}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -172,20 +172,20 @@
|
||||
<AdaptiveTrigger MinWindowHeight="1024" MinWindowWidth="640"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="percentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower3Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="negateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PercentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower3Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle28}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -195,19 +195,19 @@
|
||||
<AdaptiveTrigger MinWindowHeight="854" MinWindowWidth="480"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="percentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="negateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="PercentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -217,19 +217,19 @@
|
||||
<AdaptiveTrigger MinWindowHeight="640" MinWindowWidth="360"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="percentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="squareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="xpower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="invertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="negateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="divideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="multiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="minusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="plusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="equalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PercentButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="SquareRootButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="XPower2Button.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="InvertButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle28}"/>
|
||||
</VisualState.Setters>
|
||||
@@ -266,21 +266,21 @@
|
||||
<ColumnDefinition x:Name="FnC2" Width="1*"/>
|
||||
<ColumnDefinition x:Name="FnC3" Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="percentButton"
|
||||
<controls:CalculatorButton x:Name="PercentButton"
|
||||
x:Uid="percentButton"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="percentButton"
|
||||
ButtonId="Percent"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="squareRootButton"
|
||||
<controls:CalculatorButton x:Name="SquareRootButton"
|
||||
x:Uid="squareRootButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
AutomationProperties.AutomationId="squareRootButton"
|
||||
ButtonId="Sqrt"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="xpower2Button"
|
||||
<controls:CalculatorButton x:Name="XPower2Button"
|
||||
x:Uid="xpower2Button"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -288,7 +288,7 @@
|
||||
AutomationProperties.AutomationId="xpower2Button"
|
||||
ButtonId="XPower2"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="xpower3Button"
|
||||
<controls:CalculatorButton x:Name="XPower3Button"
|
||||
x:Uid="xpower3Button"
|
||||
Grid.Row="3"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -297,7 +297,7 @@
|
||||
ButtonId="Cube"
|
||||
Content=""
|
||||
Visibility="Collapsed"/>
|
||||
<controls:CalculatorButton x:Name="invertButton"
|
||||
<controls:CalculatorButton x:Name="InvertButton"
|
||||
x:Uid="invertButton"
|
||||
Grid.Column="3"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -320,35 +320,35 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<controls:CalculatorButton x:Name="divideButton"
|
||||
<controls:CalculatorButton x:Name="DivideButton"
|
||||
x:Uid="divideButton"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="divideButton"
|
||||
ButtonId="Divide"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="multiplyButton"
|
||||
<controls:CalculatorButton x:Name="MultiplyButton"
|
||||
x:Uid="multiplyButton"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="multiplyButton"
|
||||
ButtonId="Multiply"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="minusButton"
|
||||
<controls:CalculatorButton x:Name="MinusButton"
|
||||
x:Uid="minusButton"
|
||||
Grid.Row="2"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="minusButton"
|
||||
ButtonId="Subtract"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="plusButton"
|
||||
<controls:CalculatorButton x:Name="PlusButton"
|
||||
x:Uid="plusButton"
|
||||
Grid.Row="3"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
AutomationProperties.AutomationId="plusButton"
|
||||
ButtonId="Add"
|
||||
Content=""/>
|
||||
<controls:CalculatorButton x:Name="equalButton"
|
||||
<controls:CalculatorButton x:Name="EqualButton"
|
||||
x:Uid="equalButton"
|
||||
Grid.Row="4"
|
||||
Style="{StaticResource AccentCalcButtonStyle}"
|
||||
@@ -368,7 +368,7 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="clearEntryButton"
|
||||
<controls:CalculatorButton x:Name="ClearEntryButton"
|
||||
x:Uid="clearEntryButton"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -376,7 +376,7 @@
|
||||
AutomationProperties.AutomationId="clearEntryButton"
|
||||
ButtonId="ClearEntry"
|
||||
Content="CE"/>
|
||||
<controls:CalculatorButton x:Name="clearButton"
|
||||
<controls:CalculatorButton x:Name="ClearButton"
|
||||
x:Uid="clearButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -384,7 +384,7 @@
|
||||
AutomationProperties.AutomationId="clearButton"
|
||||
ButtonId="Clear"
|
||||
Content="C"/>
|
||||
<controls:CalculatorButton x:Name="backSpaceButton"
|
||||
<controls:CalculatorButton x:Name="BackSpaceButton"
|
||||
x:Uid="backSpaceButton"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -403,7 +403,7 @@
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
ButtonStyle="{StaticResource NumericButtonStyle24}"/>
|
||||
|
||||
<controls:CalculatorButton x:Name="negateButton"
|
||||
<controls:CalculatorButton x:Name="NegateButton"
|
||||
x:Uid="negateButton"
|
||||
Grid.Row="5"
|
||||
Grid.Column="2"
|
||||
|
||||
@@ -24,13 +24,14 @@ using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
CalculatorStandardOperators::CalculatorStandardOperators() :
|
||||
m_isErrorVisualState(false)
|
||||
CalculatorStandardOperators::CalculatorStandardOperators()
|
||||
: m_isErrorVisualState(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
bool CalculatorStandardOperators::IsErrorVisualState::get() {
|
||||
bool CalculatorStandardOperators::IsErrorVisualState::get()
|
||||
{
|
||||
return m_isErrorVisualState;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ void CalculatorStandardOperators::IsErrorVisualState::set(bool value)
|
||||
if (m_isErrorVisualState != value)
|
||||
{
|
||||
m_isErrorVisualState = value;
|
||||
String^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
NumberPad->IsErrorVisualState = m_isErrorVisualState;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class CalculatorStandardOperators sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class CalculatorStandardOperators sealed
|
||||
{
|
||||
public:
|
||||
CalculatorStandardOperators();
|
||||
|
||||
@@ -403,11 +403,9 @@
|
||||
Grid.Row="2"
|
||||
Visibility="{Binding IsDateDiffMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*" MaxHeight="17"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*" MaxHeight="17"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="1*" MaxHeight="24"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="1*" MaxHeight="24"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -417,43 +415,31 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- From Date -->
|
||||
<TextBlock x:Name="Date_FromLabel"
|
||||
x:Uid="Date_FromLabel"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,2"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
TextWrapping="Wrap"/>
|
||||
<CalendarDatePicker x:Name="DateDiff_FromDate"
|
||||
Grid.Row="2"
|
||||
x:Uid="DateDiff_FromHeader"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
|
||||
AutomationProperties.LabeledBy="{x:Bind Date_FromLabel}"
|
||||
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
|
||||
Closed="CalendarFlyoutClosed"
|
||||
DateChanged="FromDate_DateChanged"/>
|
||||
|
||||
<!-- To Date -->
|
||||
<TextBlock x:Name="Date_ToLabel"
|
||||
x:Uid="Date_ToLabel"
|
||||
Grid.Row="4"
|
||||
Margin="0,0,0,2"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
TextWrapping="Wrap"/>
|
||||
<CalendarDatePicker x:Name="DateDiff_ToDate"
|
||||
Grid.Row="5"
|
||||
x:Uid="DateDiff_ToHeader"
|
||||
Grid.Row="3"
|
||||
Margin="0,0,0,0"
|
||||
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
|
||||
AutomationProperties.LabeledBy="{x:Bind Date_ToLabel}"
|
||||
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
|
||||
Closed="CalendarFlyoutClosed"
|
||||
DateChanged="ToDate_DateChanged"/>
|
||||
|
||||
<!-- Difference Result -->
|
||||
<TextBlock x:Uid="Date_DifferenceLabel"
|
||||
Grid.Row="7"
|
||||
Grid.Row="5"
|
||||
Margin="0,0,0,0"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"/>
|
||||
<TextBlock x:Name="DateDiffAllUnitsResultLabel"
|
||||
Grid.Row="8"
|
||||
Grid.Row="6"
|
||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||
FontWeight="SemiBold"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
@@ -461,7 +447,7 @@
|
||||
ContextFlyout="{StaticResource ResultsContextMenu}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{Binding StrDateDiffResult}"/>
|
||||
<TextBlock Grid.Row="10"
|
||||
<TextBlock Grid.Row="8"
|
||||
Style="{ThemeResource BaseTextBlockStyle}"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
||||
ContextFlyout="{StaticResource ResultsContextMenu}"
|
||||
@@ -479,7 +465,6 @@
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*" MaxHeight="17"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="1*" MaxHeight="23"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -491,23 +476,16 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- From Date -->
|
||||
<TextBlock x:Name="AddSubtract_Date_FromLabel"
|
||||
x:Uid="Date_FromLabel"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,2"
|
||||
Style="{ThemeResource BodyTextBlockStyle}"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
||||
TextWrapping="Wrap"/>
|
||||
<CalendarDatePicker x:Name="AddSubtract_FromDate"
|
||||
Grid.Row="2"
|
||||
x:Uid="AddSubtract_Date_FromHeader"
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,0"
|
||||
Style="{StaticResource DateCalculation_CalendarPickerStyle}"
|
||||
AutomationProperties.LabeledBy="{x:Bind AddSubtract_Date_FromLabel}"
|
||||
CalendarViewStyle="{StaticResource DateCalculation_CalendarViewStyle}"
|
||||
Closed="CalendarFlyoutClosed"
|
||||
DateChanged="AddSubtract_DateChanged"/>
|
||||
|
||||
<Grid Grid.Row="4">
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -533,7 +511,7 @@
|
||||
</Grid>
|
||||
|
||||
<!-- Date Offset to be Added/Subtracted -->
|
||||
<Grid x:Name="DateOffsetGrid" Grid.Row="6">
|
||||
<Grid x:Name="DateOffsetGrid" Grid.Row="5">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -594,11 +572,11 @@
|
||||
|
||||
<!-- Resulting Date -->
|
||||
<TextBlock x:Uid="DateLabel"
|
||||
Grid.Row="8"
|
||||
Grid.Row="7"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"/>
|
||||
|
||||
<TextBlock x:Name="DateResultLabel"
|
||||
Grid.Row="9"
|
||||
Grid.Row="8"
|
||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||
FontWeight="SemiBold"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
|
||||
@@ -51,7 +51,7 @@ DateCalculator::DateCalculator()
|
||||
// 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
|
||||
@@ -79,7 +79,7 @@ DateCalculator::DateCalculator()
|
||||
DateDiff_ToDate->MaxDate = maxYear;
|
||||
|
||||
// Set the PlaceHolderText for CalendarDatePicker
|
||||
DateTimeFormatter^ dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(
|
||||
DateTimeFormatter^ dateTimeFormatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDateTimeFormatter(
|
||||
L"day month year",
|
||||
localizationSettings.GetCalendarIdentifier(),
|
||||
ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used
|
||||
@@ -93,14 +93,15 @@ DateCalculator::DateCalculator()
|
||||
DateDiff_ToDate->PlaceholderText = placeholderText;
|
||||
|
||||
CopyMenuItem->Text = AppResourceProvider::GetInstance().GetResourceString(L"copyMenuItem");
|
||||
m_dateCalcOptionChangedEventToken = DateCalculationOption->SelectionChanged += ref new SelectionChangedEventHandler(this, &DateCalculator::DateCalcOption_Changed);
|
||||
m_dateCalcOptionChangedEventToken = DateCalculationOption->SelectionChanged +=
|
||||
ref new SelectionChangedEventHandler(this, &DateCalculator::DateCalcOption_Changed);
|
||||
}
|
||||
|
||||
void DateCalculator::FromDate_DateChanged(_In_ CalendarDatePicker^ sender, _In_ CalendarDatePickerDateChangedEventArgs^ e)
|
||||
void DateCalculator::FromDate_DateChanged(_In_ CalendarDatePicker ^ sender, _In_ CalendarDatePickerDateChangedEventArgs ^ e)
|
||||
{
|
||||
if (e->NewDate != nullptr)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->FromDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
}
|
||||
@@ -110,11 +111,11 @@ void DateCalculator::FromDate_DateChanged(_In_ CalendarDatePicker^ sender, _In_
|
||||
}
|
||||
}
|
||||
|
||||
void DateCalculator::ToDate_DateChanged(_In_ CalendarDatePicker^ sender, _In_ CalendarDatePickerDateChangedEventArgs^ e)
|
||||
void DateCalculator::ToDate_DateChanged(_In_ CalendarDatePicker ^ sender, _In_ CalendarDatePickerDateChangedEventArgs ^ e)
|
||||
{
|
||||
if (e->NewDate != nullptr)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->ToDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateDifferenceModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
}
|
||||
@@ -124,13 +125,14 @@ void DateCalculator::ToDate_DateChanged(_In_ CalendarDatePicker^ sender, _In_ Ca
|
||||
}
|
||||
}
|
||||
|
||||
void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker^ sender, _In_ CalendarDatePickerDateChangedEventArgs^ e)
|
||||
void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _In_ CalendarDatePickerDateChangedEventArgs ^ e)
|
||||
{
|
||||
if (e->NewDate != nullptr)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->StartDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -138,15 +140,16 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker^ sender, _I
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object^ sender, _In_ SelectionChangedEventArgs^ e)
|
||||
void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ SelectionChangedEventArgs ^ e)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
}
|
||||
|
||||
void DateCalculator::OnCopyMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void DateCalculator::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
auto calcResult = safe_cast<TextBlock^>(ResultsContextMenu->Target);
|
||||
auto calcResult = safe_cast<TextBlock ^>(ResultsContextMenu->Target);
|
||||
|
||||
CopyPasteManager::CopyToClipboard(calcResult->Text);
|
||||
}
|
||||
@@ -178,13 +181,13 @@ void DateCalculator::SetDefaultFocus()
|
||||
DateCalculationOption->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
|
||||
void DateCalculator::DateCalcOption_Changed(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e)
|
||||
void DateCalculator::DateCalcOption_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e)
|
||||
{
|
||||
FindName("AddSubtractDateGrid");
|
||||
DateCalculationOption->SelectionChanged -= m_dateCalcOptionChangedEventToken;
|
||||
}
|
||||
|
||||
void CalculatorApp::DateCalculator::AddSubtractDateGrid_Loaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
void CalculatorApp::DateCalculator::AddSubtractDateGrid_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||
{
|
||||
const auto& localizationSettings = LocalizationSettings::GetInstance();
|
||||
|
||||
@@ -198,7 +201,7 @@ void CalculatorApp::DateCalculator::AddSubtractDateGrid_Loaded(_In_ Platform::Ob
|
||||
AddSubtract_FromDate->DateFormat = L"day month year";
|
||||
}
|
||||
|
||||
void DateCalculator::ReselectCalendarDate(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker^ calendarDatePicker, Windows::Foundation::DateTime dateTime)
|
||||
void DateCalculator::ReselectCalendarDate(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ calendarDatePicker, Windows::Foundation::DateTime dateTime)
|
||||
{
|
||||
// Reselect the unselected Date
|
||||
calendarDatePicker->Date = ref new Box<DateTime>(dateTime);
|
||||
@@ -207,25 +210,25 @@ void DateCalculator::ReselectCalendarDate(_In_ Windows::UI::Xaml::Controls::Cale
|
||||
calendarDatePicker->IsCalendarOpen = false;
|
||||
}
|
||||
|
||||
void DateCalculator::OffsetDropDownClosed(_In_ Object^ sender, _In_ Object^ e)
|
||||
void DateCalculator::OffsetDropDownClosed(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
RaiseLiveRegionChangedAutomationEvent(/* DateDiff mode */ false);
|
||||
}
|
||||
|
||||
void DateCalculator::CalendarFlyoutClosed(_In_ Object^ sender, _In_ Object^ e)
|
||||
void DateCalculator::CalendarFlyoutClosed(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel^>(this->DataContext);
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
RaiseLiveRegionChangedAutomationEvent(dateCalcViewModel->IsDateDiffMode);
|
||||
}
|
||||
|
||||
void DateCalculator::RaiseLiveRegionChangedAutomationEvent(_In_ bool isDateDiffMode)
|
||||
{
|
||||
TextBlock^ resultTextBlock = (isDateDiffMode ? DateDiffAllUnitsResultLabel : DateResultLabel);
|
||||
String^ automationName = AutomationProperties::GetName(resultTextBlock);
|
||||
TextBlock ^ resultTextBlock = (isDateDiffMode ? DateDiffAllUnitsResultLabel : DateResultLabel);
|
||||
String ^ automationName = AutomationProperties::GetName(resultTextBlock);
|
||||
TextBlockAutomationPeer::FromElement(resultTextBlock)->RaiseAutomationEvent(AutomationEvents::LiveRegionChanged);
|
||||
}
|
||||
|
||||
void DateCalculator::AddSubtractOption_Checked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void DateCalculator::AddSubtractOption_Checked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
RaiseLiveRegionChangedAutomationEvent(/* DateDiff mode */ false);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ const int c_minYear = 1601;
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class DateCalculator sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class DateCalculator sealed
|
||||
{
|
||||
public:
|
||||
DateCalculator();
|
||||
@@ -30,18 +29,24 @@ namespace CalculatorApp
|
||||
void SetDefaultFocus();
|
||||
|
||||
private:
|
||||
void FromDate_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker^ sender, _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs^ e);
|
||||
void ToDate_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker^ sender, _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs^ e);
|
||||
void AddSubtract_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker^ sender, _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs^ e);
|
||||
void OffsetValue_Changed(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void DateCalcOption_Changed(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
|
||||
void AddSubtractDateGrid_Loaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void AddSubtractOption_Checked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void ReselectCalendarDate(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker^ calendarDatePicker, Windows::Foundation::DateTime dateTime);
|
||||
void OffsetDropDownClosed(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void CalendarFlyoutClosed(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void FromDate_DateChanged(
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void ToDate_DateChanged(
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void AddSubtract_DateChanged(
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnLoaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void DateCalcOption_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e);
|
||||
void AddSubtractDateGrid_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void AddSubtractOption_Checked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void ReselectCalendarDate(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ calendarDatePicker, Windows::Foundation::DateTime dateTime);
|
||||
void OffsetDropDownClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void CalendarFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void RaiseLiveRegionChangedAutomationEvent(_In_ bool isDateDiffMode);
|
||||
|
||||
Windows::Foundation::EventRegistrationToken m_dateCalcOptionChangedEventToken;
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
x:Name="HistoryList"
|
||||
AutomationProperties.AutomationId="HistoryList"
|
||||
FlowDirection="LeftToRight"
|
||||
Loaded="HistoryList_Loaded"
|
||||
Unloaded="HistoryList_Unloaded"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
@@ -62,7 +60,7 @@
|
||||
<StackPanel Margin="0,6,4,6"
|
||||
Background="Transparent"
|
||||
ContextFlyout="{StaticResource HistoryContextMenu}">
|
||||
<TextBlock x:Name="exprTextBlock"
|
||||
<TextBlock x:Name="ExprTextBlock"
|
||||
Margin="0,0,0,4"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{ThemeResource BodyTextBlockMediumStyle}"
|
||||
@@ -71,7 +69,7 @@
|
||||
Text="{x:Bind Expression}"
|
||||
TextAlignment="Right"
|
||||
TextWrapping="Wrap"/>
|
||||
<TextBlock x:Name="resultTextBlock"
|
||||
<TextBlock x:Name="ResultTextBlock"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{ThemeResource TitleTextBlockStyle}"
|
||||
FontWeight="SemiBold"
|
||||
@@ -93,7 +91,6 @@
|
||||
|
||||
<Grid x:Name="LayoutGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="{Binding RowHeight, ElementName=HistoryList, Mode=OneWay}"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -105,11 +102,10 @@
|
||||
<AdaptiveTrigger MinWindowWidth="560"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="HistoryListRootGrid.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="HistoryListRootGrid.(Grid.Row)" Value="0"/>
|
||||
<Setter Target="HistoryListRootGrid.(Grid.RowSpan)" Value="2"/>
|
||||
<Setter Target="HistoryListView.Padding" Value="0"/>
|
||||
<Setter Target="BackgroundShade.Opacity" Value="0"/>
|
||||
<Setter Target="CustomTitleBar.Height" Value="0"/>
|
||||
<Setter Target="BackgroundShade.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="DefaultLayout">
|
||||
@@ -120,7 +116,7 @@
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Border x:Name="BackgroundShade"
|
||||
Grid.Row="2"
|
||||
Grid.Row="1"
|
||||
Margin="0,-1,0,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -129,7 +125,7 @@
|
||||
BorderBrush="{ThemeResource SystemControlForegroundChromeHighBrush}"
|
||||
BorderThickness="{ThemeResource HighContrastThicknessTop}"/>
|
||||
|
||||
<Grid x:Name="HistoryListRootGrid" Grid.Row="2">
|
||||
<Grid x:Name="HistoryListRootGrid" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -171,10 +167,5 @@
|
||||
Content=""
|
||||
Visibility="{x:Bind Model.ItemSize, Mode=OneWay, Converter={StaticResource ItemSizeToVisibilityNegationConverter}}"/>
|
||||
</Grid>
|
||||
|
||||
<Border x:Name="CustomTitleBar"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{ThemeResource TitleBarBackgroundTransparentBrush}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
//
|
||||
@@ -40,23 +40,10 @@ HistoryList::HistoryList()
|
||||
HistoryEmpty->FlowDirection = LocalizationService::GetInstance()->GetFlowDirection();
|
||||
}
|
||||
|
||||
void HistoryList::HistoryList_Loaded(Object^ sender, RoutedEventArgs^ e)
|
||||
void HistoryList::ListView_ItemClick(_In_ Object ^ sender, _In_ ItemClickEventArgs ^ e)
|
||||
{
|
||||
// When transitioning between docked and undocked view states, the history list is
|
||||
// unloaded and then loaded, so we attempt to create the titlebarhelper every time
|
||||
// we are loaded, letting the util function check if we are docked or not.
|
||||
m_titleBarHelper = TitleBarHelper::CreateTitleBarHelperIfNotDocked(CustomTitleBar);
|
||||
}
|
||||
|
||||
void HistoryList::HistoryList_Unloaded(Object^ sender, RoutedEventArgs^ e)
|
||||
{
|
||||
m_titleBarHelper = nullptr;
|
||||
}
|
||||
|
||||
void HistoryList::ListView_ItemClick(_In_ Object^ sender, _In_ ItemClickEventArgs^ e)
|
||||
{
|
||||
HistoryViewModel^ historyVM = static_cast<HistoryViewModel^>(this->DataContext);
|
||||
HistoryItemViewModel^ clickedItem = safe_cast<HistoryItemViewModel^>(e->ClickedItem);
|
||||
HistoryViewModel ^ historyVM = static_cast<HistoryViewModel ^>(this->DataContext);
|
||||
HistoryItemViewModel ^ clickedItem = safe_cast<HistoryItemViewModel ^>(e->ClickedItem);
|
||||
|
||||
// When the user clears the history list in the overlay view and presses enter, the clickedItem is nullptr
|
||||
if (clickedItem != nullptr)
|
||||
@@ -65,16 +52,16 @@ void HistoryList::ListView_ItemClick(_In_ Object^ sender, _In_ ItemClickEventArg
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryList::OnDeleteMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void HistoryList::OnDeleteMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
auto clickedItem = safe_cast<HistoryItemViewModel^>(safe_cast<FrameworkElement^>(sender)->DataContext);
|
||||
auto clickedItem = safe_cast<HistoryItemViewModel ^>(safe_cast<FrameworkElement ^>(sender)->DataContext);
|
||||
|
||||
Model->DeleteItem(clickedItem);
|
||||
}
|
||||
|
||||
void HistoryList::OnDeleteSwipeInvoked(_In_ MUXC::SwipeItem^ sender, _In_ MUXC::SwipeItemInvokedEventArgs^ e)
|
||||
void HistoryList::OnDeleteSwipeInvoked(_In_ MUXC::SwipeItem ^ sender, _In_ MUXC::SwipeItemInvokedEventArgs ^ e)
|
||||
{
|
||||
auto swipedItem = safe_cast<HistoryItemViewModel^>(e->SwipeControl->DataContext);
|
||||
auto swipedItem = safe_cast<HistoryItemViewModel ^>(e->SwipeControl->DataContext);
|
||||
|
||||
Model->DeleteItem(swipedItem);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
//
|
||||
@@ -9,15 +9,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Views/HistoryList.g.h"
|
||||
#include "Common/TitleBarHelper.h"
|
||||
#include "Converters/ItemSizeToVisibilityConverter.h"
|
||||
#include "Converters/VisibilityNegationConverter.h"
|
||||
#include "CalcViewModel/HistoryViewModel.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class HistoryList sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class HistoryList sealed
|
||||
{
|
||||
public:
|
||||
HistoryList();
|
||||
@@ -35,13 +33,8 @@ namespace CalculatorApp
|
||||
private:
|
||||
Windows::Foundation::Rect m_visibleBounds;
|
||||
Windows::Foundation::Rect m_coreBounds;
|
||||
void ListView_ItemClick(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs^ e);
|
||||
void OnDeleteMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnDeleteSwipeInvoked(_In_ Microsoft::UI::Xaml::Controls::SwipeItem^ sender, _In_ Microsoft::UI::Xaml::Controls::SwipeItemInvokedEventArgs^ e);
|
||||
|
||||
void HistoryList_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void HistoryList_Unloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
|
||||
std::unique_ptr<CalculatorApp::Common::TitleBarHelper> m_titleBarHelper;
|
||||
void ListView_ItemClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs ^ e);
|
||||
void OnDeleteMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnDeleteSwipeInvoked(_In_ Microsoft::UI::Xaml::Controls::SwipeItem ^ sender, _In_ Microsoft::UI::Xaml::Controls::SwipeItemInvokedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:vm="using:CalculatorApp.ViewModel"
|
||||
x:Name="pageRoot"
|
||||
x:Name="PageRoot"
|
||||
Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}"
|
||||
Loaded="OnPageLoaded"
|
||||
Unloaded="OnPageUnLoaded"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
@@ -38,11 +37,6 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<!--
|
||||
This row is padding for the SystemFocusVisuals,
|
||||
otherwise the focus rectangles render under the title bar controls.
|
||||
-->
|
||||
<RowDefinition x:Name="FocusVisualMargin" Height="3"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
@@ -75,28 +69,25 @@
|
||||
These buttons are only here to serve as the target for copy/paste commands
|
||||
they are not to be shown, only to have the command and shortcut assigned to them.
|
||||
-->
|
||||
<Button x:Name="copyButton"
|
||||
<Button x:Name="CopyButton"
|
||||
x:Uid="copyButton"
|
||||
Command="{x:Bind Model.CopyCommand}"/>
|
||||
<Button x:Name="pasteButton"
|
||||
<Button x:Name="PasteButton"
|
||||
x:Uid="pasteButton"
|
||||
Command="{x:Bind Model.PasteCommand}"/>
|
||||
<Button x:Name="copyButtonAlternate"
|
||||
<Button x:Name="CopyButtonAlternate"
|
||||
x:Uid="copyButtonAlternate"
|
||||
Command="{x:Bind Model.CopyCommand}"/>
|
||||
<Button x:Name="pasteButtonAlternate"
|
||||
<Button x:Name="PasteButtonAlternate"
|
||||
x:Uid="pasteButtonAlternate"
|
||||
Command="{x:Bind Model.PasteCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Title Bar -->
|
||||
<local:TitleBar x:Name="CustomTitleBar"
|
||||
Grid.Row="0"
|
||||
Visibility="Collapsed"/>
|
||||
<local:TitleBar x:Name="CustomTitleBar" Grid.Row="0"/>
|
||||
|
||||
<muxc:NavigationView x:Name="NavView"
|
||||
x:Uid="NavView"
|
||||
Grid.Row="2"
|
||||
Grid.Row="1"
|
||||
CompactModeThresholdWidth="Infinity"
|
||||
DataContext="{x:Bind Model}"
|
||||
ExpandedModeThresholdWidth="Infinity"
|
||||
@@ -109,6 +100,7 @@
|
||||
PaneOpened="OnNavPaneOpened"
|
||||
PaneOpening="OnNavPaneOpening"
|
||||
SelectionChanged="OnNavSelectionChanged"
|
||||
ItemInvoked="OnNavItemInvoked"
|
||||
TabIndex="1"
|
||||
UseSystemFocusVisuals="True">
|
||||
<muxc:NavigationView.PaneFooter>
|
||||
@@ -118,6 +110,10 @@
|
||||
x:Load="False"
|
||||
IsItemClickEnabled="True"
|
||||
ItemClick="OnAboutButtonClick">
|
||||
<muxc:NavigationViewList.ItemContainerTransitions>
|
||||
<!-- Remove EntranceThemeTransition which is a default transition for NavigationViewList -->
|
||||
<TransitionCollection/>
|
||||
</muxc:NavigationViewList.ItemContainerTransitions>
|
||||
<muxc:NavigationViewList.Items>
|
||||
<muxc:NavigationViewItem x:Name="AboutButton"
|
||||
x:Uid="AboutButton"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "Views/Memory.xaml.h"
|
||||
#include "Converters/BooleanToVisibilityConverter.h"
|
||||
#include "Common/AppLifecycleLogger.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::Common;
|
||||
using namespace CalculatorApp::Common::Automation;
|
||||
@@ -64,13 +63,11 @@ namespace CalculatorApp::VisualStates
|
||||
}
|
||||
}
|
||||
|
||||
MainPage::MainPage() :
|
||||
m_model(ref new ApplicationViewModel())
|
||||
MainPage::MainPage()
|
||||
: m_model(ref new ApplicationViewModel())
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
m_uiSettings = ref new UISettings();
|
||||
|
||||
KeyboardShortcutManager::Initialize();
|
||||
|
||||
m_model->PropertyChanged += ref new PropertyChangedEventHandler(this, &MainPage::OnAppPropertyChanged);
|
||||
@@ -83,10 +80,10 @@ MainPage::MainPage() :
|
||||
{
|
||||
DisplayInformation::AutoRotationPreferences = DisplayOrientations::Portrait | DisplayOrientations::PortraitFlipped;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
|
||||
void MainPage::OnNavigatedTo(NavigationEventArgs ^ e)
|
||||
{
|
||||
if (m_model->CalculatorViewModel)
|
||||
{
|
||||
@@ -96,7 +93,7 @@ void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
|
||||
ViewMode initialMode = ViewMode::Standard;
|
||||
if (e->Parameter != nullptr)
|
||||
{
|
||||
String^ stringParameter = dynamic_cast<String^>(e->Parameter);
|
||||
String ^ stringParameter = dynamic_cast<String ^>(e->Parameter);
|
||||
if (stringParameter != nullptr)
|
||||
{
|
||||
initialMode = (ViewMode)stoi(stringParameter->Data());
|
||||
@@ -104,7 +101,7 @@ void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplicationDataContainer^ localSettings = ApplicationData::Current->LocalSettings;
|
||||
ApplicationDataContainer ^ localSettings = ApplicationData::Current->LocalSettings;
|
||||
if (localSettings->Values->HasKey(ApplicationViewModel::ModePropertyName))
|
||||
{
|
||||
initialMode = NavCategory::Deserialize(localSettings->Values->Lookup(ApplicationViewModel::ModePropertyName));
|
||||
@@ -114,15 +111,15 @@ void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
|
||||
m_model->Initialize(initialMode);
|
||||
}
|
||||
|
||||
void MainPage::WindowSizeChanged(_In_ Platform::Object^ /*sender*/, _In_ Windows::UI::Core::WindowSizeChangedEventArgs^ e)
|
||||
void MainPage::WindowSizeChanged(_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Core::WindowSizeChangedEventArgs ^ e)
|
||||
{
|
||||
// We don't use layout aware page's view states, we have our own
|
||||
UpdateViewState();
|
||||
}
|
||||
|
||||
void MainPage::OnAppPropertyChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e)
|
||||
void MainPage::OnAppPropertyChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e)
|
||||
{
|
||||
String^ propertyName = e->PropertyName;
|
||||
String ^ propertyName = e->PropertyName;
|
||||
if (propertyName == ApplicationViewModel::ModePropertyName)
|
||||
{
|
||||
ViewMode newValue = m_model->Mode;
|
||||
@@ -188,7 +185,6 @@ void MainPage::OnAppPropertyChanged(_In_ Platform::Object^ sender, _In_ Windows:
|
||||
ShowHideControls(newValue);
|
||||
|
||||
UpdateViewState();
|
||||
SetTitleBarControlColors();
|
||||
SetDefaultFocus();
|
||||
}
|
||||
else if (propertyName == ApplicationViewModel::CategoryNamePropertyName)
|
||||
@@ -248,7 +244,7 @@ void MainPage::UpdatePanelViewState()
|
||||
}
|
||||
}
|
||||
|
||||
void MainPage::OnPageLoaded(_In_ Object^, _In_ RoutedEventArgs^ args)
|
||||
void MainPage::OnPageLoaded(_In_ Object ^, _In_ RoutedEventArgs ^ args)
|
||||
{
|
||||
if (!m_converter && !m_calculator && !m_dateCalculator && !m_graphingCalculator)
|
||||
{
|
||||
@@ -257,40 +253,22 @@ void MainPage::OnPageLoaded(_In_ Object^, _In_ RoutedEventArgs^ args)
|
||||
m_model->CalculatorViewModel->IsStandard = true;
|
||||
}
|
||||
|
||||
_windowSizeEventToken = Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &MainPage::WindowSizeChanged);
|
||||
m_windowSizeEventToken = Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &MainPage::WindowSizeChanged);
|
||||
UpdateViewState();
|
||||
|
||||
// Set custom XAML Title Bar window caption control button brushes
|
||||
m_uiSettings->ColorValuesChanged -= m_colorValuesChangedToken;
|
||||
m_colorValuesChangedToken = m_uiSettings->ColorValuesChanged += ref new TypedEventHandler<UISettings^, Object^>(this, &MainPage::ColorValuesChanged);
|
||||
SetTitleBarControlColors();
|
||||
|
||||
SetHeaderAutomationName();
|
||||
SetDefaultFocus();
|
||||
|
||||
// Delay load things later when we get a chance.
|
||||
this->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([]()
|
||||
{
|
||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||
{
|
||||
TraceLogger::GetInstance().LogAppLaunchComplete();
|
||||
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
||||
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void MainPage::OnPageUnLoaded(_In_ Object^, _In_ RoutedEventArgs^)
|
||||
{
|
||||
// OnPageUnloaded Event Handler does not get fired when the calc window is closed.
|
||||
// On closing the instance of a window, On Window Consolidate gets fired.
|
||||
}
|
||||
|
||||
void MainPage::PinUnpinAppBarButtonOnClicked(
|
||||
_In_ Object^ sender,
|
||||
_In_ RoutedEventArgs^ e)
|
||||
{
|
||||
m_model->CalculatorViewModel->OnPinUnpinCommand(sender);
|
||||
this->Dispatcher->RunAsync(
|
||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() {
|
||||
if (TraceLogger::GetInstance().UpdateWindowIdLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||
{
|
||||
TraceLogger::GetInstance().LogAppLaunchComplete();
|
||||
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
||||
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void MainPage::SetDefaultFocus()
|
||||
@@ -321,20 +299,17 @@ void MainPage::EnsureCalculator()
|
||||
m_calculator = ref new Calculator();
|
||||
m_calculator->Name = L"Calculator";
|
||||
m_calculator->DataContext = m_model->CalculatorViewModel;
|
||||
Binding^ isStandardBinding = ref new Binding();
|
||||
Binding ^ isStandardBinding = ref new Binding();
|
||||
isStandardBinding->Path = ref new PropertyPath(L"IsStandard");
|
||||
m_calculator->SetBinding(m_calculator->IsStandardProperty, isStandardBinding);
|
||||
Binding^ isScientificBinding = ref new Binding();
|
||||
Binding ^ isScientificBinding = ref new Binding();
|
||||
isScientificBinding->Path = ref new PropertyPath(L"IsScientific");
|
||||
m_calculator->SetBinding(m_calculator->IsScientificProperty, isScientificBinding);
|
||||
Binding^ isProgramerBinding = ref new Binding();
|
||||
Binding ^ isProgramerBinding = ref new Binding();
|
||||
isProgramerBinding->Path = ref new PropertyPath(L"IsProgrammer");
|
||||
m_calculator->SetBinding(m_calculator->IsProgrammerProperty, isProgramerBinding);
|
||||
m_calculator->Style = CalculatorBaseStyle;
|
||||
|
||||
m_fullscreenFlyoutClosedToken =
|
||||
m_calculator->FullscreenFlyoutClosed += ref new FullscreenFlyoutClosedEventHandler(this, &MainPage::OnFullscreenFlyoutClosed);
|
||||
|
||||
CalcHolder->Child = m_calculator;
|
||||
|
||||
// Calculator's "default" state is visible, but if we get delay loaded
|
||||
@@ -347,7 +322,6 @@ void MainPage::EnsureCalculator()
|
||||
{
|
||||
m_dateCalculator->CloseCalendarFlyout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainPage::EnsureDateCalculator()
|
||||
@@ -394,11 +368,11 @@ void MainPage::EnsureConverter()
|
||||
}
|
||||
}
|
||||
|
||||
void MainPage::OnNavLoaded(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void MainPage::OnNavLoaded(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
if (NavView->SelectedItem == nullptr)
|
||||
{
|
||||
auto menuItems = static_cast<IObservableVector<Object^>^>(NavView->MenuItemsSource);
|
||||
auto menuItems = static_cast<IObservableVector<Object ^> ^>(NavView->MenuItemsSource);
|
||||
auto itemCount = static_cast<int>(menuItems->Size);
|
||||
auto flatIndex = NavCategory::GetFlatIndex(Model->Mode);
|
||||
|
||||
@@ -417,7 +391,7 @@ void MainPage::OnNavLoaded(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
NavView->SetValue(Common::KeyboardShortcutManager::VirtualKeyControlChordProperty, Common::MyVirtualKey::E);
|
||||
}
|
||||
|
||||
void MainPage::OnNavPaneOpening(_In_ MUXC::NavigationView^ sender, _In_ Object^ args)
|
||||
void MainPage::OnNavPaneOpening(_In_ MUXC::NavigationView ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
if (!NavFooter)
|
||||
{
|
||||
@@ -425,24 +399,24 @@ void MainPage::OnNavPaneOpening(_In_ MUXC::NavigationView^ sender, _In_ Object^
|
||||
}
|
||||
}
|
||||
|
||||
void MainPage::OnNavPaneOpened(_In_ MUXC::NavigationView^ sender, _In_ Object^ args)
|
||||
void MainPage::OnNavPaneOpened(_In_ MUXC::NavigationView ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
KeyboardShortcutManager::HonorShortcuts(false);
|
||||
TraceLogger::GetInstance().LogNavBarOpened();
|
||||
}
|
||||
|
||||
void MainPage::OnNavPaneClosed(_In_ MUXC::NavigationView^ sender, _In_ Object^ args)
|
||||
void MainPage::OnNavPaneClosed(_In_ MUXC::NavigationView ^ sender, _In_ Object ^ args)
|
||||
{
|
||||
KeyboardShortcutManager::HonorShortcuts(true);
|
||||
this->SetDefaultFocus();
|
||||
}
|
||||
|
||||
void MainPage::OnAboutButtonClick(Object^ sender, ItemClickEventArgs^ e)
|
||||
void MainPage::OnAboutButtonClick(Object ^ sender, ItemClickEventArgs ^ e)
|
||||
{
|
||||
ShowAboutPage();
|
||||
}
|
||||
|
||||
void MainPage::OnAboutFlyoutOpened(_In_ Object^ sender, _In_ Object^ e)
|
||||
void MainPage::OnAboutFlyoutOpened(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
// Keep Ignoring Escape till the About page flyout is opened
|
||||
KeyboardShortcutManager::IgnoreEscape(false);
|
||||
@@ -450,7 +424,7 @@ void MainPage::OnAboutFlyoutOpened(_In_ Object^ sender, _In_ Object^ e)
|
||||
KeyboardShortcutManager::UpdateDropDownState(this->AboutPageFlyout);
|
||||
}
|
||||
|
||||
void MainPage::OnAboutFlyoutClosed(_In_ Object^ sender, _In_ Object^ e)
|
||||
void MainPage::OnAboutFlyoutClosed(_In_ Object ^ sender, _In_ Object ^ e)
|
||||
{
|
||||
// Start Honoring Escape once the About page flyout is closed
|
||||
KeyboardShortcutManager::HonorEscape();
|
||||
@@ -458,19 +432,19 @@ void MainPage::OnAboutFlyoutClosed(_In_ Object^ sender, _In_ Object^ e)
|
||||
KeyboardShortcutManager::UpdateDropDownState(nullptr);
|
||||
}
|
||||
|
||||
void MainPage::OnNavSelectionChanged(_In_ Object^ sender, _In_ MUXC::NavigationViewSelectionChangedEventArgs^ e)
|
||||
void MainPage::OnNavSelectionChanged(_In_ Object ^ sender, _In_ MUXC::NavigationViewSelectionChangedEventArgs ^ e)
|
||||
{
|
||||
auto item = dynamic_cast<MUXC::NavigationViewItem^>(e->SelectedItemContainer);
|
||||
auto item = dynamic_cast<MUXC::NavigationViewItem ^>(e->SelectedItemContainer);
|
||||
if (item != nullptr)
|
||||
{
|
||||
auto selectedItem = static_cast<NavCategory^>(item->DataContext);
|
||||
auto selectedItem = static_cast<NavCategory ^>(item->DataContext);
|
||||
Model->Mode = selectedItem->Mode;
|
||||
}
|
||||
}
|
||||
|
||||
IObservableVector<Object^>^ MainPage::CreateUIElementsForCategories(_In_ IObservableVector<NavCategoryGroup^>^ categories)
|
||||
IObservableVector<Object ^> ^ MainPage::CreateUIElementsForCategories(_In_ IObservableVector<NavCategoryGroup ^> ^ categories)
|
||||
{
|
||||
auto menuCategories = ref new Vector<Object^>();
|
||||
auto menuCategories = ref new Vector<Object ^>();
|
||||
|
||||
for (auto group : categories)
|
||||
{
|
||||
@@ -485,7 +459,7 @@ IObservableVector<Object^>^ MainPage::CreateUIElementsForCategories(_In_ IObserv
|
||||
return menuCategories;
|
||||
}
|
||||
|
||||
MUXC::NavigationViewItemHeader^ MainPage::CreateNavViewHeaderFromGroup(NavCategoryGroup^ group)
|
||||
MUXC::NavigationViewItemHeader ^ MainPage::CreateNavViewHeaderFromGroup(NavCategoryGroup ^ group)
|
||||
{
|
||||
auto header = ref new MUXC::NavigationViewItemHeader();
|
||||
header->DataContext = group;
|
||||
@@ -497,19 +471,19 @@ MUXC::NavigationViewItemHeader^ MainPage::CreateNavViewHeaderFromGroup(NavCatego
|
||||
return header;
|
||||
}
|
||||
|
||||
MUXC::NavigationViewItem^ MainPage::CreateNavViewItemFromCategory(NavCategory^ category)
|
||||
MUXC::NavigationViewItem ^ MainPage::CreateNavViewItemFromCategory(NavCategory ^ category)
|
||||
{
|
||||
auto item = ref new MUXC::NavigationViewItem();
|
||||
item->DataContext = category;
|
||||
|
||||
auto icon = ref new FontIcon();
|
||||
icon->FontFamily = static_cast<Windows::UI::Xaml::Media::FontFamily^>(App::Current->Resources->Lookup(L"CalculatorFontFamily"));
|
||||
icon->FontFamily = static_cast<Windows::UI::Xaml::Media::FontFamily ^>(App::Current->Resources->Lookup(L"CalculatorFontFamily"));
|
||||
icon->Glyph = category->Glyph;
|
||||
item->Icon = icon;
|
||||
|
||||
item->Content = category->Name;
|
||||
item->AccessKey = category->AccessKey;
|
||||
item->Style = static_cast<Windows::UI::Xaml::Style^>(Resources->Lookup(L"NavViewItemStyle"));
|
||||
item->Style = static_cast<Windows::UI::Xaml::Style ^>(Resources->Lookup(L"NavViewItemStyle"));
|
||||
|
||||
AutomationProperties::SetName(item, category->AutomationName);
|
||||
AutomationProperties::SetAutomationId(item, category->AutomationId);
|
||||
@@ -527,62 +501,15 @@ void MainPage::ShowAboutPage()
|
||||
FlyoutBase::ShowAttachedFlyout(AboutButton);
|
||||
}
|
||||
|
||||
void MainPage::ColorValuesChanged(_In_ UISettings^ sender, _In_ Object^ e)
|
||||
{
|
||||
WeakReference weakThis(this);
|
||||
RunOnUIThreadNonblocking([weakThis]()
|
||||
{
|
||||
auto refThis = weakThis.Resolve<MainPage>();
|
||||
if (refThis != nullptr)
|
||||
{
|
||||
refThis->SetTitleBarControlColors();
|
||||
}
|
||||
}, this->Dispatcher);
|
||||
}
|
||||
|
||||
void MainPage::SetTitleBarControlColors()
|
||||
{
|
||||
auto applicationView = ApplicationView::GetForCurrentView();
|
||||
if (applicationView == nullptr) { return; }
|
||||
|
||||
auto applicationTitleBar = applicationView->TitleBar;
|
||||
if (applicationTitleBar == nullptr) { return; }
|
||||
|
||||
auto bgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlBackgroundTransparentBrush"));
|
||||
auto fgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlPageTextBaseHighBrush"));
|
||||
auto inactivefgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlForegroundChromeDisabledLowBrush"));
|
||||
auto hoverbgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlBackgroundListLowBrush"));
|
||||
auto hoverfgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlForegroundBaseHighBrush"));
|
||||
auto pressedbgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlBackgroundListMediumBrush"));
|
||||
auto pressedfgbrush = safe_cast<SolidColorBrush^>(Application::Current->Resources->Lookup("SystemControlForegroundBaseHighBrush"));
|
||||
|
||||
applicationTitleBar->ButtonBackgroundColor = bgbrush->Color;
|
||||
applicationTitleBar->ButtonForegroundColor = fgbrush->Color;
|
||||
applicationTitleBar->ButtonInactiveBackgroundColor = bgbrush->Color;
|
||||
applicationTitleBar->ButtonInactiveForegroundColor = inactivefgbrush->Color;
|
||||
applicationTitleBar->ButtonHoverBackgroundColor = hoverbgbrush->Color;
|
||||
applicationTitleBar->ButtonHoverForegroundColor = hoverfgbrush->Color;
|
||||
applicationTitleBar->ButtonPressedBackgroundColor = pressedbgbrush->Color;
|
||||
applicationTitleBar->ButtonPressedForegroundColor = pressedfgbrush->Color;
|
||||
}
|
||||
|
||||
void MainPage::UnregisterEventHandlers()
|
||||
{
|
||||
m_uiSettings->ColorValuesChanged -= m_colorValuesChangedToken;
|
||||
m_colorValuesChangedToken.Value = 0;
|
||||
|
||||
Window::Current->SizeChanged -= _windowSizeEventToken;
|
||||
_windowSizeEventToken.Value = 0;
|
||||
Window::Current->SizeChanged -= m_windowSizeEventToken;
|
||||
m_windowSizeEventToken.Value = 0;
|
||||
|
||||
if (m_calculator != nullptr)
|
||||
{
|
||||
m_calculator->FullscreenFlyoutClosed -= m_fullscreenFlyoutClosedToken;
|
||||
m_fullscreenFlyoutClosedToken.Value = 0;
|
||||
|
||||
m_calculator->UnregisterEventHandlers();
|
||||
}
|
||||
|
||||
m_titleBarHelper = nullptr;
|
||||
}
|
||||
|
||||
void MainPage::SetHeaderAutomationName()
|
||||
@@ -590,7 +517,7 @@ void MainPage::SetHeaderAutomationName()
|
||||
ViewMode mode = m_model->Mode;
|
||||
auto resProvider = AppResourceProvider::GetInstance();
|
||||
|
||||
String^ name;
|
||||
String ^ name;
|
||||
if (NavCategory::IsDateCalculatorViewMode(mode))
|
||||
{
|
||||
name = resProvider.GetResourceString(L"HeaderAutomationName_Date");
|
||||
@@ -606,7 +533,7 @@ void MainPage::SetHeaderAutomationName()
|
||||
{
|
||||
full = resProvider.GetResourceString(L"HeaderAutomationName_Converter")->Data();
|
||||
}
|
||||
|
||||
|
||||
string::size_type found = full.find(L"%1");
|
||||
assert(found != wstring::npos);
|
||||
wstring strMode = m_model->CategoryName->Data();
|
||||
@@ -618,14 +545,14 @@ void MainPage::SetHeaderAutomationName()
|
||||
AutomationProperties::SetName(Header, name);
|
||||
}
|
||||
|
||||
void MainPage::OnFullscreenFlyoutClosed()
|
||||
{
|
||||
this->CustomTitleBar->SetTitleBar();
|
||||
}
|
||||
|
||||
void MainPage::AnnounceCategoryName()
|
||||
{
|
||||
String^ categoryName = AutomationProperties::GetName(Header);
|
||||
NarratorAnnouncement^ announcement = CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(categoryName);
|
||||
String ^ categoryName = AutomationProperties::GetName(Header);
|
||||
NarratorAnnouncement ^ announcement = CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(categoryName);
|
||||
NarratorNotifier->Announce(announcement);
|
||||
}
|
||||
|
||||
void MainPage::OnNavItemInvoked(MUXC::NavigationView ^ /*sender*/, _In_ MUXC::NavigationViewItemInvokedEventArgs ^ e)
|
||||
{
|
||||
NavView->IsPaneOpen = false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "Views/GraphingCalculator/GraphingCalculator.xaml.h"
|
||||
#include "Views/UnitConverter.xaml.h"
|
||||
#include "CalcViewModel/ApplicationViewModel.h"
|
||||
#include "Views/TitleBar.xaml.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
@@ -21,57 +20,52 @@ namespace CalculatorApp
|
||||
/// <summary>
|
||||
/// A basic page that provides characteristics common to most applications.
|
||||
/// </summary>
|
||||
public ref class MainPage sealed
|
||||
public
|
||||
ref class MainPage sealed
|
||||
{
|
||||
public:
|
||||
MainPage();
|
||||
property ViewModel::ApplicationViewModel^ Model
|
||||
{
|
||||
ViewModel::ApplicationViewModel^ get(){
|
||||
return m_model;
|
||||
}
|
||||
}
|
||||
property CalculatorApp::ViewModel::ApplicationViewModel
|
||||
^ Model { CalculatorApp::ViewModel::ApplicationViewModel ^ get() { return m_model; } }
|
||||
|
||||
void UnregisterEventHandlers();
|
||||
void
|
||||
UnregisterEventHandlers();
|
||||
|
||||
void SetDefaultFocus();
|
||||
void SetHeaderAutomationName();
|
||||
|
||||
Windows::Foundation::Collections::IObservableVector<Platform::Object^>^ CreateUIElementsForCategories(_In_ Windows::Foundation::Collections::IObservableVector<Common::NavCategoryGroup^>^ categories);
|
||||
Windows::Foundation::Collections::IObservableVector<
|
||||
Platform::Object
|
||||
^> ^ CreateUIElementsForCategories(_In_ Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup ^> ^ categories);
|
||||
|
||||
protected:
|
||||
void OnNavigatedTo(_In_ Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
|
||||
void OnNavigatedTo(_In_ Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e) override;
|
||||
|
||||
private:
|
||||
void WindowSizeChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Core::WindowSizeChangedEventArgs^ e);
|
||||
void OnAppPropertyChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e);
|
||||
void SetTitleBarControlColors();
|
||||
void ColorValuesChanged(_In_ Windows::UI::ViewManagement::UISettings^ sender, _In_ Platform::Object^ e);
|
||||
void WindowSizeChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Core::WindowSizeChangedEventArgs ^ e);
|
||||
void OnAppPropertyChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
|
||||
void OnNavLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnNavPaneOpening(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
|
||||
void OnNavPaneOpened(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
|
||||
void OnNavPaneClosed(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
|
||||
void OnNavSelectionChanged(_In_ Platform::Object^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewSelectionChangedEventArgs^ e);
|
||||
void OnNavLoaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnNavPaneOpening(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnNavPaneOpened(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnNavPaneClosed(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnNavSelectionChanged(_In_ Platform::Object ^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewSelectionChangedEventArgs ^ e);
|
||||
void OnNavItemInvoked(
|
||||
Microsoft::UI::Xaml::Controls::NavigationView ^ /*sender*/,
|
||||
_In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs ^ e);
|
||||
|
||||
void OnAboutButtonClick(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs^ e);
|
||||
void OnAboutFlyoutOpened(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnAboutFlyoutClosed(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnAboutButtonClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs ^ e);
|
||||
void OnAboutFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void OnAboutFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
|
||||
Microsoft::UI::Xaml::Controls::NavigationViewItemHeader^ CreateNavViewHeaderFromGroup(Common::NavCategoryGroup^ group);
|
||||
Microsoft::UI::Xaml::Controls::NavigationViewItem^ CreateNavViewItemFromCategory(Common::NavCategory^ category);
|
||||
|
||||
Windows::Foundation::EventRegistrationToken m_fullscreenFlyoutClosedToken;
|
||||
void OnFullscreenFlyoutClosed();
|
||||
|
||||
void ShowHideControls(Common::ViewMode mode);
|
||||
Microsoft::UI::Xaml::Controls::NavigationViewItemHeader ^ CreateNavViewHeaderFromGroup(CalculatorApp::Common::NavCategoryGroup ^ group);
|
||||
Microsoft::UI::Xaml::Controls::NavigationViewItem ^ CreateNavViewItemFromCategory(CalculatorApp::Common::NavCategory ^ category);
|
||||
|
||||
void ShowHideControls(CalculatorApp::Common::ViewMode mode);
|
||||
void UpdateViewState();
|
||||
void UpdatePanelViewState();
|
||||
|
||||
void OnPageLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnPageUnLoaded(_In_ Platform::Object^, _In_ Windows::UI::Xaml::RoutedEventArgs^);
|
||||
|
||||
void PinUnpinAppBarButtonOnClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnPageLoaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
void EnsureCalculator();
|
||||
void EnsureDateCalculator();
|
||||
@@ -88,9 +82,7 @@ namespace CalculatorApp
|
||||
Windows::Foundation::EventRegistrationToken _windowSizeEventToken;
|
||||
Windows::Foundation::EventRegistrationToken m_hardwareButtonsBackPressedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_colorValuesChangedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_windowSizeEventToken;
|
||||
ViewModel::ApplicationViewModel^ m_model;
|
||||
Windows::UI::ViewManagement::UISettings^ m_uiSettings;
|
||||
|
||||
std::unique_ptr<Common::TitleBarHelper> m_titleBarHelper;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
xmlns:model="using:CalculatorApp.ViewModel"
|
||||
x:Name="MemoryList"
|
||||
FlowDirection="LeftToRight"
|
||||
Loaded="MemoryList_Loaded"
|
||||
Unloaded="MemoryList_Unloaded"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
@@ -49,7 +47,6 @@
|
||||
|
||||
<Grid x:Name="LayoutGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="{Binding RowHeight, ElementName=MemoryList, Mode=OneWay}"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -69,11 +66,10 @@
|
||||
<AdaptiveTrigger MinWindowWidth="560"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="MemoryPanel.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="MemoryPanel.(Grid.Row)" Value="0"/>
|
||||
<Setter Target="MemoryPanel.(Grid.RowSpan)" Value="2"/>
|
||||
<Setter Target="MemoryListView.Padding" Value="0"/>
|
||||
<Setter Target="BackgroundShade.Opacity" Value="0"/>
|
||||
<Setter Target="CustomTitleBar.Height" Value="0"/>
|
||||
<Setter Target="BackgroundShade.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="DefaultLayout">
|
||||
@@ -84,7 +80,7 @@
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Border x:Name="BackgroundShade"
|
||||
Grid.Row="2"
|
||||
Grid.Row="1"
|
||||
Margin="0,-1,0,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -92,7 +88,7 @@
|
||||
Background="{ThemeResource SystemControlChromeMediumLowAcrylicElementMediumBrush}"
|
||||
BorderBrush="{ThemeResource SystemControlForegroundChromeHighBrush}"
|
||||
BorderThickness="{ThemeResource HighContrastThicknessTop}"/>
|
||||
<Grid x:Name="MemoryPanel" Grid.Row="2">
|
||||
<Grid x:Name="MemoryPanel" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -135,9 +131,5 @@
|
||||
Visibility="{x:Bind Model.IsMemoryEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||
</Grid>
|
||||
|
||||
<Border x:Name="CustomTitleBar"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{ThemeResource TitleBarBackgroundTransparentBrush}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -35,18 +35,18 @@ using namespace Windows::UI::ViewManagement;
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(Memory, RowHeight);
|
||||
|
||||
Memory::Memory() :
|
||||
m_isErrorVisualState(false)
|
||||
Memory::Memory()
|
||||
: m_isErrorVisualState(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
m_memoryItemFlyout = safe_cast<MenuFlyout^>(Resources->Lookup("MemoryContextMenu"));
|
||||
m_memoryItemFlyout = safe_cast<MenuFlyout ^>(Resources->Lookup("MemoryContextMenu"));
|
||||
|
||||
MemoryPaneEmpty->FlowDirection = LocalizationService::GetInstance()->GetFlowDirection();
|
||||
}
|
||||
|
||||
void Memory::MemoryListItemClick(_In_ Object^ sender, _In_ ItemClickEventArgs^ e)
|
||||
void Memory::MemoryListItemClick(_In_ Object ^ sender, _In_ ItemClickEventArgs ^ e)
|
||||
{
|
||||
MemoryItemViewModel^ memorySlot = safe_cast<MemoryItemViewModel^>(e->ClickedItem);
|
||||
MemoryItemViewModel ^ memorySlot = safe_cast<MemoryItemViewModel ^>(e->ClickedItem);
|
||||
|
||||
// In case the memory list is clicked and enter is pressed,
|
||||
// On Item clicked event gets fired and e->ClickedItem is Null.
|
||||
@@ -56,20 +56,20 @@ void Memory::MemoryListItemClick(_In_ Object^ sender, _In_ ItemClickEventArgs^ e
|
||||
}
|
||||
}
|
||||
|
||||
void Memory::OnContextRequested(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs^ e)
|
||||
void Memory::OnContextRequested(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs ^ e)
|
||||
{
|
||||
// Walk up the tree to find the ListViewItem.
|
||||
// There may not be one if the click wasn't on an item.
|
||||
auto requestedElement = safe_cast<FrameworkElement^>(e->OriginalSource);
|
||||
while ((requestedElement != sender) && !dynamic_cast<ListViewItem^>(requestedElement))
|
||||
auto requestedElement = safe_cast<FrameworkElement ^>(e->OriginalSource);
|
||||
while ((requestedElement != sender) && !dynamic_cast<ListViewItem ^>(requestedElement))
|
||||
{
|
||||
requestedElement = safe_cast<FrameworkElement^>(VisualTreeHelper::GetParent(requestedElement));
|
||||
requestedElement = safe_cast<FrameworkElement ^>(VisualTreeHelper::GetParent(requestedElement));
|
||||
}
|
||||
|
||||
if (requestedElement != sender)
|
||||
{
|
||||
// The context menu request was for a ListViewItem.
|
||||
auto memorySlot = safe_cast<MemoryItemViewModel^>(MemoryListView->ItemFromContainer(requestedElement));
|
||||
auto memorySlot = safe_cast<MemoryItemViewModel ^>(MemoryListView->ItemFromContainer(requestedElement));
|
||||
Point point;
|
||||
if (e->TryGetPosition(requestedElement, &point))
|
||||
{
|
||||
@@ -85,22 +85,22 @@ void Memory::OnContextRequested(Windows::UI::Xaml::UIElement^ sender, Windows::U
|
||||
}
|
||||
}
|
||||
|
||||
void Memory::OnContextCanceled(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||
void Memory::OnContextCanceled(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||
{
|
||||
m_memoryItemFlyout->Hide();
|
||||
}
|
||||
|
||||
void Memory::OnClearMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void Memory::OnClearMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
GetMemoryItemForCurrentFlyout()->Clear();
|
||||
}
|
||||
|
||||
void Memory::OnMemoryAddMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void Memory::OnMemoryAddMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
GetMemoryItemForCurrentFlyout()->MemoryAdd();
|
||||
}
|
||||
|
||||
void Memory::OnMemorySubtractMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void Memory::OnMemorySubtractMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
GetMemoryItemForCurrentFlyout()->MemorySubtract();
|
||||
}
|
||||
@@ -115,27 +115,14 @@ void Memory::IsErrorVisualState::set(bool value)
|
||||
if (m_isErrorVisualState != value)
|
||||
{
|
||||
m_isErrorVisualState = value;
|
||||
String^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
}
|
||||
}
|
||||
|
||||
void Memory::MemoryList_Loaded(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
{
|
||||
// When transitioning between docked and undocked view states, the memory list is
|
||||
// unloaded and then loaded, so we attempt to create the titlebarhelper every time
|
||||
// we are loaded, letting the util function check if we are docked or not.
|
||||
m_titleBarHelper = TitleBarHelper::CreateTitleBarHelperIfNotDocked(CustomTitleBar);
|
||||
}
|
||||
|
||||
void Memory::MemoryList_Unloaded(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
{
|
||||
m_titleBarHelper = nullptr;
|
||||
}
|
||||
|
||||
MemoryItemViewModel^ Memory::GetMemoryItemForCurrentFlyout()
|
||||
MemoryItemViewModel ^ Memory::GetMemoryItemForCurrentFlyout()
|
||||
{
|
||||
auto listViewItem = m_memoryItemFlyout->Target;
|
||||
|
||||
return safe_cast<MemoryItemViewModel^>(MemoryListView->ItemFromContainer(listViewItem));
|
||||
return safe_cast<MemoryItemViewModel ^>(MemoryListView->ItemFromContainer(listViewItem));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
//
|
||||
@@ -9,15 +9,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Views/Memory.g.h"
|
||||
#include "Common/TitleBarHelper.h"
|
||||
#include "Converters/BooleanNegationConverter.h"
|
||||
#include "Converters/VisibilityNegationConverter.h"
|
||||
#include "CalcViewModel/StandardCalculatorViewModel.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class Memory sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class Memory sealed
|
||||
{
|
||||
public:
|
||||
Memory();
|
||||
@@ -31,28 +29,25 @@ namespace CalculatorApp
|
||||
DEPENDENCY_PROPERTY_OWNER(Memory);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::GridLength, RowHeight);
|
||||
|
||||
property bool IsErrorVisualState {
|
||||
property bool IsErrorVisualState
|
||||
{
|
||||
bool get();
|
||||
void set(bool value);
|
||||
}
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::Controls::MenuFlyout^ m_memoryItemFlyout;
|
||||
Windows::UI::Xaml::Controls::MenuFlyout ^ m_memoryItemFlyout;
|
||||
Windows::Foundation::Rect m_visibleBounds;
|
||||
Windows::Foundation::Rect m_coreBounds;
|
||||
bool m_isErrorVisualState;
|
||||
|
||||
void MemoryListItemClick(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs^ e);
|
||||
void OnContextRequested(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs^ e);
|
||||
void OnContextCanceled(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnClearMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnMemoryAddMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnMemorySubtractMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void MemoryList_Loaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void MemoryList_Unloaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void MemoryListItemClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs ^ e);
|
||||
void OnContextRequested(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs ^ e);
|
||||
void OnContextCanceled(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnClearMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnMemoryAddMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnMemorySubtractMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
CalculatorApp::ViewModel::MemoryItemViewModel^ GetMemoryItemForCurrentFlyout();
|
||||
|
||||
std::unique_ptr<CalculatorApp::Common::TitleBarHelper> m_titleBarHelper;
|
||||
CalculatorApp::ViewModel::MemoryItemViewModel ^ GetMemoryItemForCurrentFlyout();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,51 +31,51 @@ MemoryListItem::MemoryListItem()
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void MemoryListItem::OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e)
|
||||
void MemoryListItem::OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e)
|
||||
{
|
||||
Control::OnPointerEntered(e);
|
||||
|
||||
// Only show hover buttons when the user is using mouse or pen.
|
||||
if (e->Pointer->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse || e->Pointer->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Pen)
|
||||
if (e->Pointer->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse
|
||||
|| e->Pointer->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Pen)
|
||||
{
|
||||
VisualStateManager::GoToState(this, "MemoryButtonsVisible", true);
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryListItem::OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e)
|
||||
void MemoryListItem::OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e)
|
||||
{
|
||||
Control::OnPointerExited(e);
|
||||
|
||||
VisualStateManager::GoToState(this, "MemoryButtonsHidden", true);
|
||||
}
|
||||
|
||||
void MemoryListItem::OnClearButtonClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void MemoryListItem::OnClearButtonClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
Model->Clear();
|
||||
}
|
||||
|
||||
void MemoryListItem::OnMemoryAddButtonClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void MemoryListItem::OnMemoryAddButtonClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
Model->MemoryAdd();
|
||||
}
|
||||
|
||||
void MemoryListItem::OnMemorySubtractButtonClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void MemoryListItem::OnMemorySubtractButtonClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
Model->MemorySubtract();
|
||||
}
|
||||
|
||||
void MemoryListItem::OnClearSwipeInvoked(_In_ SwipeItem^ sender, SwipeItemInvokedEventArgs^ e)
|
||||
void MemoryListItem::OnClearSwipeInvoked(_In_ SwipeItem ^ sender, SwipeItemInvokedEventArgs ^ e)
|
||||
{
|
||||
Model->Clear();
|
||||
}
|
||||
|
||||
void MemoryListItem::OnMemoryAddSwipeInvoked(_In_ SwipeItem^ sender, SwipeItemInvokedEventArgs^ e)
|
||||
void MemoryListItem::OnMemoryAddSwipeInvoked(_In_ SwipeItem ^ sender, SwipeItemInvokedEventArgs ^ e)
|
||||
{
|
||||
Model->MemoryAdd();
|
||||
}
|
||||
|
||||
void MemoryListItem::OnMemorySubtractSwipeInvoked(_In_ SwipeItem^ sender, SwipeItemInvokedEventArgs^ e)
|
||||
void MemoryListItem::OnMemorySubtractSwipeInvoked(_In_ SwipeItem ^ sender, SwipeItemInvokedEventArgs ^ e)
|
||||
{
|
||||
Model->MemorySubtract();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,26 +11,24 @@ namespace CalculatorApp
|
||||
/// <summary>
|
||||
/// Represents a single item in the Memory list.
|
||||
/// </summary>
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class MemoryListItem sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class MemoryListItem sealed
|
||||
{
|
||||
public:
|
||||
MemoryListItem();
|
||||
|
||||
DEPENDENCY_PROPERTY_OWNER(MemoryListItem);
|
||||
DEPENDENCY_PROPERTY(CalculatorApp::ViewModel::MemoryItemViewModel^, Model);
|
||||
DEPENDENCY_PROPERTY(CalculatorApp::ViewModel::MemoryItemViewModel ^, Model);
|
||||
|
||||
protected:
|
||||
void OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) override;
|
||||
void OnPointerEntered(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
void OnPointerExited(Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e) override;
|
||||
|
||||
private:
|
||||
void OnClearButtonClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnMemoryAddButtonClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnMemorySubtractButtonClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnClearSwipeInvoked(_In_ Windows::UI::Xaml::Controls::SwipeItem^ sender, Windows::UI::Xaml::Controls::SwipeItemInvokedEventArgs^ e);
|
||||
void OnMemoryAddSwipeInvoked(_In_ Windows::UI::Xaml::Controls::SwipeItem^ sender, Windows::UI::Xaml::Controls::SwipeItemInvokedEventArgs^ e);
|
||||
void OnMemorySubtractSwipeInvoked(_In_ Windows::UI::Xaml::Controls::SwipeItem^ sender, Windows::UI::Xaml::Controls::SwipeItemInvokedEventArgs^ e);
|
||||
|
||||
void OnClearButtonClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnMemoryAddButtonClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnMemorySubtractButtonClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnClearSwipeInvoked(_In_ Windows::UI::Xaml::Controls::SwipeItem ^ sender, Windows::UI::Xaml::Controls::SwipeItemInvokedEventArgs ^ e);
|
||||
void OnMemoryAddSwipeInvoked(_In_ Windows::UI::Xaml::Controls::SwipeItem ^ sender, Windows::UI::Xaml::Controls::SwipeItemInvokedEventArgs ^ e);
|
||||
void OnMemorySubtractSwipeInvoked(_In_ Windows::UI::Xaml::Controls::SwipeItem ^ sender, Windows::UI::Xaml::Controls::SwipeItemInvokedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,70 +30,70 @@
|
||||
<VisualState x:Name="NoErrorLayout"/>
|
||||
<VisualState x:Name="ErrorLayout">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="decimalSeparatorButton.IsEnabled" Value="false"/>
|
||||
<Setter Target="DecimalSeparatorButton.IsEnabled" Value="false"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<controls:CalculatorButton x:Name="num0Button"
|
||||
<controls:CalculatorButton x:Name="Num0Button"
|
||||
x:Uid="num0Button"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num0Button"
|
||||
ButtonId="Zero"/>
|
||||
<controls:CalculatorButton x:Name="num1Button"
|
||||
<controls:CalculatorButton x:Name="Num1Button"
|
||||
x:Uid="num1Button"
|
||||
Grid.Row="2"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num1Button"
|
||||
ButtonId="One"/>
|
||||
<controls:CalculatorButton x:Name="num2Button"
|
||||
<controls:CalculatorButton x:Name="Num2Button"
|
||||
x:Uid="num2Button"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num2Button"
|
||||
ButtonId="Two"/>
|
||||
<controls:CalculatorButton x:Name="num3Button"
|
||||
<controls:CalculatorButton x:Name="Num3Button"
|
||||
x:Uid="num3Button"
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num3Button"
|
||||
ButtonId="Three"/>
|
||||
<controls:CalculatorButton x:Name="num4Button"
|
||||
<controls:CalculatorButton x:Name="Num4Button"
|
||||
x:Uid="num4Button"
|
||||
Grid.Row="1"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num4Button"
|
||||
ButtonId="Four"/>
|
||||
<controls:CalculatorButton x:Name="num5Button"
|
||||
<controls:CalculatorButton x:Name="Num5Button"
|
||||
x:Uid="num5Button"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num5Button"
|
||||
ButtonId="Five"/>
|
||||
<controls:CalculatorButton x:Name="num6Button"
|
||||
<controls:CalculatorButton x:Name="Num6Button"
|
||||
x:Uid="num6Button"
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num6Button"
|
||||
ButtonId="Six"/>
|
||||
<controls:CalculatorButton x:Name="num7Button"
|
||||
<controls:CalculatorButton x:Name="Num7Button"
|
||||
x:Uid="num7Button"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num7Button"
|
||||
ButtonId="Seven"/>
|
||||
<controls:CalculatorButton x:Name="num8Button"
|
||||
<controls:CalculatorButton x:Name="Num8Button"
|
||||
x:Uid="num8Button"
|
||||
Grid.Column="1"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
AutomationProperties.AutomationId="num8Button"
|
||||
ButtonId="Eight"/>
|
||||
<controls:CalculatorButton x:Name="num9Button"
|
||||
<controls:CalculatorButton x:Name="Num9Button"
|
||||
x:Uid="num9Button"
|
||||
Grid.Column="2"
|
||||
Style="{x:Bind Path=ButtonStyle, Mode=OneWay}"
|
||||
@@ -107,7 +107,7 @@
|
||||
DO NOT REMOVE the common:KeyboardShortcutManager.Character from this element, it's value will be overwritten by the
|
||||
string coming from the RESW file
|
||||
-->
|
||||
<controls:CalculatorButton x:Name="decimalSeparatorButton"
|
||||
<controls:CalculatorButton x:Name="DecimalSeparatorButton"
|
||||
x:Uid="decimalSeparatorButton"
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
|
||||
@@ -31,57 +31,57 @@ using namespace CalculatorApp::Common;
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(NumberPad, ButtonStyle);
|
||||
|
||||
NumberPad::NumberPad() :
|
||||
m_isErrorVisualState(false)
|
||||
NumberPad::NumberPad()
|
||||
: m_isErrorVisualState(false)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
const auto& localizationSettings = LocalizationSettings::GetInstance();
|
||||
|
||||
this->decimalSeparatorButton->Content = localizationSettings.GetDecimalSeparator();
|
||||
this->num0Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('0');
|
||||
this->num1Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('1');
|
||||
this->num2Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('2');
|
||||
this->num3Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('3');
|
||||
this->num4Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('4');
|
||||
this->num5Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('5');
|
||||
this->num6Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('6');
|
||||
this->num7Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('7');
|
||||
this->num8Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('8');
|
||||
this->num9Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('9');
|
||||
|
||||
this->DecimalSeparatorButton->Content = localizationSettings.GetDecimalSeparator();
|
||||
this->Num0Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('0');
|
||||
this->Num1Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('1');
|
||||
this->Num2Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('2');
|
||||
this->Num3Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('3');
|
||||
this->Num4Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('4');
|
||||
this->Num5Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('5');
|
||||
this->Num6Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('6');
|
||||
this->Num7Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('7');
|
||||
this->Num8Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('8');
|
||||
this->Num9Button->Content = localizationSettings.GetDigitSymbolFromEnUsDigit('9');
|
||||
}
|
||||
|
||||
void NumberPad::ProgModeRadixChange()
|
||||
{
|
||||
num0Button->IsEnabled = true;
|
||||
num1Button->IsEnabled = true;
|
||||
num2Button->IsEnabled = true;
|
||||
num3Button->IsEnabled = true;
|
||||
num4Button->IsEnabled = true;
|
||||
num5Button->IsEnabled = true;
|
||||
num6Button->IsEnabled = true;
|
||||
num7Button->IsEnabled = true;
|
||||
num8Button->IsEnabled = true;
|
||||
num9Button->IsEnabled = true;
|
||||
Num0Button->IsEnabled = true;
|
||||
Num1Button->IsEnabled = true;
|
||||
Num2Button->IsEnabled = true;
|
||||
Num3Button->IsEnabled = true;
|
||||
Num4Button->IsEnabled = true;
|
||||
Num5Button->IsEnabled = true;
|
||||
Num6Button->IsEnabled = true;
|
||||
Num7Button->IsEnabled = true;
|
||||
Num8Button->IsEnabled = true;
|
||||
Num9Button->IsEnabled = true;
|
||||
|
||||
auto vm = safe_cast<StandardCalculatorViewModel^>(this->DataContext);
|
||||
auto vm = safe_cast<StandardCalculatorViewModel ^>(this->DataContext);
|
||||
RADIX_TYPE radixType = vm->GetCurrentRadixType();
|
||||
|
||||
if (radixType == RADIX_TYPE::BIN_RADIX)
|
||||
{
|
||||
num2Button->IsEnabled = false;
|
||||
num3Button->IsEnabled = false;
|
||||
num4Button->IsEnabled = false;
|
||||
num5Button->IsEnabled = false;
|
||||
num6Button->IsEnabled = false;
|
||||
num7Button->IsEnabled = false;
|
||||
num8Button->IsEnabled = false;
|
||||
num9Button->IsEnabled = false;
|
||||
Num2Button->IsEnabled = false;
|
||||
Num3Button->IsEnabled = false;
|
||||
Num4Button->IsEnabled = false;
|
||||
Num5Button->IsEnabled = false;
|
||||
Num6Button->IsEnabled = false;
|
||||
Num7Button->IsEnabled = false;
|
||||
Num8Button->IsEnabled = false;
|
||||
Num9Button->IsEnabled = false;
|
||||
}
|
||||
else if (radixType == RADIX_TYPE::OCT_RADIX)
|
||||
{
|
||||
num8Button->IsEnabled = false;
|
||||
num9Button->IsEnabled = false;
|
||||
Num8Button->IsEnabled = false;
|
||||
Num9Button->IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void NumberPad::IsErrorVisualState::set(bool value)
|
||||
if (m_isErrorVisualState != value)
|
||||
{
|
||||
m_isErrorVisualState = value;
|
||||
String^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
String ^ newState = m_isErrorVisualState ? L"ErrorLayout" : L"NoErrorLayout";
|
||||
VisualStateManager::GoToState(this, newState, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,13 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class NumberPad sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class NumberPad sealed
|
||||
{
|
||||
public:
|
||||
NumberPad();
|
||||
DEPENDENCY_PROPERTY_OWNER(NumberPad);
|
||||
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Style^, ButtonStyle);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Style ^, ButtonStyle);
|
||||
|
||||
property bool IsErrorVisualState
|
||||
{
|
||||
|
||||
@@ -28,8 +28,9 @@ OperatorsPanel::OperatorsPanel()
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
StandardCalculatorViewModel^ OperatorsPanel::Model::get() {
|
||||
return static_cast<CalculatorApp::ViewModel::StandardCalculatorViewModel^>(this->DataContext);
|
||||
StandardCalculatorViewModel ^ OperatorsPanel::Model::get()
|
||||
{
|
||||
return static_cast<CalculatorApp::ViewModel::StandardCalculatorViewModel ^>(this->DataContext);
|
||||
}
|
||||
|
||||
void OperatorsPanel::OnIsBitFlipCheckedPropertyChanged(bool /*oldValue*/, bool newValue)
|
||||
|
||||
@@ -11,17 +11,14 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class OperatorsPanel sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class OperatorsPanel sealed
|
||||
{
|
||||
public:
|
||||
OperatorsPanel();
|
||||
property CalculatorApp::ViewModel::StandardCalculatorViewModel^ Model
|
||||
{
|
||||
CalculatorApp::ViewModel::StandardCalculatorViewModel^ get();
|
||||
}
|
||||
property CalculatorApp::ViewModel::StandardCalculatorViewModel
|
||||
^ Model { CalculatorApp::ViewModel::StandardCalculatorViewModel ^ get(); }
|
||||
|
||||
DEPENDENCY_PROPERTY_OWNER(OperatorsPanel);
|
||||
DEPENDENCY_PROPERTY_OWNER(OperatorsPanel);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsBitFlipChecked);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsErrorVisualState);
|
||||
|
||||
|
||||
@@ -24,26 +24,28 @@ AspectRatioTrigger::~AspectRatioTrigger()
|
||||
UnregisterSizeChanged(Source);
|
||||
}
|
||||
|
||||
void AspectRatioTrigger::OnSourcePropertyChanged(FrameworkElement^ oldValue, FrameworkElement^ newValue)
|
||||
void AspectRatioTrigger::OnSourcePropertyChanged(FrameworkElement ^ oldValue, FrameworkElement ^ newValue)
|
||||
{
|
||||
UnregisterSizeChanged(oldValue);
|
||||
RegisterSizeChanged(newValue);
|
||||
}
|
||||
|
||||
void AspectRatioTrigger::RegisterSizeChanged(FrameworkElement^ element)
|
||||
void AspectRatioTrigger::RegisterSizeChanged(FrameworkElement ^ element)
|
||||
{
|
||||
if (element == nullptr) { return; }
|
||||
if (element == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (element != Source)
|
||||
{
|
||||
UnregisterSizeChanged(Source);
|
||||
}
|
||||
|
||||
m_sizeChangedToken =
|
||||
element->SizeChanged += ref new SizeChangedEventHandler(this, &AspectRatioTrigger::OnSizeChanged);
|
||||
m_sizeChangedToken = element->SizeChanged += ref new SizeChangedEventHandler(this, &AspectRatioTrigger::OnSizeChanged);
|
||||
}
|
||||
|
||||
void AspectRatioTrigger::UnregisterSizeChanged(FrameworkElement^ element)
|
||||
void AspectRatioTrigger::UnregisterSizeChanged(FrameworkElement ^ element)
|
||||
{
|
||||
if ((element != nullptr) && (m_sizeChangedToken.Value != 0))
|
||||
{
|
||||
@@ -52,7 +54,7 @@ void AspectRatioTrigger::UnregisterSizeChanged(FrameworkElement^ element)
|
||||
}
|
||||
}
|
||||
|
||||
void AspectRatioTrigger::OnSizeChanged(Object^ sender, SizeChangedEventArgs^ e)
|
||||
void AspectRatioTrigger::OnSizeChanged(Object ^ sender, SizeChangedEventArgs ^ e)
|
||||
{
|
||||
UpdateIsActive(e->NewSize);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
|
||||
namespace CalculatorApp::Views::StateTriggers
|
||||
{
|
||||
public enum class Aspect
|
||||
public
|
||||
enum class Aspect
|
||||
{
|
||||
Height,
|
||||
Width
|
||||
};
|
||||
|
||||
public ref class AspectRatioTrigger sealed : public Windows::UI::Xaml::StateTriggerBase
|
||||
public
|
||||
ref class AspectRatioTrigger sealed : public Windows::UI::Xaml::StateTriggerBase
|
||||
{
|
||||
public:
|
||||
AspectRatioTrigger();
|
||||
@@ -27,7 +29,7 @@ namespace CalculatorApp::Views::StateTriggers
|
||||
DEPENDENCY_PROPERTY_OWNER(AspectRatioTrigger);
|
||||
|
||||
/* The source for which this class will respond to size changed events. */
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::FrameworkElement^, Source);
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::FrameworkElement ^, Source);
|
||||
|
||||
/* Either Height or Width. The property will determine which aspect is used as the numerator when calculating
|
||||
the aspect ratio. */
|
||||
@@ -42,11 +44,11 @@ namespace CalculatorApp::Views::StateTriggers
|
||||
private:
|
||||
~AspectRatioTrigger();
|
||||
|
||||
void OnSourcePropertyChanged(Windows::UI::Xaml::FrameworkElement^ oldValue, Windows::UI::Xaml::FrameworkElement^ newValue);
|
||||
void OnSourcePropertyChanged(Windows::UI::Xaml::FrameworkElement ^ oldValue, Windows::UI::Xaml::FrameworkElement ^ newValue);
|
||||
|
||||
void RegisterSizeChanged(Windows::UI::Xaml::FrameworkElement^ element);
|
||||
void UnregisterSizeChanged(Windows::UI::Xaml::FrameworkElement^ element);
|
||||
void OnSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
||||
void RegisterSizeChanged(Windows::UI::Xaml::FrameworkElement ^ element);
|
||||
void UnregisterSizeChanged(Windows::UI::Xaml::FrameworkElement ^ element);
|
||||
void OnSizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
|
||||
|
||||
void UpdateIsActive(Windows::Foundation::Size sourceSize);
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(SupplementaryResults, Results);
|
||||
|
||||
Object^ DelighterUnitToStyleConverter::Convert(Object^ value, TypeName /*targetType*/, Object^ /*parameter*/, String^ /*language*/)
|
||||
Object ^ DelighterUnitToStyleConverter::Convert(Object ^ value, TypeName /*targetType*/, Object ^ /*parameter*/, String ^ /*language*/)
|
||||
{
|
||||
Unit^ unit = safe_cast<Unit^>(value);
|
||||
Unit ^ unit = safe_cast<Unit ^>(value);
|
||||
|
||||
assert(unit->GetModelUnit().isWhimsical);
|
||||
if (!unit->GetModelUnit().isWhimsical)
|
||||
@@ -41,19 +41,19 @@ Object^ DelighterUnitToStyleConverter::Convert(Object^ value, TypeName /*targetT
|
||||
|
||||
std::wstring key = L"Unit_";
|
||||
key.append(std::to_wstring(unit->GetModelUnit().id));
|
||||
return safe_cast<IStyle^>(m_delighters->Lookup(ref new String(key.c_str())));
|
||||
return safe_cast<IStyle ^>(m_delighters->Lookup(ref new String(key.c_str())));
|
||||
}
|
||||
|
||||
Object^ DelighterUnitToStyleConverter::ConvertBack(Object^ /*value*/, TypeName /*targetType*/, Object^ /*parameter*/, String^ /*language*/)
|
||||
Object ^ DelighterUnitToStyleConverter::ConvertBack(Object ^ /*value*/, TypeName /*targetType*/, Object ^ /*parameter*/, String ^ /*language*/)
|
||||
{
|
||||
// We never use convert back, only one way binding supported
|
||||
assert(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Windows::UI::Xaml::DataTemplate^ SupplementaryResultDataTemplateSelector::SelectTemplateCore(Object^ item, DependencyObject^ /*container*/)
|
||||
Windows::UI::Xaml::DataTemplate ^ SupplementaryResultDataTemplateSelector::SelectTemplateCore(Object ^ item, DependencyObject ^ /*container*/)
|
||||
{
|
||||
SupplementaryResult^ result = safe_cast<SupplementaryResult^>(item);
|
||||
SupplementaryResult ^ result = safe_cast<SupplementaryResult ^>(item);
|
||||
if (result->IsWhimsical())
|
||||
{
|
||||
return DelighterTemplate;
|
||||
@@ -75,11 +75,11 @@ bool SupplementaryResultNoOverflowStackPanel::ShouldPrioritizeLastItem()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto lastChild = dynamic_cast<FrameworkElement^>(Children->GetAt(Children->Size - 1));
|
||||
auto lastChild = dynamic_cast<FrameworkElement ^>(Children->GetAt(Children->Size - 1));
|
||||
if (lastChild == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
auto suppResult = dynamic_cast<SupplementaryResult^>(lastChild->DataContext);
|
||||
return suppResult == nullptr? false: suppResult->IsWhimsical();
|
||||
auto suppResult = dynamic_cast<SupplementaryResult ^>(lastChild->DataContext);
|
||||
return suppResult == nullptr ? false : suppResult->IsWhimsical();
|
||||
}
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
|
||||
#include "Views/SupplementaryResults.g.h"
|
||||
#include "Controls/SupplementaryItemsControl.h"
|
||||
#include "Controls/OperandTextBox.h"
|
||||
#include "Controls/OperatorTextBox.h"
|
||||
#include "Controls/HorizontalNoOverflowStackPanel.h"
|
||||
#include "CalcViewModel/UnitConverterViewModel.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
public ref class DelighterUnitToStyleConverter sealed : public Windows::UI::Xaml::Data::IValueConverter
|
||||
public
|
||||
ref class DelighterUnitToStyleConverter sealed : public Windows::UI::Xaml::Data::IValueConverter
|
||||
{
|
||||
public:
|
||||
DelighterUnitToStyleConverter()
|
||||
@@ -26,18 +25,30 @@ namespace CalculatorApp
|
||||
m_delighters->Source = ref new Windows::Foundation::Uri(L"ms-appx:///Views/DelighterUnitStyles.xaml");
|
||||
}
|
||||
|
||||
internal:
|
||||
virtual Platform::Object^ Convert(Platform::Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object^ parameter, Platform::String^ language) = Windows::UI::Xaml::Data::IValueConverter::Convert;
|
||||
virtual Platform::Object^ ConvertBack(Platform::Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object^ parameter, Platform::String^ language) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack;
|
||||
internal : virtual Platform::Object
|
||||
^ Convert(
|
||||
Platform::Object ^ value,
|
||||
Windows::UI::Xaml::Interop::TypeName targetType,
|
||||
Platform::Object ^ parameter,
|
||||
Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::Convert;
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value,
|
||||
Windows::UI::Xaml::Interop::TypeName targetType,
|
||||
Platform::Object ^ parameter,
|
||||
Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack;
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::ResourceDictionary^ m_delighters;
|
||||
Windows::UI::Xaml::ResourceDictionary ^ m_delighters;
|
||||
};
|
||||
|
||||
public ref class SupplementaryResultDataTemplateSelector sealed : public Windows::UI::Xaml::Controls::DataTemplateSelector
|
||||
public
|
||||
ref class SupplementaryResultDataTemplateSelector sealed : public Windows::UI::Xaml::Controls::DataTemplateSelector
|
||||
{
|
||||
public:
|
||||
SupplementaryResultDataTemplateSelector() {}
|
||||
SupplementaryResultDataTemplateSelector()
|
||||
{
|
||||
}
|
||||
|
||||
property Windows::UI::Xaml::DataTemplate^ RegularTemplate
|
||||
{
|
||||
@@ -55,22 +66,22 @@ namespace CalculatorApp
|
||||
virtual Windows::UI::Xaml::DataTemplate^ SelectTemplateCore(Platform::Object^ item, Windows::UI::Xaml::DependencyObject^ container) override;
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::DataTemplate^ m_regularTemplate;
|
||||
Windows::UI::Xaml::DataTemplate^ m_delighterTemplate;
|
||||
Windows::UI::Xaml::DataTemplate ^ m_regularTemplate;
|
||||
Windows::UI::Xaml::DataTemplate ^ m_delighterTemplate;
|
||||
};
|
||||
|
||||
public ref class SupplementaryResultNoOverflowStackPanel sealed: public CalculatorApp::Controls::HorizontalNoOverflowStackPanel
|
||||
public
|
||||
ref class SupplementaryResultNoOverflowStackPanel sealed : public CalculatorApp::Controls::HorizontalNoOverflowStackPanel
|
||||
{
|
||||
protected:
|
||||
virtual bool ShouldPrioritizeLastItem() override;
|
||||
};
|
||||
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class SupplementaryResults sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class SupplementaryResults sealed
|
||||
{
|
||||
public:
|
||||
SupplementaryResults();
|
||||
DEPENDENCY_PROPERTY_OWNER(SupplementaryResults);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT(Windows::Foundation::Collections::IIterable<ViewModel::SupplementaryResult^>^, Results, nullptr);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT(Windows::Foundation::Collections::IIterable<ViewModel::SupplementaryResult ^> ^, Results, nullptr);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,12 +4,19 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Background="{ThemeResource TitleBarBackgroundTransparentBrush}">
|
||||
HorizontalAlignment="Stretch">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="WindowFocusStates">
|
||||
<VisualState x:Name="WindowFocused"/>
|
||||
<VisualState x:Name="WindowNotFocused">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="AppName.Foreground" Value="{ThemeResource SystemControlForegroundChromeDisabledLowBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<TextBlock x:Name="AppName"
|
||||
x:Uid="AppName"
|
||||
Margin="12,0,12,0"
|
||||
|
||||
@@ -1,90 +1,85 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "TitleBar.xaml.h"
|
||||
#include "CalcViewModel/Common/AppResourceProvider.h"
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Platform;
|
||||
using namespace Windows::ApplicationModel;
|
||||
using namespace Windows::ApplicationModel::Core;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::UI;
|
||||
using namespace Windows::UI::Core;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
TitleBar::TitleBar() :
|
||||
m_coreTitleBar(CoreApplication::GetCurrentView()->TitleBar)
|
||||
TitleBar::TitleBar()
|
||||
: m_coreTitleBar(CoreApplication::GetCurrentView()->TitleBar)
|
||||
{
|
||||
m_uiSettings = ref new UISettings();
|
||||
m_accessibilitySettings = ref new AccessibilitySettings();
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
Loaded += ref new RoutedEventHandler(this, &TitleBar::OnLoaded);
|
||||
Unloaded += ref new RoutedEventHandler(this, &TitleBar::OnUnloaded);
|
||||
|
||||
m_coreTitleBar->ExtendViewIntoTitleBar = true;
|
||||
|
||||
this->Initialize();
|
||||
AppName->Text = AppResourceProvider::GetInstance().GetResourceString(L"AppName");
|
||||
}
|
||||
|
||||
void TitleBar::OnLoaded(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void TitleBar::OnLoaded(_In_ Object ^ /*sender*/, _In_ RoutedEventArgs ^ /*e*/)
|
||||
{
|
||||
this->RegisterForLayoutChanged();
|
||||
this->RegisterForVisibilityChanged();
|
||||
}
|
||||
// Register events
|
||||
m_visibilityChangedToken = m_coreTitleBar->IsVisibleChanged += ref new TypedEventHandler<CoreApplicationViewTitleBar ^, Object ^>(
|
||||
[this](CoreApplicationViewTitleBar ^ cTitleBar, Object ^) { this->SetTitleBarVisibility(); });
|
||||
m_layoutChangedToken = m_coreTitleBar->LayoutMetricsChanged +=
|
||||
ref new TypedEventHandler<CoreApplicationViewTitleBar ^, Object ^>([this](CoreApplicationViewTitleBar ^ cTitleBar, Object ^) {
|
||||
this->LayoutRoot->Height = cTitleBar->Height;
|
||||
this->SetTitleBarPadding();
|
||||
});
|
||||
|
||||
void TitleBar::OnUnloaded(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
{
|
||||
m_coreTitleBar->LayoutMetricsChanged -= m_layoutChangedToken;
|
||||
m_coreTitleBar->IsVisibleChanged -= m_visibilityChangedToken;
|
||||
}
|
||||
|
||||
void TitleBar::Initialize()
|
||||
{
|
||||
SetTitleBarText(AppResourceProvider::GetInstance().GetResourceString(L"AppName"));
|
||||
SetTitleBarHeight(m_coreTitleBar->Height);
|
||||
SetTitleBarVisibility(m_coreTitleBar->IsVisible);
|
||||
m_colorValuesChangedToken = m_uiSettings->ColorValuesChanged += ref new TypedEventHandler<UISettings ^, Object ^>(this, &TitleBar::ColorValuesChanged);
|
||||
m_accessibilitySettingsToken = m_accessibilitySettings->HighContrastChanged +=
|
||||
ref new Windows::Foundation::TypedEventHandler<AccessibilitySettings ^, Object ^>(this, &CalculatorApp::TitleBar::OnHighContrastChanged);
|
||||
m_windowActivatedToken = Window::Current->Activated +=
|
||||
ref new Windows::UI::Xaml::WindowActivatedEventHandler(this, &CalculatorApp::TitleBar::OnWindowActivated);
|
||||
// Set properties
|
||||
LayoutRoot->Height = m_coreTitleBar->Height;
|
||||
SetTitleBarControlColors();
|
||||
SetTitleBarExtendView();
|
||||
SetTitleBarVisibility();
|
||||
SetTitleBarPadding();
|
||||
SetTitleBar();
|
||||
}
|
||||
|
||||
void TitleBar::RegisterForLayoutChanged()
|
||||
void TitleBar::OnUnloaded(_In_ Object ^ /*sender*/, _In_ RoutedEventArgs ^ /*e*/)
|
||||
{
|
||||
m_layoutChangedToken =
|
||||
m_coreTitleBar->LayoutMetricsChanged += ref new TypedEventHandler<CoreApplicationViewTitleBar^, Object^>(
|
||||
[this](CoreApplicationViewTitleBar^ cTitleBar, Object^)
|
||||
{
|
||||
// Update title bar control size as needed to account for system size changes
|
||||
SetTitleBarHeight(cTitleBar->Height);
|
||||
SetTitleBarPadding();
|
||||
});
|
||||
// Unregister events
|
||||
m_coreTitleBar->LayoutMetricsChanged -= m_layoutChangedToken;
|
||||
m_layoutChangedToken.Value = 0;
|
||||
m_coreTitleBar->IsVisibleChanged -= m_visibilityChangedToken;
|
||||
m_visibilityChangedToken.Value = 0;
|
||||
m_uiSettings->ColorValuesChanged -= m_colorValuesChangedToken;
|
||||
m_colorValuesChangedToken.Value = 0;
|
||||
m_accessibilitySettings->HighContrastChanged -= m_accessibilitySettingsToken;
|
||||
m_accessibilitySettingsToken.Value = 0;
|
||||
Window::Current->Activated -= m_windowActivatedToken;
|
||||
m_windowActivatedToken.Value = 0;
|
||||
}
|
||||
|
||||
void TitleBar::RegisterForVisibilityChanged()
|
||||
void TitleBar::SetTitleBarExtendView()
|
||||
{
|
||||
m_visibilityChangedToken =
|
||||
m_coreTitleBar->IsVisibleChanged += ref new TypedEventHandler<CoreApplicationViewTitleBar^, Object^>(
|
||||
[this](CoreApplicationViewTitleBar^ cTitleBar, Object^)
|
||||
{
|
||||
// Update title bar visibility
|
||||
SetTitleBarVisibility(cTitleBar->IsVisible);
|
||||
});
|
||||
m_coreTitleBar->ExtendViewIntoTitleBar = !m_accessibilitySettings->HighContrast;
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarText(String^ text)
|
||||
void TitleBar::SetTitleBarVisibility()
|
||||
{
|
||||
this->AppName->Text = text;
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarHeight(double height)
|
||||
{
|
||||
this->Height = height;
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarVisibility(bool isVisible)
|
||||
{
|
||||
this->Visibility = isVisible ? ::Visibility::Visible : ::Visibility::Collapsed;
|
||||
this->LayoutRoot->Visibility = m_coreTitleBar->IsVisible && !m_accessibilitySettings->HighContrast ? ::Visibility::Visible : ::Visibility::Collapsed;
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarPadding()
|
||||
@@ -103,14 +98,73 @@ namespace CalculatorApp
|
||||
rightAddition = m_coreTitleBar->SystemOverlayLeftInset;
|
||||
}
|
||||
|
||||
auto padding = Thickness(leftAddition, 0, rightAddition, 0);
|
||||
|
||||
this->LayoutRoot->Margin = padding;
|
||||
this->LayoutRoot->Padding = Thickness(leftAddition, 0, rightAddition, 0);
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBar()
|
||||
void TitleBar::ColorValuesChanged(_In_ UISettings ^ /*sender*/, _In_ Object ^ /*e*/)
|
||||
{
|
||||
Window::Current->SetTitleBar(this->LayoutRoot);
|
||||
Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]() { SetTitleBarControlColors(); }));
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarControlColors()
|
||||
{
|
||||
auto applicationView = ApplicationView::GetForCurrentView();
|
||||
if (applicationView == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto applicationTitleBar = applicationView->TitleBar;
|
||||
if (applicationTitleBar == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_accessibilitySettings->HighContrast)
|
||||
{
|
||||
// Reset to use default colors.
|
||||
applicationTitleBar->ButtonBackgroundColor = nullptr;
|
||||
applicationTitleBar->ButtonForegroundColor = nullptr;
|
||||
applicationTitleBar->ButtonInactiveBackgroundColor = nullptr;
|
||||
applicationTitleBar->ButtonInactiveForegroundColor = nullptr;
|
||||
applicationTitleBar->ButtonHoverBackgroundColor = nullptr;
|
||||
applicationTitleBar->ButtonHoverForegroundColor = nullptr;
|
||||
applicationTitleBar->ButtonPressedBackgroundColor = nullptr;
|
||||
applicationTitleBar->ButtonPressedForegroundColor = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color bgColor = Colors::Transparent;
|
||||
Color fgColor = safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup("SystemControlPageTextBaseHighBrush"))->Color;
|
||||
Color inactivefgColor =
|
||||
safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup("SystemControlForegroundChromeDisabledLowBrush"))->Color;
|
||||
Color hoverbgColor = safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup("SystemControlBackgroundListLowBrush"))->Color;
|
||||
Color hoverfgColor = safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup("SystemControlForegroundBaseHighBrush"))->Color;
|
||||
Color pressedbgColor = safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup("SystemControlBackgroundListMediumBrush"))->Color;
|
||||
Color pressedfgCoolor = safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup("SystemControlForegroundBaseHighBrush"))->Color;
|
||||
applicationTitleBar->ButtonBackgroundColor = bgColor;
|
||||
applicationTitleBar->ButtonForegroundColor = fgColor;
|
||||
applicationTitleBar->ButtonInactiveBackgroundColor = bgColor;
|
||||
applicationTitleBar->ButtonInactiveForegroundColor = inactivefgColor;
|
||||
applicationTitleBar->ButtonHoverBackgroundColor = hoverbgColor;
|
||||
applicationTitleBar->ButtonHoverForegroundColor = hoverfgColor;
|
||||
applicationTitleBar->ButtonPressedBackgroundColor = pressedbgColor;
|
||||
applicationTitleBar->ButtonPressedForegroundColor = pressedfgCoolor;
|
||||
}
|
||||
}
|
||||
|
||||
void TitleBar::OnHighContrastChanged(_In_ AccessibilitySettings ^ /*sender*/, _In_ Object ^ /*args*/)
|
||||
{
|
||||
Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]() {
|
||||
SetTitleBarControlColors();
|
||||
SetTitleBarExtendView();
|
||||
SetTitleBarVisibility();
|
||||
}));
|
||||
}
|
||||
|
||||
void TitleBar::OnWindowActivated(_In_ Object ^ /*sender*/, _In_ WindowActivatedEventArgs ^ e)
|
||||
{
|
||||
VisualStateManager::GoToState(
|
||||
this, e->WindowActivationState == CoreWindowActivationState::Deactivated ? WindowNotFocused->Name : WindowFocused->Name, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
@@ -7,26 +7,37 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
public ref class TitleBar sealed
|
||||
/// <summary>
|
||||
/// Standalone control managing the title bar of the application.
|
||||
/// Display a transparent custom title bar when high-contrast is off and the native title bar when on.
|
||||
/// Automatically react to color changes, tablet mode, etc...
|
||||
/// </summary>
|
||||
public
|
||||
ref class TitleBar sealed
|
||||
{
|
||||
public:
|
||||
TitleBar();
|
||||
|
||||
void SetTitleBar();
|
||||
private:
|
||||
void OnLoaded(_In_ Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnUnloaded(_In_ Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnLoaded(_In_ Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnUnloaded(_In_ Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
void Initialize();
|
||||
void RegisterForLayoutChanged();
|
||||
void RegisterForVisibilityChanged();
|
||||
void SetTitleBarText(Platform::String^ text);
|
||||
void SetTitleBarHeight(double height);
|
||||
void SetTitleBarVisibility(bool isVisible);
|
||||
void SetTitleBarText(Platform::String ^ text);
|
||||
void SetTitleBarVisibility();
|
||||
void SetTitleBarPadding();
|
||||
void SetTitleBarControlColors();
|
||||
void SetTitleBarExtendView();
|
||||
void ColorValuesChanged(_In_ Windows::UI::ViewManagement::UISettings ^ sender, _In_ Platform::Object ^ e);
|
||||
void OnHighContrastChanged(Windows::UI::ViewManagement::AccessibilitySettings ^ sender, Platform::Object ^ args);
|
||||
void OnWindowActivated(Platform::Object ^ sender, Windows::UI::Core::WindowActivatedEventArgs ^ e);
|
||||
|
||||
Platform::Agile<Windows::ApplicationModel::Core::CoreApplicationViewTitleBar^> m_coreTitleBar;
|
||||
Platform::Agile<Windows::ApplicationModel::Core::CoreApplicationViewTitleBar ^> m_coreTitleBar;
|
||||
Windows::Foundation::EventRegistrationToken m_layoutChangedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_visibilityChangedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_colorValuesChangedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_windowActivatedToken;
|
||||
Windows::Foundation::EventRegistrationToken m_accessibilitySettingsToken;
|
||||
Windows::UI::ViewManagement::UISettings ^ m_uiSettings;
|
||||
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -321,8 +321,6 @@
|
||||
Threshold="1"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="GutterTop.Height" Value="0.5*"/>
|
||||
<Setter Target="GutterBottom.Height" Value="0.5*"/>
|
||||
<Setter Target="GutterLeft.Width" Value="48"/>
|
||||
<Setter Target="GutterRight.Width" Value="48"/>
|
||||
<Setter Target="ColumnLeft.Width" Value="1*"/>
|
||||
@@ -355,10 +353,10 @@
|
||||
<Setter Target="CurrencySymbol2Block.Style" Value="{ThemeResource CurrencySymbolLargeStyle}"/>
|
||||
<Setter Target="Units1.Height" Value="44"/>
|
||||
<Setter Target="Units2.Height" Value="44"/>
|
||||
<Setter Target="converterNegateButton.FontSize" Value="24"/>
|
||||
<Setter Target="clearEntryButtonPos0.FontSize" Value="24"/>
|
||||
<Setter Target="backSpaceButtonSmall.FontSize" Value="24"/>
|
||||
<Setter Target="numberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle46}"/>
|
||||
<Setter Target="ConverterNegateButton.FontSize" Value="24"/>
|
||||
<Setter Target="ClearEntryButtonPos0.FontSize" Value="24"/>
|
||||
<Setter Target="BackSpaceButtonSmall.FontSize" Value="24"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle46}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Portrait">
|
||||
@@ -373,9 +371,9 @@
|
||||
<Setter Target="CurrencySymbol2Block.Style" Value="{ThemeResource CurrencySymbolLargeStyle}"/>
|
||||
<Setter Target="Units1.Height" Value="44"/>
|
||||
<Setter Target="Units2.Height" Value="44"/>
|
||||
<Setter Target="converterNegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearEntryButtonPos0.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="numberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
<Setter Target="ConverterNegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButtonPos0.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Wide640">
|
||||
@@ -389,10 +387,10 @@
|
||||
<Setter Target="CurrencySymbol2Block.Style" Value="{ThemeResource CurrencySymbolLargeStyle}"/>
|
||||
<Setter Target="Units1.Height" Value="44"/>
|
||||
<Setter Target="Units2.Height" Value="44"/>
|
||||
<Setter Target="converterNegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="clearEntryButtonPos0.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="backSpaceButtonSmall.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="numberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
<Setter Target="ConverterNegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButtonPos0.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="BackSpaceButtonSmall.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="MinSizeLayout">
|
||||
@@ -405,11 +403,11 @@
|
||||
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="clearEntryButtonPos0.Margin" Value="1"/>
|
||||
<Setter Target="backSpaceButtonSmall.Margin" Value="1"/>
|
||||
<Setter Target="converterNegateButton.Margin" Value="1"/>
|
||||
<Setter Target="ClearEntryButtonPos0.Margin" Value="1"/>
|
||||
<Setter Target="BackSpaceButtonSmall.Margin" Value="1"/>
|
||||
<Setter Target="ConverterNegateButton.Margin" Value="1"/>
|
||||
|
||||
<Setter Target="numberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle18}"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle18}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -476,9 +474,8 @@
|
||||
<Grid x:Name="Value1Container"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ValueContainerStyle}"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
Visibility="{x:Bind Model.IsCurrencyLoadingVisible, Mode=OneWay, Converter={StaticResource BooleanToVisibilityNegationConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -511,6 +508,7 @@
|
||||
<ComboBox x:Name="Units1"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ComboStyle}"
|
||||
AutomationProperties.AutomationId="Units1"
|
||||
AutomationProperties.Name="{x:Bind Model.Unit1AutomationName, Mode=OneWay}"
|
||||
@@ -528,9 +526,8 @@
|
||||
<Grid x:Name="Value2Container"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ValueContainerStyle}"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
Visibility="{x:Bind Model.IsCurrencyLoadingVisible, Mode=OneWay, Converter={StaticResource BooleanToVisibilityNegationConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -564,6 +561,7 @@
|
||||
<ComboBox x:Name="Units2"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ComboStyle}"
|
||||
AutomationProperties.AutomationId="Units2"
|
||||
AutomationProperties.Name="{x:Bind Model.Unit2AutomationName, Mode=OneWay}"
|
||||
@@ -581,8 +579,8 @@
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
MinHeight="48"
|
||||
Margin="12,0,6,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="12,0,6,0"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
VerticalAlignment="Top"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
SizeChanged="SupplementaryResultsPanelInGrid_SizeChanged"
|
||||
@@ -615,8 +613,7 @@
|
||||
x:Uid="RefreshButtonText"
|
||||
Foreground="{ThemeResource SystemControlHyperlinkBaseHighBrush}"
|
||||
Click="CurrencyRefreshButton_Click"/>
|
||||
<TextBlock Margin="0,7,0,0" Style="{ThemeResource CaptionTextBlockStyle}">
|
||||
<Run x:Name="Spacing" Text=" "/>
|
||||
<TextBlock Margin="3,7,0,0" Style="{ThemeResource CaptionTextBlockStyle}">
|
||||
<Run x:Name="CurrencySecondaryStatus"
|
||||
FontWeight="SemiBold"
|
||||
Text=""/>
|
||||
@@ -645,38 +642,34 @@
|
||||
<Grid x:Name="ConverterNumPad"
|
||||
Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,0,6"
|
||||
Margin="3,0,3,3"
|
||||
FlowDirection="LeftToRight"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<Grid.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</Grid.RenderTransform>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="GutterTop" Height="0"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition x:Name="GutterBottom" Height="0"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Uid="DisplayControls"
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
AutomationProperties.HeadingLevel="Level1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="clearEntryButtonPos0"
|
||||
<controls:CalculatorButton x:Name="ClearEntryButtonPos0"
|
||||
x:Uid="clearEntryButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
@@ -684,7 +677,7 @@
|
||||
ButtonId="Clear"
|
||||
Content="CE"
|
||||
TabIndex="7"/>
|
||||
<controls:CalculatorButton x:Name="backSpaceButtonSmall"
|
||||
<controls:CalculatorButton x:Name="BackSpaceButtonSmall"
|
||||
x:Uid="backSpaceButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
@@ -695,21 +688,21 @@
|
||||
TabIndex="8"/>
|
||||
</Grid>
|
||||
|
||||
<local:NumberPad x:Name="numberPad"
|
||||
<local:NumberPad x:Name="NumberPad"
|
||||
x:Uid="NumberPad"
|
||||
Grid.Row="2"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="4"
|
||||
Grid.Column="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
VerticalAlignment="Stretch"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
ButtonStyle="{StaticResource NumericButtonStyle24}"
|
||||
TabIndex="10"
|
||||
TabNavigation="Local"/>
|
||||
<controls:CalculatorButton x:Name="converterNegateButton"
|
||||
<controls:CalculatorButton x:Name="ConverterNegateButton"
|
||||
x:Uid="converterNegateButton"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
FontSize="16"
|
||||
ButtonId="Negate"
|
||||
|
||||
@@ -45,22 +45,17 @@ using namespace Windows::UI::ViewManagement;
|
||||
// There are 10,000 intervals in 1 ms.
|
||||
static const long long DURATION_500_MS = 10000 * 500;
|
||||
|
||||
UnitConverter::UnitConverter() :
|
||||
m_layoutDirection(::FlowDirection::LeftToRight),
|
||||
m_meteredConnectionOverride(false),
|
||||
m_isAnimationEnabled(false)
|
||||
UnitConverter::UnitConverter()
|
||||
: m_meteredConnectionOverride(false)
|
||||
, m_isAnimationEnabled(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(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::Escape);
|
||||
|
||||
m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection();
|
||||
if (m_layoutDirection == ::FlowDirection::RightToLeft)
|
||||
{
|
||||
Units1->HorizontalContentAlignment = ::HorizontalAlignment::Right;
|
||||
Units2->HorizontalContentAlignment = ::HorizontalAlignment::Right;
|
||||
}
|
||||
ClearEntryButtonPos0->SetValue(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::Escape);
|
||||
|
||||
// Is currency symbol preference set to right side
|
||||
bool preferRight = LocalizationSettings::GetInstance().GetCurrencySymbolPrecedence() == 0;
|
||||
@@ -75,16 +70,15 @@ UnitConverter::UnitConverter() :
|
||||
|
||||
InitializeOfflineStatusTextBlock();
|
||||
|
||||
m_resultsFlyout = static_cast<MenuFlyout^>(Resources->Lookup(L"CalculationResultContextMenu"));
|
||||
m_resultsFlyout = static_cast<MenuFlyout ^>(Resources->Lookup(L"CalculationResultContextMenu"));
|
||||
CopyMenuItem->Text = resLoader.GetResourceString(L"copyMenuItem");
|
||||
PasteMenuItem->Text = resLoader.GetResourceString(L"pasteMenuItem");
|
||||
}
|
||||
|
||||
void UnitConverter::OnPropertyChanged(_In_ Object^ sender, _In_ PropertyChangedEventArgs^ e)
|
||||
void UnitConverter::OnPropertyChanged(_In_ Object ^ sender, _In_ PropertyChangedEventArgs ^ e)
|
||||
{
|
||||
String^ propertyName = e->PropertyName;
|
||||
if (propertyName == UnitConverterViewModel::NetworkBehaviorPropertyName ||
|
||||
propertyName == UnitConverterViewModel::CurrencyDataLoadFailedPropertyName)
|
||||
String ^ propertyName = e->PropertyName;
|
||||
if (propertyName == UnitConverterViewModel::NetworkBehaviorPropertyName || propertyName == UnitConverterViewModel::CurrencyDataLoadFailedPropertyName)
|
||||
{
|
||||
OnNetworkBehaviorChanged();
|
||||
}
|
||||
@@ -170,7 +164,7 @@ void UnitConverter::SetFailedToRefreshStatus()
|
||||
void UnitConverter::InitializeOfflineStatusTextBlock()
|
||||
{
|
||||
auto resProvider = AppResourceProvider::GetInstance();
|
||||
std::wstring offlineStatusHyperlinkText = static_cast<String^>(resProvider.GetResourceString(L"OfflineStatusHyperlinkText"))->Data();
|
||||
std::wstring offlineStatusHyperlinkText = static_cast<String ^>(resProvider.GetResourceString(L"OfflineStatusHyperlinkText"))->Data();
|
||||
|
||||
// The resource string has the 'NetworkSettings' hyperlink wrapped with '%HL%'.
|
||||
// Break the string and assign pieces appropriately.
|
||||
@@ -193,10 +187,7 @@ void UnitConverter::InitializeOfflineStatusTextBlock()
|
||||
OfflineRunLink->Text = offlineStatusTextLink;
|
||||
OfflineRunAfterLink->Text = offlineStatusTextAfterHyperlink;
|
||||
|
||||
AutomationProperties::SetName(OfflineBlock,
|
||||
offlineStatusTextBeforeHyperlink + L" " +
|
||||
offlineStatusTextLink + L" " +
|
||||
offlineStatusTextAfterHyperlink);
|
||||
AutomationProperties::SetName(OfflineBlock, offlineStatusTextBeforeHyperlink + L" " + offlineStatusTextLink + L" " + offlineStatusTextAfterHyperlink);
|
||||
}
|
||||
|
||||
void UnitConverter::SetCurrencyTimestampFontWeight()
|
||||
@@ -211,7 +202,7 @@ void UnitConverter::SetCurrencyTimestampFontWeight()
|
||||
}
|
||||
}
|
||||
|
||||
void UnitConverter::OnValueKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
|
||||
void UnitConverter::OnValueKeyDown(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
if (e->Key == VirtualKey::Space)
|
||||
{
|
||||
@@ -219,10 +210,10 @@ void UnitConverter::OnValueKeyDown(Platform::Object^ sender, Windows::UI::Xaml::
|
||||
}
|
||||
}
|
||||
|
||||
void UnitConverter::OnContextRequested(UIElement^ sender, ContextRequestedEventArgs^ e)
|
||||
void UnitConverter::OnContextRequested(UIElement ^ sender, ContextRequestedEventArgs ^ e)
|
||||
{
|
||||
OnValueSelected(sender);
|
||||
auto requestedElement = safe_cast<FrameworkElement^>(sender);
|
||||
auto requestedElement = safe_cast<FrameworkElement ^>(sender);
|
||||
|
||||
PasteMenuItem->IsEnabled = CopyPasteManager::HasStringToPaste();
|
||||
|
||||
@@ -240,21 +231,20 @@ void UnitConverter::OnContextRequested(UIElement^ sender, ContextRequestedEventA
|
||||
e->Handled = true;
|
||||
}
|
||||
|
||||
void UnitConverter::OnContextCanceled(UIElement^ sender, RoutedEventArgs^ e)
|
||||
void UnitConverter::OnContextCanceled(UIElement ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
m_resultsFlyout->Hide();
|
||||
}
|
||||
|
||||
void UnitConverter::OnCopyMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void UnitConverter::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
auto calcResult = safe_cast<CalculationResult^>(m_resultsFlyout->Target);
|
||||
auto calcResult = safe_cast<CalculationResult ^>(m_resultsFlyout->Target);
|
||||
CopyPasteManager::CopyToClipboard(calcResult->GetRawDisplayValue());
|
||||
}
|
||||
|
||||
void UnitConverter::OnPasteMenuItemClicked(_In_ Object^ sender, _In_ RoutedEventArgs^ e)
|
||||
void UnitConverter::OnPasteMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
{
|
||||
CopyPasteManager::GetStringToPaste(Model->Mode, CategoryGroupType::Converter).then([this](String^ pastedString)
|
||||
{
|
||||
CopyPasteManager::GetStringToPaste(Model->Mode, CategoryGroupType::Converter).then([this](String ^ pastedString) {
|
||||
Model->OnPaste(pastedString, Model->Mode);
|
||||
});
|
||||
}
|
||||
@@ -267,34 +257,29 @@ void UnitConverter::AnimateConverter()
|
||||
}
|
||||
}
|
||||
|
||||
void UnitConverter::OnValueSelected(_In_ Platform::Object^ sender)
|
||||
void UnitConverter::OnValueSelected(_In_ Platform::Object ^ sender)
|
||||
{
|
||||
auto value = safe_cast<CalculationResult^>(sender);
|
||||
auto value = safe_cast<CalculationResult ^>(sender);
|
||||
// update the font size since the font is changed to bold
|
||||
value->UpdateTextState();
|
||||
safe_cast<UnitConverterViewModel^>(this->DataContext)->OnValueActivated(AsActivatable(value));
|
||||
safe_cast<UnitConverterViewModel ^>(this->DataContext)->OnValueActivated(AsActivatable(value));
|
||||
}
|
||||
|
||||
void UnitConverter::UpdateDropDownState(_In_ Platform::Object^ sender, _In_ Platform::Object^ e)
|
||||
void UnitConverter::UpdateDropDownState(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e)
|
||||
{
|
||||
safe_cast<UnitConverterViewModel^>(this->DataContext)->IsDropDownOpen = (Units1->IsDropDownOpen) || (Units2->IsDropDownOpen);
|
||||
safe_cast<UnitConverterViewModel ^>(this->DataContext)->IsDropDownOpen = (Units1->IsDropDownOpen) || (Units2->IsDropDownOpen);
|
||||
KeyboardShortcutManager::UpdateDropDownState((Units1->IsDropDownOpen) || (Units2->IsDropDownOpen));
|
||||
}
|
||||
|
||||
void UnitConverter::OnLoaded(_In_ Object^, _In_ RoutedEventArgs^)
|
||||
void UnitConverter::OnLoaded(_In_ Object ^, _In_ RoutedEventArgs ^)
|
||||
{
|
||||
}
|
||||
|
||||
void UnitConverter::SetDefaultFocus()
|
||||
{
|
||||
const std::vector<Control^> focusPrecedence = {
|
||||
Value1,
|
||||
CurrencyRefreshBlockControl,
|
||||
OfflineBlock,
|
||||
clearEntryButtonPos0
|
||||
};
|
||||
const std::vector<Control ^> focusPrecedence = { Value1, CurrencyRefreshBlockControl, OfflineBlock, ClearEntryButtonPos0 };
|
||||
|
||||
for (Control^ control : focusPrecedence)
|
||||
for (Control ^ control : focusPrecedence)
|
||||
{
|
||||
if (control->Focus(::FocusState::Programmatic))
|
||||
{
|
||||
@@ -303,7 +288,7 @@ void UnitConverter::SetDefaultFocus()
|
||||
}
|
||||
}
|
||||
|
||||
void UnitConverter::CurrencyRefreshButton_Click(_In_ Object^ /*sender*/, _In_ RoutedEventArgs^ /*e*/)
|
||||
void UnitConverter::CurrencyRefreshButton_Click(_In_ Object ^ /*sender*/, _In_ RoutedEventArgs ^ /*e*/)
|
||||
{
|
||||
if (Model->NetworkBehavior == NetworkAccessBehavior::OptIn)
|
||||
{
|
||||
@@ -313,17 +298,16 @@ void UnitConverter::CurrencyRefreshButton_Click(_In_ Object^ /*sender*/, _In_ Ro
|
||||
Model->RefreshCurrencyRatios();
|
||||
}
|
||||
|
||||
void UnitConverter::OnDataContextChanged(_In_ FrameworkElement^ sender, _In_ DataContextChangedEventArgs^ args)
|
||||
void UnitConverter::OnDataContextChanged(_In_ FrameworkElement ^ sender, _In_ DataContextChangedEventArgs ^ args)
|
||||
{
|
||||
Model->PropertyChanged -= m_propertyChangedToken;
|
||||
|
||||
m_propertyChangedToken =
|
||||
Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &UnitConverter::OnPropertyChanged);
|
||||
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &UnitConverter::OnPropertyChanged);
|
||||
|
||||
OnNetworkBehaviorChanged();
|
||||
}
|
||||
|
||||
void UnitConverter::Units1_IsEnabledChanged(Object^ sender, DependencyPropertyChangedEventArgs^ e)
|
||||
void UnitConverter::Units1_IsEnabledChanged(Object ^ sender, DependencyPropertyChangedEventArgs ^ e)
|
||||
{
|
||||
if ((Units1->Visibility == ::Visibility::Visible) && Units1->IsEnabled)
|
||||
{
|
||||
@@ -357,12 +341,12 @@ void UnitConverter::StartProgressRingWithDelay()
|
||||
|
||||
m_delayTimer = ref new DispatcherTimer();
|
||||
m_delayTimer->Interval = delay;
|
||||
m_delayTimer->Tick += ref new EventHandler<Object^>(this, &UnitConverter::OnDelayTimerTick);
|
||||
m_delayTimer->Tick += ref new EventHandler<Object ^>(this, &UnitConverter::OnDelayTimerTick);
|
||||
|
||||
m_delayTimer->Start();
|
||||
}
|
||||
|
||||
void UnitConverter::OnDelayTimerTick(Object^ /*sender*/, Object^ /*e*/)
|
||||
void UnitConverter::OnDelayTimerTick(Object ^ /*sender*/, Object ^ /*e*/)
|
||||
{
|
||||
CurrencyLoadingProgressRing->IsActive = true;
|
||||
m_delayTimer->Stop();
|
||||
@@ -379,8 +363,8 @@ void UnitConverter::HideProgressRing()
|
||||
}
|
||||
|
||||
// The function will make sure the UI will have enough space to display supplementary results and currency information
|
||||
void CalculatorApp::UnitConverter::SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e)
|
||||
void CalculatorApp::UnitConverter::SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e)
|
||||
{
|
||||
//We add 0.01 to be sure to not create an infinite loop with SizeChanged events cascading due to float approximation
|
||||
// We add 0.01 to be sure to not create an infinite loop with SizeChanged events cascading due to float approximation
|
||||
RowDltrUnits->MinHeight = max(48.0, e->NewSize.Height + 0.01);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// UnitConverter.xaml.h
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class UnitConverter sealed
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class UnitConverter sealed
|
||||
{
|
||||
public:
|
||||
UnitConverter();
|
||||
DEPENDENCY_PROPERTY_OWNER(UnitConverter);
|
||||
PROPERTY_R(Windows::UI::Xaml::HorizontalAlignment, FlowDirectionHorizontalAlignment);
|
||||
|
||||
void AnimateConverter();
|
||||
|
||||
@@ -43,20 +43,20 @@ namespace CalculatorApp
|
||||
void SetDefaultFocus();
|
||||
|
||||
private:
|
||||
void OnValueKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
|
||||
void OnContextRequested(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs^ e);
|
||||
void OnContextCanceled(Windows::UI::Xaml::UIElement^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnPasteMenuItemClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnValueSelected(_In_ Platform::Object^ sender);
|
||||
void UpdateDropDownState(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
||||
void OnLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void CurrencyRefreshButton_Click(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnValueKeyDown(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
|
||||
void OnContextRequested(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::ContextRequestedEventArgs ^ e);
|
||||
void OnContextCanceled(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnPasteMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnValueSelected(_In_ Platform::Object ^ sender);
|
||||
void UpdateDropDownState(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
void OnLoaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void CurrencyRefreshButton_Click(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
void OnPropertyChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e);
|
||||
void OnDataContextChanged(_In_ Windows::UI::Xaml::FrameworkElement^ sender, _In_ Windows::UI::Xaml::DataContextChangedEventArgs^ args);
|
||||
void OnPropertyChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
void OnDataContextChanged(_In_ Windows::UI::Xaml::FrameworkElement ^ sender, _In_ Windows::UI::Xaml::DataContextChangedEventArgs ^ args);
|
||||
void OnIsDisplayVisibleChanged();
|
||||
void Units1_IsEnabledChanged(Platform::Object^ sender, Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ e);
|
||||
void Units1_IsEnabledChanged(Platform::Object ^ sender, Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ e);
|
||||
|
||||
void OnNetworkBehaviorChanged();
|
||||
void OnNormalNetworkAccess();
|
||||
@@ -72,22 +72,22 @@ namespace CalculatorApp
|
||||
void SetCurrencyTimestampFontWeight();
|
||||
|
||||
void StartProgressRingWithDelay();
|
||||
void OnDelayTimerTick(Platform::Object^ sender, Platform::Object^ e);
|
||||
void OnDelayTimerTick(Platform::Object ^ sender, Platform::Object ^ e);
|
||||
void HideProgressRing();
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::FlowDirection m_layoutDirection;
|
||||
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||
Windows::UI::Xaml::Controls::MenuFlyout^ m_resultsFlyout;
|
||||
|
||||
Platform::String^ m_chargesMayApplyText;
|
||||
Platform::String^ m_failedToRefreshText;
|
||||
Windows::UI::Xaml::Controls::MenuFlyout ^ m_resultsFlyout;
|
||||
|
||||
Platform::String ^ m_chargesMayApplyText;
|
||||
Platform::String ^ m_failedToRefreshText;
|
||||
|
||||
bool m_meteredConnectionOverride;
|
||||
|
||||
Windows::UI::Xaml::DispatcherTimer^ m_delayTimer;
|
||||
Windows::UI::Xaml::DispatcherTimer ^ m_delayTimer;
|
||||
|
||||
bool m_isAnimationEnabled;
|
||||
void SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
|
||||
void SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user