bunch of dead ends in this
This commit is contained in:
parent
f49c3fca01
commit
3b8e7236ae
|
@ -6,7 +6,11 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "AdminWarningPlaceholder.h"
|
#include "AdminWarningPlaceholder.h"
|
||||||
#include "AdminWarningPlaceholder.g.cpp"
|
#include "AdminWarningPlaceholder.g.cpp"
|
||||||
|
#include <UIAutomationCore.h>
|
||||||
|
#include <LibraryResources.h>
|
||||||
|
|
||||||
using namespace winrt::Windows::UI::Xaml;
|
using namespace winrt::Windows::UI::Xaml;
|
||||||
|
using namespace winrt::Windows::UI::Xaml::Automation::Peers;
|
||||||
|
|
||||||
namespace winrt::TerminalApp::implementation
|
namespace winrt::TerminalApp::implementation
|
||||||
{
|
{
|
||||||
|
@ -22,19 +26,63 @@ namespace winrt::TerminalApp::implementation
|
||||||
{
|
{
|
||||||
RootGrid().Background(termControl.BackgroundBrush());
|
RootGrid().Background(termControl.BackgroundBrush());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_layoutUpdatedRevoker = RootGrid().LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
|
||||||
|
// Only let this succeed once.
|
||||||
|
_layoutUpdatedRevoker.revoke();
|
||||||
|
|
||||||
|
if (auto automationPeer{ FrameworkElementAutomationPeer::FromElement(ApproveCommandlineWarningTitle()) })
|
||||||
|
{
|
||||||
|
// automationPeer.try_as<FrameworkElementAutomationPeer>().RaiseStructureChangedEvent(Automation::Peers::AutomationStructureChangeType::ChildrenBulkAdded, ApproveCommandlineWarningPrefixTextBlock());
|
||||||
|
|
||||||
|
automationPeer.RaiseNotificationEvent(
|
||||||
|
AutomationNotificationKind::ActionCompleted,
|
||||||
|
AutomationNotificationProcessing::CurrentThenMostRecent,
|
||||||
|
L"Foo",
|
||||||
|
L"ApproveCommandlineWarningTitle" /* unique name for this notification category */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
CancelButton().Focus(FocusState::Programmatic);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
void AdminWarningPlaceholder::_primaryButtonClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
void AdminWarningPlaceholder::_primaryButtonClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||||
RoutedEventArgs const& e)
|
RoutedEventArgs const& e)
|
||||||
{
|
{
|
||||||
|
if (auto automationPeer{ FrameworkElementAutomationPeer::FromElement(PrimaryButton()) })
|
||||||
|
{
|
||||||
|
automationPeer.RaiseNotificationEvent(
|
||||||
|
AutomationNotificationKind::ActionCompleted,
|
||||||
|
AutomationNotificationProcessing::CurrentThenMostRecent,
|
||||||
|
L"PrimaryButton",
|
||||||
|
L"_primaryButtonClick" /* unique name for this notification category */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_PrimaryButtonClickedHandlers(*this, e);
|
_PrimaryButtonClickedHandlers(*this, e);
|
||||||
}
|
}
|
||||||
void AdminWarningPlaceholder::_cancelButtonClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
void AdminWarningPlaceholder::_cancelButtonClick(winrt::Windows::Foundation::IInspectable const& /*sender*/,
|
||||||
RoutedEventArgs const& e)
|
RoutedEventArgs const& e)
|
||||||
{
|
{
|
||||||
|
if (auto automationPeer{ FrameworkElementAutomationPeer::FromElement(CancelButton()) })
|
||||||
|
{
|
||||||
|
automationPeer.RaiseNotificationEvent(
|
||||||
|
AutomationNotificationKind::ActionCompleted,
|
||||||
|
AutomationNotificationProcessing::CurrentThenMostRecent,
|
||||||
|
L"CancelButton",
|
||||||
|
L"_cancelButtonClick" /* unique name for this notification category */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_CancelButtonClickedHandlers(*this, e);
|
_CancelButtonClickedHandlers(*this, e);
|
||||||
}
|
}
|
||||||
winrt::Windows::UI::Xaml::Controls::UserControl AdminWarningPlaceholder::Control()
|
winrt::Windows::UI::Xaml::Controls::UserControl AdminWarningPlaceholder::Control()
|
||||||
{
|
{
|
||||||
return _control;
|
return _control;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
winrt::hstring AdminWarningPlaceholder::ControlName() const
|
||||||
|
{
|
||||||
|
return RS_(L"AdminWarningPlaceholderControlName");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace winrt::TerminalApp::implementation
|
||||||
struct AdminWarningPlaceholder : AdminWarningPlaceholderT<AdminWarningPlaceholder>
|
struct AdminWarningPlaceholder : AdminWarningPlaceholderT<AdminWarningPlaceholder>
|
||||||
{
|
{
|
||||||
AdminWarningPlaceholder(const winrt::Microsoft::Terminal::Control::TermControl& control, const winrt::hstring& cmdline);
|
AdminWarningPlaceholder(const winrt::Microsoft::Terminal::Control::TermControl& control, const winrt::hstring& cmdline);
|
||||||
|
winrt::hstring ControlName() const;
|
||||||
winrt::Windows::UI::Xaml::Controls::UserControl Control();
|
winrt::Windows::UI::Xaml::Controls::UserControl Control();
|
||||||
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
|
||||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Commandline, _PropertyChangedHandlers);
|
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Commandline, _PropertyChangedHandlers);
|
||||||
|
@ -27,5 +27,7 @@ namespace winrt::TerminalApp::implementation
|
||||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||||
void _cancelButtonClick(winrt::Windows::Foundation::IInspectable const& sender,
|
void _cancelButtonClick(winrt::Windows::Foundation::IInspectable const& sender,
|
||||||
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
winrt::Windows::UI::Xaml::RoutedEventArgs const& e);
|
||||||
|
|
||||||
|
winrt::Windows::UI::Xaml::Controls::Grid::LayoutUpdated_revoker _layoutUpdatedRevoker;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,6 @@ namespace TerminalApp
|
||||||
Windows.UI.Xaml.Data.INotifyPropertyChanged
|
Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
String Commandline { get; };
|
String Commandline { get; };
|
||||||
|
String ControlName { get; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
xmlns:local="using:TerminalApp"
|
xmlns:local="using:TerminalApp"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
|
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
|
||||||
|
AutomationProperties.Name="{x:Bind ControlName, Mode=OneWay}"
|
||||||
|
IsTabStop="True"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
@ -33,6 +35,7 @@
|
||||||
CornerRadius="{ThemeResource OverlayCornerRadius}">
|
CornerRadius="{ThemeResource OverlayCornerRadius}">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock x:Uid="ApproveCommandlineWarningTitle"
|
<TextBlock x:Uid="ApproveCommandlineWarningTitle"
|
||||||
|
x:Name="ApproveCommandlineWarningTitle"
|
||||||
Padding="0,0,0,16"
|
Padding="0,0,0,16"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
FontSize="20"
|
FontSize="20"
|
||||||
|
@ -40,6 +43,7 @@
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
|
|
||||||
<TextBlock x:Uid="ApproveCommandlineWarningPrefixTextBlock"
|
<TextBlock x:Uid="ApproveCommandlineWarningPrefixTextBlock"
|
||||||
|
x:Name="ApproveCommandlineWarningPrefixTextBlock"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
|
|
||||||
|
@ -57,11 +61,13 @@
|
||||||
<Button x:Name="PrimaryButton"
|
<Button x:Name="PrimaryButton"
|
||||||
x:Uid="ApproveCommandlineWarning_PrimaryButton"
|
x:Uid="ApproveCommandlineWarning_PrimaryButton"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
|
IsTabStop="True"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="_primaryButtonClick"
|
Click="_primaryButtonClick"
|
||||||
Style="{StaticResource AccentButtonStyle}" />
|
Style="{StaticResource AccentButtonStyle}" />
|
||||||
<Button x:Name="CancelButton"
|
<Button x:Name="CancelButton"
|
||||||
x:Uid="ApproveCommandlineWarning_CancelButton"
|
x:Uid="ApproveCommandlineWarning_CancelButton"
|
||||||
|
IsTabStop="True"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Click="_cancelButtonClick" />
|
Click="_cancelButtonClick" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -564,6 +564,9 @@
|
||||||
<value>Enter a wt commandline to run</value>
|
<value>Enter a wt commandline to run</value>
|
||||||
<comment>{Locked="wt"} </comment>
|
<comment>{Locked="wt"} </comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AdminWarningPlaceholderControlName" xml:space="preserve">
|
||||||
|
<value>Admin Warning Dialog</value>
|
||||||
|
</data>
|
||||||
<data name="CrimsonColorButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
<data name="CrimsonColorButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||||
<value>Crimson</value>
|
<value>Crimson</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -1616,7 +1616,7 @@ namespace winrt::TerminalApp::implementation
|
||||||
{
|
{
|
||||||
// NOTE: For debugging purposes, changing this to `true || IsElevated()`
|
// NOTE: For debugging purposes, changing this to `true || IsElevated()`
|
||||||
// is a handy way of forcing the elevation logic, even when unelevated.
|
// is a handy way of forcing the elevation logic, even when unelevated.
|
||||||
if (IsElevated())
|
if (true || IsElevated())
|
||||||
{
|
{
|
||||||
// If the cmdline is EXACTLY an executable in
|
// If the cmdline is EXACTLY an executable in
|
||||||
// `C:\WINDOWS\System32`, then ignore this check.
|
// `C:\WINDOWS\System32`, then ignore this check.
|
||||||
|
|
Loading…
Reference in a new issue