-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev/migrie/f/non-terminal-content-elevation-warning' in…
…to dev/migrie/f/632-on-warning-dialog
- Loading branch information
Showing
32 changed files
with
1,077 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
admins | ||
apc | ||
calt | ||
ccmp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#pragma once | ||
|
||
#include "pch.h" | ||
#include "AdminWarningPlaceholder.h" | ||
#include "AdminWarningPlaceholder.g.cpp" | ||
using namespace winrt::Windows::UI::Xaml; | ||
|
||
namespace winrt::TerminalApp::implementation | ||
{ | ||
AdminWarningPlaceholder::AdminWarningPlaceholder(const winrt::Microsoft::Terminal::Control::TermControl& control, const winrt::hstring& cmdline) : | ||
_control{ control }, | ||
_Commandline{ cmdline } | ||
{ | ||
InitializeComponent(); | ||
// If the content we're hosting is a TermControl, then use the control's | ||
// BG as our BG, to give the impression that it's there, under the | ||
// dialog. | ||
if (const auto termControl{ control.try_as<winrt::Microsoft::Terminal::Control::TermControl>() }) | ||
{ | ||
RootGrid().Background(termControl.BackgroundBrush()); | ||
} | ||
} | ||
void AdminWarningPlaceholder::_primaryButtonClick(winrt::Windows::Foundation::IInspectable const& /*sender*/, | ||
RoutedEventArgs const& e) | ||
{ | ||
_PrimaryButtonClickedHandlers(*this, e); | ||
} | ||
void AdminWarningPlaceholder::_cancelButtonClick(winrt::Windows::Foundation::IInspectable const& /*sender*/, | ||
RoutedEventArgs const& e) | ||
{ | ||
_CancelButtonClickedHandlers(*this, e); | ||
} | ||
winrt::Windows::UI::Xaml::Controls::UserControl AdminWarningPlaceholder::Control() | ||
{ | ||
return _control; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#pragma once | ||
|
||
#include "AdminWarningPlaceholder.g.h" | ||
#include "../../cascadia/inc/cppwinrt_utils.h" | ||
|
||
namespace winrt::TerminalApp::implementation | ||
{ | ||
struct AdminWarningPlaceholder : AdminWarningPlaceholderT<AdminWarningPlaceholder> | ||
{ | ||
AdminWarningPlaceholder(const winrt::Microsoft::Terminal::Control::TermControl& control, const winrt::hstring& cmdline); | ||
|
||
winrt::Windows::UI::Xaml::Controls::UserControl Control(); | ||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); | ||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Commandline, _PropertyChangedHandlers); | ||
TYPED_EVENT(PrimaryButtonClicked, TerminalApp::AdminWarningPlaceholder, winrt::Windows::UI::Xaml::RoutedEventArgs); | ||
TYPED_EVENT(CancelButtonClicked, TerminalApp::AdminWarningPlaceholder, winrt::Windows::UI::Xaml::RoutedEventArgs); | ||
|
||
private: | ||
friend struct AdminWarningPlaceholderT<AdminWarningPlaceholder>; // friend our parent so it can bind private event handlers | ||
|
||
winrt::Microsoft::Terminal::Control::TermControl _control{ nullptr }; | ||
|
||
void _primaryButtonClick(winrt::Windows::Foundation::IInspectable const& sender, | ||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e); | ||
void _cancelButtonClick(winrt::Windows::Foundation::IInspectable const& sender, | ||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
namespace TerminalApp | ||
{ | ||
[default_interface] runtimeclass AdminWarningPlaceholder : Windows.UI.Xaml.Controls.UserControl, | ||
Windows.UI.Xaml.Data.INotifyPropertyChanged | ||
{ | ||
String Commandline { get; }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!-- | ||
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under | ||
the MIT License. See LICENSE in the project root for license information. | ||
--> | ||
<UserControl x:Class="TerminalApp.AdminWarningPlaceholder" | ||
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"> | ||
|
||
<!-- | ||
We have to use two grids to be tricky here: | ||
- The outer grid will get its background from the control it hosts, and | ||
expands to fit its container. This will make it look like the background | ||
fills the space available. | ||
- The inner grid is set to Center,Center, so that the "dialog" appears | ||
centered | ||
--> | ||
|
||
<Grid x:Name="RootGrid" | ||
HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch"> | ||
<Grid HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Border Margin="8,8,8,8" | ||
Padding="16,8,16,8" | ||
Background="{ThemeResource SystemControlBackgroundAltHighBrush}" | ||
BorderBrush="{ThemeResource SystemAccentColor}" | ||
BorderThickness="2,2,2,2" | ||
CornerRadius="{ThemeResource OverlayCornerRadius}"> | ||
<StackPanel Orientation="Vertical"> | ||
<TextBlock x:Uid="ApproveCommandlineWarningTitle" | ||
Padding="0,0,0,16" | ||
HorizontalAlignment="Left" | ||
FontSize="20" | ||
FontWeight="Normal" | ||
TextWrapping="WrapWholeWords" /> | ||
|
||
<TextBlock x:Uid="ApproveCommandlineWarningPrefixTextBlock" | ||
HorizontalAlignment="Left" | ||
TextWrapping="WrapWholeWords" /> | ||
|
||
<TextBlock Margin="0,8,0,8" | ||
HorizontalAlignment="Center" | ||
FontFamily="Cascadia Code" | ||
Text="{x:Bind Commandline, Mode=OneWay}" | ||
TextWrapping="WrapWholeWords" /> | ||
|
||
<TextBlock x:Uid="ApproveCommandlineWarningSuffixTextBlock" | ||
HorizontalAlignment="Left" | ||
TextWrapping="WrapWholeWords" /> | ||
<StackPanel HorizontalAlignment="Right" | ||
Orientation="Horizontal"> | ||
<Button x:Name="PrimaryButton" | ||
x:Uid="ApproveCommandlineWarning_PrimaryButton" | ||
Margin="8" | ||
HorizontalAlignment="Right" | ||
Click="_primaryButtonClick" | ||
Style="{StaticResource AccentButtonStyle}" /> | ||
<Button x:Name="CancelButton" | ||
x:Uid="ApproveCommandlineWarning_CancelButton" | ||
HorizontalAlignment="Right" | ||
Click="_cancelButtonClick" /> | ||
</StackPanel> | ||
</StackPanel> | ||
</Border> | ||
</Grid> | ||
</Grid> | ||
|
||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.