mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
PowerRename cleanup (#19849)
This commit is contained in:
@@ -29,8 +29,6 @@ using namespace winrt;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace winrt::Microsoft::Windows::ApplicationModel::Resources;
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
// Non-localizable
|
||||
const std::wstring PowerRenameUIIco = L"PowerRenameUI.ico";
|
||||
const wchar_t c_WindowClass[] = L"PowerRename";
|
||||
@@ -52,7 +50,7 @@ void handleTheme() {
|
||||
namespace winrt::PowerRenameUI::implementation
|
||||
{
|
||||
MainWindow::MainWindow() :
|
||||
m_instance{ nullptr }, m_allSelected{ true }, m_managerEvents{ this }
|
||||
m_allSelected{ true }, m_managerEvents{ this }
|
||||
{
|
||||
auto windowNative{ this->try_as<::IWindowNative>() };
|
||||
winrt::check_bool(windowNative);
|
||||
@@ -199,6 +197,36 @@ namespace winrt::PowerRenameUI::implementation
|
||||
SearchReplaceChanged();
|
||||
}
|
||||
|
||||
winrt::event_token MainWindow::PropertyChanged(Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
|
||||
{
|
||||
return m_propertyChanged.add(handler);
|
||||
}
|
||||
|
||||
void MainWindow::PropertyChanged(winrt::event_token const& token) noexcept
|
||||
{
|
||||
m_propertyChanged.remove(token);
|
||||
}
|
||||
|
||||
hstring MainWindow::OriginalCount()
|
||||
{
|
||||
return hstring{ std::to_wstring(m_explorerItems.Size()) };
|
||||
}
|
||||
|
||||
void MainWindow::OriginalCount(hstring)
|
||||
{
|
||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"OriginalCount" });
|
||||
}
|
||||
|
||||
hstring MainWindow::RenamedCount()
|
||||
{
|
||||
return hstring{ std::to_wstring(m_renamingCount) };
|
||||
}
|
||||
|
||||
void MainWindow::RenamedCount(hstring)
|
||||
{
|
||||
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"RenamedCount" });
|
||||
}
|
||||
|
||||
void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked)
|
||||
{
|
||||
auto newItem = winrt::make<PowerRenameUI::implementation::ExplorerItem>(id, original, renamed, type, depth, checked);
|
||||
@@ -234,16 +262,6 @@ namespace winrt::PowerRenameUI::implementation
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::AppendSearchMRU(hstring const& value)
|
||||
{
|
||||
m_searchMRUList.Append(value);
|
||||
}
|
||||
|
||||
void MainWindow::AppendReplaceMRU(hstring const& value)
|
||||
{
|
||||
m_replaceMRUList.Append(value);
|
||||
}
|
||||
|
||||
PowerRenameUI::ExplorerItem MainWindow::FindById(int32_t id)
|
||||
{
|
||||
return m_explorerItemsMap.contains(id) ? m_explorerItemsMap[id] : NULL;
|
||||
@@ -418,7 +436,7 @@ namespace winrt::PowerRenameUI::implementation
|
||||
{
|
||||
if (!item.empty())
|
||||
{
|
||||
AppendSearchMRU(hstring{ item });
|
||||
m_searchMRUList.Append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +450,7 @@ namespace winrt::PowerRenameUI::implementation
|
||||
{
|
||||
if (!item.empty())
|
||||
{
|
||||
AppendReplaceMRU(hstring{ item });
|
||||
m_replaceMRUList.Append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -950,8 +968,8 @@ namespace winrt::PowerRenameUI::implementation
|
||||
button_rename().IsEnabled(renamingCount > 0);
|
||||
}
|
||||
|
||||
m_uiUpdatesItem.OriginalCount(std::to_wstring(m_explorerItems.Size()));
|
||||
m_uiUpdatesItem.RenamedCount(std::to_wstring(m_renamingCount));
|
||||
OriginalCount(hstring{ std::to_wstring(m_explorerItems.Size()) });
|
||||
RenamedCount(hstring{ std::to_wstring(m_renamingCount) });
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnItemAdded(_In_ IPowerRenameItem* renameItem)
|
||||
@@ -1016,21 +1034,6 @@ namespace winrt::PowerRenameUI::implementation
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnError(_In_ IPowerRenameItem*)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnRegExStarted(_In_ DWORD)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnRegExCanceled(_In_ DWORD)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnRegExCompleted(_In_ DWORD)
|
||||
{
|
||||
_TRACER_;
|
||||
@@ -1054,11 +1057,6 @@ namespace winrt::PowerRenameUI::implementation
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnRenameStarted()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT MainWindow::OnRenameCompleted(bool closeUIWindowAfterRenaming)
|
||||
{
|
||||
_TRACER_;
|
||||
|
||||
Reference in New Issue
Block a user