Add a success dialog to window renaming (#9808)
I added a `RenameSucceededText` property to the `TerminalPage` which returns the formatted message `Successfully renamed window to "{WindowNameForDisplay()}"` This _doesn't_ pop the dialog when you `wt -w foo` for the first time. Only _subsequent_ renames. ## References * Added in #9662 * Closes #9804
This commit is contained in:
parent
cf8ac0eb07
commit
aa54de1d64
|
@ -2607,12 +2607,32 @@ namespace winrt::TerminalApp::implementation
|
|||
{
|
||||
return _WindowName;
|
||||
}
|
||||
void TerminalPage::WindowName(const winrt::hstring& value)
|
||||
|
||||
winrt::fire_and_forget TerminalPage::WindowName(const winrt::hstring& value)
|
||||
{
|
||||
if (_WindowName != value)
|
||||
const bool changed = _WindowName != value;
|
||||
if (changed)
|
||||
{
|
||||
_WindowName = value;
|
||||
_PropertyChangedHandlers(*this, WUX::Data::PropertyChangedEventArgs{ L"WindowNameForDisplay" });
|
||||
}
|
||||
auto weakThis{ get_weak() };
|
||||
// On the foreground thread, raise property changed notifications, and
|
||||
// display the success toast.
|
||||
co_await resume_foreground(Dispatcher());
|
||||
if (auto page{ weakThis.get() })
|
||||
{
|
||||
if (changed)
|
||||
{
|
||||
page->_PropertyChangedHandlers(*this, WUX::Data::PropertyChangedEventArgs{ L"WindowName" });
|
||||
page->_PropertyChangedHandlers(*this, WUX::Data::PropertyChangedEventArgs{ L"WindowNameForDisplay" });
|
||||
|
||||
// DON'T display the confirmation if this is the name we were
|
||||
// given on startup!
|
||||
if (page->_startupState == StartupState::Initialized)
|
||||
{
|
||||
page->IdentifyWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace winrt::TerminalApp::implementation
|
|||
// WINRT_OBSERVABLE_PROPERTY's, but we want them to raise
|
||||
// WindowNameForDisplay and WindowIdForDisplay instead
|
||||
winrt::hstring WindowName() const noexcept;
|
||||
void WindowName(const winrt::hstring& value);
|
||||
winrt::fire_and_forget WindowName(const winrt::hstring& value);
|
||||
uint64_t WindowId() const noexcept;
|
||||
void WindowId(const uint64_t& value);
|
||||
winrt::hstring WindowIdForDisplay() const noexcept;
|
||||
|
|
Loading…
Reference in a new issue