Modify how we manage the visibility of the history button (#821)
* Modify how we manage the visibility of the history button * rename function
This commit is contained in:
		@@ -454,7 +454,6 @@
 | 
				
			|||||||
                        <Setter Target="M5.MaxWidth" Value="80"/>
 | 
					                        <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="MemoryButton.(Grid.Column)" Value="6"/>
 | 
				
			||||||
                        <Setter Target="HistoryButton.Visibility" Value="Collapsed"/>
 | 
					 | 
				
			||||||
                    </VisualState.Setters>
 | 
					                    </VisualState.Setters>
 | 
				
			||||||
                    <Storyboard Completed="OnModeVisualStateCompleted"/>
 | 
					                    <Storyboard Completed="OnModeVisualStateCompleted"/>
 | 
				
			||||||
                </VisualState>
 | 
					                </VisualState>
 | 
				
			||||||
@@ -491,7 +490,6 @@
 | 
				
			|||||||
                        <Setter Target="ColumnMain.Width" Value="320*"/>
 | 
					                        <Setter Target="ColumnMain.Width" Value="320*"/>
 | 
				
			||||||
                        <Setter Target="ColumnHistory.Width" Value="240*"/>
 | 
					                        <Setter Target="ColumnHistory.Width" Value="240*"/>
 | 
				
			||||||
                        <Setter Target="DockPanel.Visibility" Value="Visible"/>
 | 
					                        <Setter Target="DockPanel.Visibility" Value="Visible"/>
 | 
				
			||||||
                        <Setter Target="HistoryButton.Visibility" Value="Collapsed"/>
 | 
					 | 
				
			||||||
                        <Setter Target="M6.Width" Value="0"/>
 | 
					                        <Setter Target="M6.Width" Value="0"/>
 | 
				
			||||||
                    </VisualState.Setters>
 | 
					                    </VisualState.Setters>
 | 
				
			||||||
                    <Storyboard Completed="OnLayoutVisualStateCompleted"/>
 | 
					                    <Storyboard Completed="OnLayoutVisualStateCompleted"/>
 | 
				
			||||||
@@ -657,7 +655,6 @@
 | 
				
			|||||||
                                                    IsEnabled="{x:Bind Model.IsProgrammer, Mode=OneWay}"
 | 
					                                                    IsEnabled="{x:Bind Model.IsProgrammer, Mode=OneWay}"
 | 
				
			||||||
                                                    x:Load="False"/>
 | 
					                                                    x:Load="False"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <Grid x:Name="HistoryButtonParent" Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}">
 | 
					 | 
				
			||||||
            <Button x:Name="HistoryButton"
 | 
					            <Button x:Name="HistoryButton"
 | 
				
			||||||
                    x:Uid="HistoryButton"
 | 
					                    x:Uid="HistoryButton"
 | 
				
			||||||
                    Grid.Row="0"
 | 
					                    Grid.Row="0"
 | 
				
			||||||
@@ -667,6 +664,7 @@
 | 
				
			|||||||
                    Content=""
 | 
					                    Content=""
 | 
				
			||||||
                    ExitDisplayModeOnAccessKeyInvoked="False"
 | 
					                    ExitDisplayModeOnAccessKeyInvoked="False"
 | 
				
			||||||
                    TabIndex="2"
 | 
					                    TabIndex="2"
 | 
				
			||||||
 | 
					                    Visibility="{x:Bind local:Calculator.ShouldDisplayHistoryButton(Model.IsAlwaysOnTop, Model.IsProgrammer, DockPanel.Visibility), Mode=OneWay}"
 | 
				
			||||||
                    IsEnabled="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}">
 | 
					                    IsEnabled="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}">
 | 
				
			||||||
                <FlyoutBase.AttachedFlyout>
 | 
					                <FlyoutBase.AttachedFlyout>
 | 
				
			||||||
                    <Flyout x:Name="HistoryFlyout"
 | 
					                    <Flyout x:Name="HistoryFlyout"
 | 
				
			||||||
@@ -677,7 +675,6 @@
 | 
				
			|||||||
                            Placement="Full"/>
 | 
					                            Placement="Full"/>
 | 
				
			||||||
                </FlyoutBase.AttachedFlyout>
 | 
					                </FlyoutBase.AttachedFlyout>
 | 
				
			||||||
            </Button>
 | 
					            </Button>
 | 
				
			||||||
            </Grid>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <!-- Scientific angle buttons -->
 | 
					            <!-- Scientific angle buttons -->
 | 
				
			||||||
            <local:CalculatorScientificAngleButtons x:Name="ScientificAngleButtons"
 | 
					            <local:CalculatorScientificAngleButtons x:Name="ScientificAngleButtons"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -714,3 +714,7 @@ void Calculator::Calculator_SizeChanged(Object ^ /*sender*/, SizeChangedEventArg
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					::Visibility Calculator::ShouldDisplayHistoryButton(bool isAlwaysOnTop, bool isProgrammer, ::Visibility dockPanelVisibility)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return !isAlwaysOnTop && !isProgrammer && dockPanelVisibility == ::Visibility::Collapsed ? ::Visibility::Visible : ::Visibility::Collapsed;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,6 +69,9 @@ public
 | 
				
			|||||||
        void CloseMemoryFlyout();
 | 
					        void CloseMemoryFlyout();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void SetDefaultFocus();
 | 
					        void SetDefaultFocus();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Methods used by native bindings
 | 
				
			||||||
 | 
					        static Windows::UI::Xaml::Visibility ShouldDisplayHistoryButton(bool isAlwaysOnTop, bool isProgrammer, Windows::UI::Xaml::Visibility dockPanelVisibility);
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
        void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
 | 
					        void OnLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -143,5 +146,6 @@ public
 | 
				
			|||||||
        void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args);
 | 
					        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 OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args);
 | 
				
			||||||
        void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e);
 | 
					        void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   };
 | 
					   };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user