terminal/src/cascadia/TerminalApp/TerminalPage.xaml
Don-Vito a900ababdc
Teach info bars to be dismissed permanently (#11139)
## Summary of the Pull Request
* Introduces info bar shown upon session failure, 
that guides the user how to configure termination behavior
  * Allows this info bar to be dismissed permanently (choice stored in state) 
* Allows "keyboard service" info bar to be dismissed permanently

## PR Checklist
* [x] Closes #10798, #8699
* [x] CLA signed. 
* [ ] Tests added/passed
* [ ] Documentation updated. 
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already.

## Detailed Description of the Pull Request / Additional comments
UI:
* Introduce an additional info bar for "close on exit" configuration tip
  * Stack this bar after "keyboard service" bar
* Add "Don't show again" button to both bars

Dismiss Permanently:
* Introduce a set of "dismissed messages" to the Application State
* Add verification the message is not dismissed before showing an info bar
* "Don't show  again" persists the choice under "dismissed messages"

Wiring the Info Bar:
* Register `TerminalPage` on `TermControl`'s `ConnectionStateChanged` event
* Once event is triggered check whether the state is failure
* If so and the message was not dismissed permanently, show the info bar
2021-09-10 17:16:41 +00:00

176 lines
7.7 KiB
XML

<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="TerminalApp.TerminalPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid x:Name="Root"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<local:TabRowControl x:Name="TabRow"
Grid.Row="0" />
<Grid x:Name="TabContent"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
<ContentDialog x:Name="AboutDialog"
x:Uid="AboutDialog"
x:Load="False"
DefaultButton="Close">
<StackPanel Orientation="Vertical">
<TextBlock IsTextSelectionEnabled="True">
<Run Text="{x:Bind ApplicationDisplayName}" /> <LineBreak />
<Run x:Uid="AboutDialog_VersionLabel" />
<Run Text="{x:Bind ApplicationVersion}" />
</TextBlock>
<HyperlinkButton x:Uid="AboutDialog_DocumentationLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125416" />
<HyperlinkButton x:Uid="AboutDialog_ReleaseNotesLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125417" />
<HyperlinkButton x:Uid="AboutDialog_PrivacyPolicyLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125418" />
<HyperlinkButton x:Uid="AboutDialog_ThirdPartyNoticesLink"
Click="_ThirdPartyNoticesOnClick" />
</StackPanel>
</ContentDialog>
<ContentDialog x:Name="QuitDialog"
x:Uid="QuitDialog"
x:Load="False"
DefaultButton="Primary" />
<ContentDialog x:Name="CloseAllDialog"
x:Uid="CloseAllDialog"
x:Load="False"
DefaultButton="Primary" />
<ContentDialog x:Name="CloseReadOnlyDialog"
x:Uid="CloseReadOnlyDialog"
x:Load="False"
DefaultButton="Close" />
<ContentDialog x:Name="MultiLinePasteDialog"
x:Uid="MultiLinePasteDialog"
x:Load="False"
DefaultButton="Primary">
<StackPanel>
<TextBlock x:Uid="MultiLineWarningText"
TextWrapping="Wrap" />
<TextBlock x:Uid="ClipboardTextHeader"
Margin="0,16,0,0" />
<ScrollViewer x:Name="ClipboardContentScrollViewer"
MaxHeight="100"
Margin="0,8,0,0">
<TextBlock x:Name="ClipboardText"
FontFamily="Cascadia Mono"
TextWrapping="Wrap" />
</ScrollViewer>
</StackPanel>
</ContentDialog>
<ContentDialog x:Name="LargePasteDialog"
x:Uid="LargePasteDialog"
x:Load="False"
DefaultButton="Primary" />
<ContentDialog x:Name="ControlNoticeDialog"
x:Uid="ControlNoticeDialog"
x:Load="False"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords">
<Run x:Name="NoticeMessage" />
</TextBlock>
</ContentDialog>
<ContentDialog x:Name="CouldNotOpenUriDialog"
x:Uid="CouldNotOpenUriDialog"
x:Load="False"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords">
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak />
<Run x:Name="UnopenedUri"
FontFamily="Cascadia Mono" />
</TextBlock>
</ContentDialog>
<local:CommandPalette x:Name="CommandPalette"
Grid.Row="1"
VerticalAlignment="Stretch"
PreviewKeyDown="_KeyDownHandler"
Visibility="Collapsed" />
<StackPanel>
<mux:InfoBar x:Name="KeyboardServiceWarningInfoBar"
x:Load="False"
IsClosable="True"
IsIconVisible="True"
IsOpen="False"
Message="{x:Bind KeyboardServiceDisabledText, Mode=OneWay}"
Severity="Warning">
<mux:InfoBar.ActionButton>
<Button x:Uid="InfoBarDismissButton"
Click="_KeyboardServiceWarningInfoDismissHandler" />
</mux:InfoBar.ActionButton>
</mux:InfoBar>
<mux:InfoBar x:Name="CloseOnExitInfoBar"
x:Uid="CloseOnExitInfoBar"
x:Load="False"
IsClosable="True"
IsIconVisible="True"
IsOpen="False"
Severity="Informational">
<mux:InfoBar.ActionButton>
<Button x:Uid="InfoBarDismissButton"
Click="_CloseOnExitInfoDismissHandler" />
</mux:InfoBar.ActionButton>
</mux:InfoBar>
</StackPanel>
<!--
A TeachingTip with IsLightDismissEnabled="True" will immediately
dismiss itself if the window is unfocused (In Xaml Islands). This is
tracked by MUX#4382
-->
<mux:TeachingTip x:Name="WindowIdToast"
Title="{x:Bind WindowIdForDisplay}"
x:Load="False"
IsLightDismissEnabled="True"
Subtitle="{x:Bind WindowNameForDisplay, Mode=OneWay}" />
<mux:TeachingTip x:Name="RenameFailedToast"
x:Uid="RenameFailedToast"
x:Load="False"
IsLightDismissEnabled="True" />
<mux:TeachingTip x:Name="WindowRenamer"
x:Uid="WindowRenamer"
Title="{x:Bind WindowIdForDisplay}"
x:Load="False"
ActionButtonClick="_WindowRenamerActionClick"
ActionButtonStyle="{ThemeResource AccentButtonStyle}"
IsLightDismissEnabled="True">
<mux:TeachingTip.Content>
<TextBox x:Name="WindowRenamerTextBox"
KeyUp="_WindowRenamerKeyUp"
Text="{x:Bind WindowName, Mode=OneWay}" />
</mux:TeachingTip.Content>
</mux:TeachingTip>
</Grid>
</Page>