Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open up content dialogs for invalid URIs and unsupported schemes #7523

Merged
merged 7 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,18 @@
<data name="InvalidLinkDialog.PrimaryButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="UnopenedUriText" xml:space="preserve">
<value>{}</value>
<comment> {} will be replaced with the URI we could not open or parse </comment>
</data>
PankajBhojwani marked this conversation as resolved.
Show resolved Hide resolved
<data name="UnsupportedSchemeContent" xml:space="preserve">
<value>The scheme "{0}" is not supported. </value>
PankajBhojwani marked this conversation as resolved.
Show resolved Hide resolved
<comment>{0} will be replaced with the scheme the user is trying to use.</comment>
</data>
<data name="UnsupportedSchemeDialog.PrimaryButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="UnsupportedSchemeText.Text" xml:space="preserve">
<value>This link type is currently not supported.</value>
</data>
</root>
13 changes: 7 additions & 6 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1807,14 +1807,15 @@ namespace winrt::TerminalApp::implementation
}
else if (auto presenter{ _dialogPresenter.get() })
{
// FindName needs to be called first to actually load the xaml object
// FindName needs to be called first to actually load the xaml objects
auto unsupportedSchemeDialog = FindName(L"UnsupportedSchemeDialog").try_as<WUX::Controls::ContentDialog>();
auto unopenedUri = FindName(L"UnopenedUri").try_as<Windows::UI::Xaml::Documents::Run>();

// Set the content
const auto errorMsg = fmt::format(std::wstring_view{ RS_(L"UnsupportedSchemeContent") },
parsed.SchemeName());
unsupportedSchemeDialog.Content(winrt::box_value(errorMsg));

// Insert the URI
const auto uriMsg = fmt::format(std::wstring_view{ RS_(L"UnopenedUriText") },
eventArgs.Uri().c_str());
unopenedUri.Text(uriMsg);
// Show the dialog
presenter.ShowDialog(unsupportedSchemeDialog);
}
Expand Down
7 changes: 7 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ the MIT License. See LICENSE in the project root for license information. -->
x:Name="UnsupportedSchemeDialog"
x:Uid="UnsupportedSchemeDialog"
DefaultButton="Primary">
<TextBlock IsTextSelectionEnabled="True">
<Run x:Uid="UnsupportedSchemeText" /> <LineBreak />
<Run
x:Name="UnopenedUri"
FontFamily="Cascadia Mono">
</Run>
</TextBlock>
</ContentDialog>

<ContentDialog
Expand Down