mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Register the events in the XAML, not the CS file
This commit is contained in:
parent
ac66736294
commit
cdaaddd6b9
2 changed files with 2 additions and 9 deletions
|
@ -690,6 +690,7 @@
|
||||||
<Flyout x:Name="HistoryFlyout"
|
<Flyout x:Name="HistoryFlyout"
|
||||||
AutomationProperties.AutomationId="HistoryFlyout"
|
AutomationProperties.AutomationId="HistoryFlyout"
|
||||||
Closed="HistoryFlyout_Closed"
|
Closed="HistoryFlyout_Closed"
|
||||||
|
Closing="HistoryFlyout_Closing"
|
||||||
FlyoutPresenterStyle="{StaticResource HistoryFlyoutStyle}"
|
FlyoutPresenterStyle="{StaticResource HistoryFlyoutStyle}"
|
||||||
Opened="HistoryFlyout_Opened"
|
Opened="HistoryFlyout_Opened"
|
||||||
Placement="Full"/>
|
Placement="Full"/>
|
||||||
|
@ -788,6 +789,7 @@
|
||||||
x:Uid="MemoryFlyout"
|
x:Uid="MemoryFlyout"
|
||||||
AutomationProperties.AutomationId="MemoryFlyout"
|
AutomationProperties.AutomationId="MemoryFlyout"
|
||||||
Closed="OnMemoryFlyoutClosed"
|
Closed="OnMemoryFlyoutClosed"
|
||||||
|
Closing="OnMemoryFlyoutClosing"
|
||||||
FlyoutPresenterStyle="{StaticResource MemoryFlyoutStyle}"
|
FlyoutPresenterStyle="{StaticResource MemoryFlyoutStyle}"
|
||||||
Opened="OnMemoryFlyoutOpened"
|
Opened="OnMemoryFlyoutOpened"
|
||||||
Placement="Full"/>
|
Placement="Full"/>
|
||||||
|
|
|
@ -225,9 +225,6 @@ namespace CalculatorApp
|
||||||
string memoryPaneName = AppResourceProvider.GetInstance().GetResourceString("MemoryPane");
|
string memoryPaneName = AppResourceProvider.GetInstance().GetResourceString("MemoryPane");
|
||||||
MemoryFlyout.FlyoutPresenterStyle.Setters.Add(new Setter(AutomationProperties.NameProperty, memoryPaneName));
|
MemoryFlyout.FlyoutPresenterStyle.Setters.Add(new Setter(AutomationProperties.NameProperty, memoryPaneName));
|
||||||
|
|
||||||
HistoryFlyout.Closing += HistoryFlyout_Closing;
|
|
||||||
MemoryFlyout.Closing += OnMemoryFlyoutClosing;
|
|
||||||
|
|
||||||
// Delay load things later when we get a chance.
|
// Delay load things later when we get a chance.
|
||||||
WeakReference weakThis = new WeakReference(this);
|
WeakReference weakThis = new WeakReference(this);
|
||||||
_ = this.Dispatcher.RunAsync(
|
_ = this.Dispatcher.RunAsync(
|
||||||
|
@ -647,9 +644,6 @@ namespace CalculatorApp
|
||||||
|
|
||||||
private void HistoryFlyout_Closed(object sender, object args)
|
private void HistoryFlyout_Closed(object sender, 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.
|
|
||||||
AutomationProperties.SetName(HistoryButton, m_openHistoryFlyoutAutomationName);
|
|
||||||
m_fIsHistoryFlyoutOpen = false;
|
m_fIsHistoryFlyoutOpen = false;
|
||||||
EnableControls(true);
|
EnableControls(true);
|
||||||
if (HistoryButton.IsEnabled && HistoryButton.Visibility == Visibility.Visible)
|
if (HistoryButton.IsEnabled && HistoryButton.Visibility == Visibility.Visible)
|
||||||
|
@ -742,9 +736,6 @@ namespace CalculatorApp
|
||||||
|
|
||||||
private void OnMemoryFlyoutClosed(object sender, object args)
|
private void OnMemoryFlyoutClosed(object sender, 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.
|
|
||||||
AutomationProperties.SetName(MemoryButton, m_openMemoryFlyoutAutomationName);
|
|
||||||
m_fIsMemoryFlyoutOpen = false;
|
m_fIsMemoryFlyoutOpen = false;
|
||||||
EnableControls(true);
|
EnableControls(true);
|
||||||
if (MemoryButton.IsEnabled)
|
if (MemoryButton.IsEnabled)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue