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

Add a success dialog to window renaming #9808

Merged
5 commits merged into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 23 additions & 3 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2606,12 +2606,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
DHowett marked this conversation as resolved.
Show resolved Hide resolved
// given on startup!
if (page->_startupState == StartupState::Initialized)
{
page->IdentifyWindow();
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down