[PowerRename] Tweak UI and fix performance issues (#14365)

* Init

* Update MainWindow.xaml

* Add identation

* Remove template selector

* Vertical UI

* Update PowerRenameUILib.vcxproj

* Revert "Vertical UI"

This reverts commit d0b3d264fb.

* Revert "Update PowerRenameUILib.vcxproj"

This reverts commit ba18503db2.

* Tweaks to margins

* Updated tweaks

* Update MainWindow.xaml

* Wire counters

* Improve perf: Constant O(1) find-item-by-id time instead of O(n)

Co-authored-by: Laute <Niels.Laute@philips.com>
This commit is contained in:
Stefan Markovic
2021-11-17 10:57:22 +01:00
committed by GitHub
parent c934127d84
commit 5a4822f89e
15 changed files with 243 additions and 347 deletions

View File

@@ -134,6 +134,7 @@ bool AppWindow::OnCreate(HWND, LPCREATESTRUCT) noexcept
try try
{ {
PopulateExplorerItems(); PopulateExplorerItems();
UpdateCounts();
SetHandlers(); SetHandlers();
ReadSettings(); ReadSettings();
} }
@@ -246,11 +247,6 @@ void AppWindow::PopulateExplorerItems()
m_prManager->GetVisibleItemCount(&count); m_prManager->GetVisibleItemCount(&count);
Logger::debug(L"Number of visible items: {}", count); Logger::debug(L"Number of visible items: {}", count);
UINT currDepth = 0;
std::stack<UINT> parents{};
UINT prevId = 0;
parents.push(0);
for (UINT i = 0; i < count; ++i) for (UINT i = 0; i < count; ++i)
{ {
CComPtr<IPowerRenameItem> renameItem; CComPtr<IPowerRenameItem> renameItem;
@@ -274,23 +270,8 @@ void AppWindow::PopulateExplorerItems()
bool isSubFolderContent = false; bool isSubFolderContent = false;
winrt::check_hresult(renameItem->GetIsFolder(&isFolder)); winrt::check_hresult(renameItem->GetIsFolder(&isFolder));
if (depth > currDepth)
{
parents.push(prevId);
currDepth = depth;
}
else
{
while (currDepth > depth)
{
parents.pop();
currDepth--;
}
currDepth = depth;
}
m_mainUserControl.AddExplorerItem( m_mainUserControl.AddExplorerItem(
id, originalName, newName == nullptr ? hstring{} : hstring{ newName }, isFolder ? 0 : 1, parents.top(), selected); id, originalName, newName == nullptr ? hstring{} : hstring{ newName }, isFolder ? 0 : 1, depth, selected);
prevId = id;
} }
} }
} }
@@ -638,6 +619,7 @@ void AppWindow::SwitchView()
m_prManager->SwitchFilter(0); m_prManager->SwitchFilter(0);
PopulateExplorerItems(); PopulateExplorerItems();
UpdateCounts();
} }
void AppWindow::Rename(bool closeWindow) void AppWindow::Rename(bool closeWindow)
@@ -851,11 +833,12 @@ void AppWindow::UpdateCounts()
m_selectedCount = selectedCount; m_selectedCount = selectedCount;
m_renamingCount = renamingCount; m_renamingCount = renamingCount;
// Update counts UI elements if/when added
// Update Rename button state // Update Rename button state
m_mainUserControl.UIUpdatesItem().ButtonRenameEnabled(renamingCount > 0); m_mainUserControl.UIUpdatesItem().ButtonRenameEnabled(renamingCount > 0);
} }
m_mainUserControl.UIUpdatesItem().OriginalCount(std::to_wstring(m_mainUserControl.ExplorerItems().Size()));
m_mainUserControl.UIUpdatesItem().RenamedCount(std::to_wstring(m_renamingCount));
} }
HRESULT AppWindow::OnItemAdded(_In_ IPowerRenameItem* renameItem) HRESULT AppWindow::OnItemAdded(_In_ IPowerRenameItem* renameItem)
@@ -878,7 +861,6 @@ HRESULT AppWindow::OnUpdate(_In_ IPowerRenameItem* renameItem)
} }
} }
UpdateCounts();
return S_OK; return S_OK;
} }
@@ -935,6 +917,7 @@ HRESULT AppWindow::OnRegExCompleted(_In_ DWORD threadId)
} }
} }
UpdateCounts();
return S_OK; return S_OK;
} }

View File

@@ -2,15 +2,17 @@
#include "ExplorerItem.h" #include "ExplorerItem.h"
#include "ExplorerItem.g.cpp" #include "ExplorerItem.g.cpp"
namespace {
const wchar_t fileImagePath[] = L"ms-appx:///Assets/file.png";
const wchar_t folderImagePath[] = L"ms-appx:///Assets/folder.png";
}
namespace winrt::PowerRenameUILib::implementation namespace winrt::PowerRenameUILib::implementation
{ {
ExplorerItem::ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, bool checked) : ExplorerItem::ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) :
m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_checked{ checked } m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_depth{ depth }, m_checked{ checked }
{ {
if (m_type == static_cast<UINT>(ExplorerItemType::Folder)) m_imagePath = (m_type == static_cast<UINT>(ExplorerItemType::Folder)) ? folderImagePath : fileImagePath;
{
m_children = winrt::single_threaded_observable_vector<PowerRenameUILib::ExplorerItem>();
}
} }
int32_t ExplorerItem::Id() int32_t ExplorerItem::Id()
@@ -51,6 +53,15 @@ namespace winrt::PowerRenameUILib::implementation
} }
} }
double ExplorerItem::Indentation() {
return static_cast<double>(m_depth) * 12;
}
hstring ExplorerItem::ImagePath()
{
return m_imagePath;
}
int32_t ExplorerItem::Type() int32_t ExplorerItem::Type()
{ {
return m_type; return m_type;
@@ -79,20 +90,6 @@ namespace winrt::PowerRenameUILib::implementation
} }
} }
winrt::Windows::Foundation::Collections::IObservableVector<winrt::PowerRenameUILib::ExplorerItem> ExplorerItem::Children()
{
return m_children;
}
void ExplorerItem::Children(Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> const& value)
{
if (m_children != value)
{
m_children = value;
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Children" });
}
}
winrt::event_token ExplorerItem::PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler) winrt::event_token ExplorerItem::PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
{ {
return m_propertyChanged.add(handler); return m_propertyChanged.add(handler);

View File

@@ -11,15 +11,17 @@ namespace winrt::PowerRenameUILib::implementation
File = 1 File = 1
}; };
ExplorerItem() = delete; ExplorerItem() = default;
ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, bool checked); ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked);
int32_t Id(); int32_t Id();
hstring IdStr(); hstring IdStr();
hstring Original(); hstring Original();
void Original(hstring const& value); void Original(hstring const& value);
hstring Renamed(); hstring Renamed();
void Renamed(hstring const& value); void Renamed(hstring const& value);
double Indentation();
hstring ImagePath();
int32_t Type(); int32_t Type();
void Type(int32_t value); void Type(int32_t value);
bool Checked(); bool Checked();
@@ -34,6 +36,8 @@ namespace winrt::PowerRenameUILib::implementation
hstring m_idStr; hstring m_idStr;
winrt::hstring m_original; winrt::hstring m_original;
winrt::hstring m_renamed; winrt::hstring m_renamed;
uint32_t m_depth;
hstring m_imagePath;
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_children; winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_children;
int32_t m_type; int32_t m_type;
bool m_checked; bool m_checked;

View File

@@ -2,13 +2,15 @@ namespace PowerRenameUILib
{ {
runtimeclass ExplorerItem : Windows.UI.Xaml.Data.INotifyPropertyChanged runtimeclass ExplorerItem : Windows.UI.Xaml.Data.INotifyPropertyChanged
{ {
ExplorerItem(Int32 id, String original, String renamed, Int32 type, Boolean checked); ExplorerItem();
ExplorerItem(Int32 id, String original, String renamed, Int32 type, UInt32 depth, Boolean checked);
Int32 Id { get; }; Int32 Id { get; };
String IdStr { get; }; String IdStr { get; };
String Original; String Original;
String Renamed; String Renamed;
Double Indentation { get; };
String ImagePath { get; };
Int32 Type; Int32 Type;
Boolean Checked; Boolean Checked;
Windows.Foundation.Collections.IObservableVector<ExplorerItem> Children;
} }
} }

View File

@@ -1,37 +0,0 @@
#include "pch.h"
#include "ExplorerItemTemplateSelector.h"
#include "ExplorerItemTemplateSelector.g.cpp"
namespace winrt::PowerRenameUILib::implementation
{
Windows::UI::Xaml::DataTemplate ExplorerItemTemplateSelector::SelectTemplateCore(IInspectable const& item)
{
ExplorerItem explorerItem = (ExplorerItem&)item;
return explorerItem.Type() == 0 ? m_folderTemplate : m_fileTemplate;
}
Windows::UI::Xaml::DataTemplate ExplorerItemTemplateSelector::SelectTemplateCore(IInspectable const&, Windows::UI::Xaml::DependencyObject const&)
{
return Windows::UI::Xaml::DataTemplate();
}
winrt::Windows::UI::Xaml::DataTemplate ExplorerItemTemplateSelector::FolderTemplate()
{
return m_folderTemplate;
}
void ExplorerItemTemplateSelector::FolderTemplate(winrt::Windows::UI::Xaml::DataTemplate const& value)
{
m_folderTemplate = value;
}
winrt::Windows::UI::Xaml::DataTemplate ExplorerItemTemplateSelector::FileTemplate()
{
return m_fileTemplate;
}
void ExplorerItemTemplateSelector::FileTemplate(winrt::Windows::UI::Xaml::DataTemplate const& value)
{
m_fileTemplate = value;
}
}

View File

@@ -1,28 +0,0 @@
#pragma once
#include "ExplorerItemTemplateSelector.g.h"
namespace winrt::PowerRenameUILib::implementation
{
struct ExplorerItemTemplateSelector : ExplorerItemTemplateSelectorT<ExplorerItemTemplateSelector>
{
ExplorerItemTemplateSelector() = default;
Windows::UI::Xaml::DataTemplate SelectTemplateCore(IInspectable const&);
Windows::UI::Xaml::DataTemplate SelectTemplateCore(IInspectable const&, Windows::UI::Xaml::DependencyObject const&);
winrt::Windows::UI::Xaml::DataTemplate FolderTemplate();
void FolderTemplate(winrt::Windows::UI::Xaml::DataTemplate const& value);
winrt::Windows::UI::Xaml::DataTemplate FileTemplate();
void FileTemplate(winrt::Windows::UI::Xaml::DataTemplate const& value);
private:
Windows::UI::Xaml::DataTemplate m_folderTemplate{ nullptr };
Windows::UI::Xaml::DataTemplate m_fileTemplate{ nullptr };
};
}
namespace winrt::PowerRenameUILib::factory_implementation
{
struct ExplorerItemTemplateSelector : ExplorerItemTemplateSelectorT<ExplorerItemTemplateSelector, implementation::ExplorerItemTemplateSelector>
{
};
}

View File

@@ -1,11 +0,0 @@
namespace PowerRenameUILib
{
[bindable]
[default_interface] runtimeclass ExplorerItemTemplateSelector : Windows.UI.Xaml.Controls.DataTemplateSelector
{
ExplorerItemTemplateSelector();
Windows.UI.Xaml.DataTemplate FolderTemplate;
Windows.UI.Xaml.DataTemplate FileTemplate;
}
}

View File

@@ -163,18 +163,11 @@ namespace winrt::PowerRenameUILib::implementation
return m_uiUpdatesItem; return m_uiUpdatesItem;
} }
void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, int32_t parentId, bool checked) void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked)
{ {
auto newItem = winrt::make<PowerRenameUILib::implementation::ExplorerItem>(id, original, renamed, type, checked); auto newItem = winrt::make<PowerRenameUILib::implementation::ExplorerItem>(id, original, renamed, type, depth, checked);
if (parentId == 0) m_explorerItems.Append(newItem);
{ m_explorerItemsMap[id] = newItem;
m_explorerItems.Append(newItem);
}
else
{
auto parent = FindById(parentId);
parent.Children().Append(newItem);
}
} }
void MainWindow::UpdateExplorerItem(int32_t id, hstring const& newName) void MainWindow::UpdateExplorerItem(int32_t id, hstring const& newName)
@@ -208,43 +201,12 @@ namespace winrt::PowerRenameUILib::implementation
PowerRenameUILib::ExplorerItem MainWindow::FindById(int32_t id) PowerRenameUILib::ExplorerItem MainWindow::FindById(int32_t id)
{ {
auto fakeRoot = winrt::make<PowerRenameUILib::implementation::ExplorerItem>(0, L"Fake", L"", 0, false); return m_explorerItemsMap.contains(id) ? m_explorerItemsMap[id] : NULL;
fakeRoot.Children(m_explorerItems);
return FindById(fakeRoot, id);
} }
PowerRenameUILib::ExplorerItem MainWindow::FindById(PowerRenameUILib::ExplorerItem& root, int32_t id) void MainWindow::ToggleAll(bool checked)
{ {
if (root.Id() == id) std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); });
return root;
if (root.Type() == static_cast<UINT>(ExplorerItem::ExplorerItemType::Folder))
{
for (auto c : root.Children())
{
auto result = FindById(c, id);
if (result != NULL)
return result;
}
}
return NULL;
}
void MainWindow::ToggleAll(PowerRenameUILib::ExplorerItem node, bool checked)
{
if (node == NULL)
return;
node.Checked(checked);
if (node.Type() == static_cast<UINT>(ExplorerItem::ExplorerItemType::Folder))
{
for (auto c : node.Children())
{
ToggleAll(c, checked);
}
}
} }
void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const&) void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const&)
@@ -252,7 +214,7 @@ namespace winrt::PowerRenameUILib::implementation
auto checkbox = sender.as<Windows::UI::Xaml::Controls::CheckBox>(); auto checkbox = sender.as<Windows::UI::Xaml::Controls::CheckBox>();
auto id = std::stoi(std::wstring{ checkbox.Name() }); auto id = std::stoi(std::wstring{ checkbox.Name() });
auto item = FindById(id); auto item = FindById(id);
if (checkbox.IsChecked().GetBoolean() != item.Checked()) if (item != NULL && checkbox.IsChecked().GetBoolean() != item.Checked())
{ {
m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean()); m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean());
m_uiUpdatesItem.ChangedExplorerItemId(id); m_uiUpdatesItem.ChangedExplorerItemId(id);
@@ -263,9 +225,7 @@ namespace winrt::PowerRenameUILib::implementation
{ {
if (checkBox_selectAll().IsChecked().GetBoolean() != m_allSelected) if (checkBox_selectAll().IsChecked().GetBoolean() != m_allSelected)
{ {
auto fakeRoot = winrt::make<PowerRenameUILib::implementation::ExplorerItem>(0, L"Fake", L"", 0, false); ToggleAll(checkBox_selectAll().IsChecked().GetBoolean());
fakeRoot.Children(m_explorerItems);
ToggleAll(fakeRoot, checkBox_selectAll().IsChecked().GetBoolean());
m_uiUpdatesItem.ToggleAll(); m_uiUpdatesItem.ToggleAll();
m_allSelected = !m_allSelected; m_allSelected = !m_allSelected;
} }
@@ -278,6 +238,7 @@ namespace winrt::PowerRenameUILib::implementation
if (!m_uiUpdatesItem.ShowAll()) if (!m_uiUpdatesItem.ShowAll())
{ {
m_explorerItems.Clear(); m_explorerItems.Clear();
m_explorerItemsMap.clear();
m_uiUpdatesItem.ShowAll(true); m_uiUpdatesItem.ShowAll(true);
} }
} }
@@ -289,6 +250,7 @@ namespace winrt::PowerRenameUILib::implementation
if (m_uiUpdatesItem.ShowAll()) if (m_uiUpdatesItem.ShowAll())
{ {
m_explorerItems.Clear(); m_explorerItems.Clear();
m_explorerItemsMap.clear();
m_uiUpdatesItem.ShowAll(false); m_uiUpdatesItem.ShowAll(false);
} }
} }

View File

@@ -7,7 +7,7 @@
#include "MainWindow.g.h" #include "MainWindow.g.h"
#include "PatternSnippet.h" #include "PatternSnippet.h"
#include "ExplorerItem.h" #include "ExplorerItem.h"
#include "ExplorerItemTemplateSelector.h" #include <map>
namespace winrt::PowerRenameUILib::implementation namespace winrt::PowerRenameUILib::implementation
{ {
@@ -47,7 +47,7 @@ namespace winrt::PowerRenameUILib::implementation
PowerRenameUILib::UIUpdates UIUpdatesItem(); PowerRenameUILib::UIUpdates UIUpdatesItem();
void AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, int32_t parentId, bool checked); void AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked);
void UpdateExplorerItem(int32_t id, hstring const& newName); void UpdateExplorerItem(int32_t id, hstring const& newName);
void UpdateRenamedExplorerItem(int32_t id, hstring const& newOriginalName); void UpdateRenamedExplorerItem(int32_t id, hstring const& newOriginalName);
void AppendSearchMRU(hstring const& value); void AppendSearchMRU(hstring const& value);
@@ -61,13 +61,13 @@ namespace winrt::PowerRenameUILib::implementation
private: private:
bool m_allSelected; bool m_allSelected;
PowerRenameUILib::UIUpdates m_uiUpdatesItem; PowerRenameUILib::UIUpdates m_uiUpdatesItem;
PowerRenameUILib::ExplorerItem FindById(int32_t id); inline PowerRenameUILib::ExplorerItem FindById(int32_t id);
PowerRenameUILib::ExplorerItem FindById(PowerRenameUILib::ExplorerItem& root, int32_t id); void ToggleAll(bool checked);
void ToggleAll(PowerRenameUILib::ExplorerItem node, bool checked);
winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_searchMRU; winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_searchMRU;
winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_replaceMRU; winrt::Windows::Foundation::Collections::IObservableVector<hstring> m_replaceMRU;
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_explorerItems; winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::ExplorerItem> m_explorerItems;
std::map<int32_t, PowerRenameUILib::ExplorerItem> m_explorerItemsMap;
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::PatternSnippet> m_searchRegExShortcuts; winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::PatternSnippet> m_searchRegExShortcuts;
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::PatternSnippet> m_dateTimeShortcuts; winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUILib::PatternSnippet> m_dateTimeShortcuts;

View File

@@ -14,6 +14,8 @@ namespace PowerRenameUILib
void CloseUIWindow(Boolean closeUIWindow); void CloseUIWindow(Boolean closeUIWindow);
Boolean ButtonRenameEnabled; Boolean ButtonRenameEnabled;
void Rename(); void Rename();
String OriginalCount;
String RenamedCount;
} }
[default_interface] runtimeclass MainWindow : Windows.UI.Xaml.Controls.UserControl [default_interface] runtimeclass MainWindow : Windows.UI.Xaml.Controls.UserControl
@@ -50,7 +52,7 @@ namespace PowerRenameUILib
Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonTitleCase { get; }; Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonTitleCase { get; };
Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonCapitalize { get; }; Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonCapitalize { get; };
void AddExplorerItem(Int32 id, String original, String renamed, Int32 type, Int32 parentId, Boolean checked); void AddExplorerItem(Int32 id, String original, String renamed, Int32 type, UInt32 depth, Boolean checked);
void UpdateExplorerItem(Int32 id, String newName); void UpdateExplorerItem(Int32 id, String newName);
void UpdateRenamedExplorerItem(Int32 id, String newOriginalName); void UpdateRenamedExplorerItem(Int32 id, String newOriginalName);
void AppendSearchMRU(String value); void AppendSearchMRU(String value);

View File

@@ -1,78 +1,6 @@
<UserControl x:Class="PowerRenameUILib.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:PowerRenameUILib" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" controls:BackdropMaterial.ApplyToRootOrPageBackground="True" xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals" mc:Ignorable="d"> <UserControl x:Class="PowerRenameUILib.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:PowerRenameUILib" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls" controls:BackdropMaterial.ApplyToRootOrPageBackground="True" xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals" mc:Ignorable="d">
<UserControl.Resources> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="12">
<local:ExplorerItemTemplateSelector x:Key="ExplorerItemTemplateSelector" FolderTemplate="{StaticResource FolderTemplate}" FileTemplate="{StaticResource FileTemplate}" />
<local:ExplorerItemTemplateSelector x:Key="RenamedExplorerItemTemplateSelector" FolderTemplate="{StaticResource RenamedFolderTemplate}" FileTemplate="{StaticResource RenamedFileTemplate}" />
<DataTemplate x:Key="FileTemplate" x:DataType="local:ExplorerItem">
<Grid Height="24" Margin="0,4,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36" />
<ColumnDefinition Width="36" />
<ColumnDefinition Width="300" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox TabIndex="0" Grid.Column="0" XYFocusKeyboardNavigation="Enabled" Checked="Checked_ids" IsTabStop="True" Unchecked="Checked_ids" Content="" Name="{x:Bind IdStr}" AutomationProperties.Name="{x:Bind Original}" AutomationProperties.HelpText="{x:Bind Renamed}" IsChecked="{x:Bind Checked, Mode=TwoWay}" />
<Image Width="16" Source="ms-appx:///Assets/file.png" HorizontalAlignment="Left" Grid.Column="1" />
<TextBlock Text="{x:Bind Original, Mode=OneWay}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" VerticalAlignment="Center" FontSize="12" Grid.Column="2" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="FolderTemplate" x:DataType="local:ExplorerItem">
<Grid Margin="0,4,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36" />
<ColumnDefinition Width="36" />
<ColumnDefinition Width="300" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<CheckBox TabIndex="0" IsTabStop="True" XYFocusKeyboardNavigation="Enabled" Grid.Row="0" Grid.Column="0" Checked="Checked_ids" Unchecked="Checked_ids" Content="" Name="{x:Bind IdStr}" AutomationProperties.Name="{x:Bind Original}" AutomationProperties.HelpText="{x:Bind Renamed}" IsChecked="{x:Bind Checked, Mode=TwoWay}" />
<Image Width="16" Source="ms-appx:///Assets/folder.png" HorizontalAlignment="Left" Grid.Column="1" />
<TextBlock Text="{x:Bind Original, Mode=OneWay}" Foreground="{ThemeResource TextFillColorSecondaryBrush}" VerticalAlignment="Center" FontSize="12" Grid.Column="2" />
<ListView Grid.ColumnSpan="3" IsTabStop="false" XYFocusKeyboardNavigation="Enabled" SelectionMode="None" IsItemClickEnabled="False" ItemsSource="{x:Bind Children}" Grid.Row="1" ItemTemplateSelector="{StaticResource ExplorerItemTemplateSelector}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsTabStop" Value="False" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</DataTemplate>
<DataTemplate x:Key="RenamedFileTemplate" x:DataType="local:ExplorerItem">
<Grid Height="24" Margin="0,4,0,0">
<TextBlock Text="{x:Bind Renamed, Mode=OneWay}" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="14" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="RenamedFolderTemplate" x:DataType="local:ExplorerItem">
<Grid Margin="0,4,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="{x:Bind Renamed, Mode=OneWay}" FontWeight="Bold" VerticalAlignment="Center" FontSize="14" />
<ListView IsTabStop="false" Margin="-12,0,0,0" SelectionMode="None" IsItemClickEnabled="False" ItemsSource="{x:Bind Children}" Grid.Row="1" ItemTemplateSelector="{StaticResource RenamedExplorerItemTemplateSelector}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsTabStop" Value="False" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</DataTemplate>
</UserControl.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="20">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="0" /> <!-- 48 if we need to draw the title bar ourself --> <RowDefinition Height="0" /> <!-- 48 if we need to draw the title bar ourself -->
<RowDefinition Height="*" /> <RowDefinition Height="*" />
@@ -82,27 +10,45 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid Grid.Row="1" Grid.Column="1" Background="{ThemeResource LayerFillColorDefaultBrush}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" CornerRadius="8" BorderThickness="1" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"> <Grid Grid.Row="1"
Grid.Column="1"
Background="{ThemeResource LayerFillColorDefaultBrush}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
CornerRadius="8"
BorderThickness="1"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="48" /> <RowDefinition Height="40" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="36" />
<ColumnDefinition Width="48" />
<ColumnDefinition Width="Auto" MinWidth="324" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="48" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<CheckBox x:Name="checkBox_selectAll" IsChecked="True" Content="" x:Uid="SelectAllCheckBox" Margin="16,0,0,0" Checked="SelectAll" Unchecked="SelectAll" /> <StackPanel Orientation="Horizontal">
<Image Width="16" Grid.Column="1" Source="ms-appx:///Assets/file.png" HorizontalAlignment="Center" /> <CheckBox x:Name="checkBox_selectAll" IsChecked="True" MinWidth="0" Content="" x:Uid="SelectAllCheckBox" Margin="10,0,0,0" Checked="SelectAll" Unchecked="SelectAll" />
<Image Width="16" Margin="4,0,0,0" Source="ms-appx:///Assets/file.png" HorizontalAlignment="Left" />
<TextBlock x:Uid="TxtBlock_Original" Grid.Column="2" FontWeight="Medium" Margin="2,-2,0,0" VerticalAlignment="Center" /> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Column="2" Margin="6,-2,0,0" >
<AppBarSeparator Grid.Column="3" Margin="-6,4,0,4" HorizontalAlignment="Left" /> <TextBlock x:Uid="TxtBlock_Original" FontWeight="Medium" />
<TextBlock x:Uid="TxtBlock_Renamed" FontWeight="Medium" Grid.Column="3" Margin="4,-2,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" /> <TextBlock FontWeight="Medium" Margin="4,0,0,0" >
<Button Content="&#xE16E;" Background="Transparent" FontFamily="{ThemeResource SymbolThemeFontFamily}" Height="32" x:Uid="FilterButton" Grid.Column="4" BorderThickness="0" HorizontalAlignment="Right" Margin="0,0,8,0"> <Run Text="(" /><Run Text="{x:Bind UIUpdatesItem.OriginalCount, Mode=OneWay}" /><Run Text=")" />
</TextBlock>
</StackPanel>
</StackPanel>
<AppBarSeparator Margin="-6,4,0,4" HorizontalAlignment="Right" />
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Column="2" Margin="4,-2,0,0" >
<TextBlock x:Uid="TxtBlock_Renamed" FontWeight="Medium" />
<TextBlock FontWeight="Medium" Margin="4,0,0,0" >
<Run Text="(" /><Run Text="{x:Bind UIUpdatesItem.RenamedCount, Mode=OneWay}" /><Run Text=")" />
</TextBlock>
</StackPanel>
<Button Content="&#xE16E;" Background="Transparent" FontFamily="{ThemeResource SymbolThemeFontFamily}" Height="32" x:Uid="FilterButton" Grid.Column="1" BorderThickness="0" HorizontalAlignment="Right" Margin="0,0,8,0">
<Button.Flyout> <Button.Flyout>
<MenuBarItemFlyout Placement="Bottom"> <MenuBarItemFlyout Placement="Bottom">
<controls:RadioMenuFlyoutItem x:Name="button_showAll" Click="ShowAll" x:Uid="ShowAll" IsChecked="True" GroupName="Filter" /> <controls:RadioMenuFlyoutItem x:Name="button_showAll" Click="ShowAll" x:Uid="ShowAll" IsChecked="True" GroupName="Filter" />
@@ -112,45 +58,78 @@
</Button> </Button>
<Rectangle Height="1" Grid.ColumnSpan="5" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" /> <Rectangle Height="1" Grid.ColumnSpan="5" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
<ScrollViewer Grid.ColumnSpan="6" HorizontalScrollMode="Enabled" Grid.Row="1"> <ListView IsTabStop="false"
<Grid> SelectionMode="None"
<Grid.ColumnDefinitions> XYFocusKeyboardNavigation="Enabled"
<ColumnDefinition Width="Auto" MinWidth="286" /> IsItemClickEnabled="False"
<ColumnDefinition Width="*" /> Grid.ColumnSpan="6"
</Grid.ColumnDefinitions> ItemsSource="{x:Bind ExplorerItems, Mode=OneWay}"
<ListView IsTabStop="false" SelectionMode="None" XYFocusKeyboardNavigation="Enabled" IsItemClickEnabled="False" ItemsSource="{x:Bind ExplorerItems, Mode=OneWay}" Margin="4,0,0,0" ItemTemplateSelector="{StaticResource ExplorerItemTemplateSelector}"> Margin="0,0,0,0"
<ListView.ItemContainerStyle> Grid.Row="1">
<Style TargetType="ListViewItem"> <ListView.ItemContainerStyle>
<Setter Property="IsTabStop" Value="False" /> <Style TargetType="ListViewItem">
</Style> <Setter Property="IsTabStop" Value="False" />
</ListView.ItemContainerStyle> <Setter Property="Padding" Value="0"/>
</ListView> <Setter Property="Margin" Value="0"/>
<!--<controls:ItemsRepeater ItemsSource="{x:Bind ExplorerItems, Mode=OneWay}" <Setter Property="MinHeight" Value="0"/>
Margin="16,0,0,0" <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
ItemTemplate="{StaticResource ExplorerItemTemplateSelector}" />--> <Setter Property="Template">
<ListView Grid.Column="1" IsTabStop="false" SelectionMode="None" IsItemClickEnabled="False" ItemsSource="{x:Bind ExplorerItems, Mode=OneWay}" ItemTemplateSelector="{StaticResource RenamedExplorerItemTemplateSelector}"> <Setter.Value>
<ListView.ItemContainerStyle> <ControlTemplate TargetType="ListViewItem">
<Style TargetType="ListViewItem"> <StackPanel Orientation="Vertical">
<Setter Property="IsTabStop" Value="False" /> <ContentPresenter />
</Style> <Rectangle Height="1" Margin="0,4,0,0" Opacity="0.8" Grid.ColumnSpan="5" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
</ListView.ItemContainerStyle>
</ListView> </StackPanel>
<!--<controls:ItemsRepeater ItemsSource="{x:Bind ExplorerItems, Mode=OneWay}" </ControlTemplate>
Grid.Column="1" </Setter.Value>
ItemTemplate="{StaticResource RenamedExplorerItemTemplateSelector}" />--> </Setter>
</Grid> </Style>
</ScrollViewer> </ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:Name="ExplorerItemTemplate" x:DataType="local:ExplorerItem">
<Grid Height="20" Margin="10,4,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<StackPanel MinWidth="{x:Bind Indentation}"/>
<CheckBox TabIndex="0"
MinWidth="0"
XYFocusKeyboardNavigation="Enabled"
Checked="Checked_ids"
IsTabStop="True"
Unchecked="Checked_ids"
Content=""
Name="{x:Bind IdStr}"
AutomationProperties.Name="{x:Bind Original}"
AutomationProperties.HelpText="{x:Bind Renamed}"
IsChecked="{x:Bind Checked, Mode=TwoWay}" />
<Image Width="16" Margin="4,0,0,0" Source="{x:Bind ImagePath}" HorizontalAlignment="Left" />
<TextBlock Margin="6,0,0,0"
Text="{x:Bind Original, Mode=OneWay}"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
VerticalAlignment="Center"
FontSize="12" />
</StackPanel>
<TextBlock Text="{x:Bind Renamed, Mode=OneWay}" Grid.Column="1" FontWeight="Bold" VerticalAlignment="Center" FontSize="12" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid> </Grid>
<Grid Grid.Column="0" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"> <Grid Grid.Column="0" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="48" /> <RowDefinition Height="48" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer> <ScrollViewer>
<StackPanel Orientation="Vertical" Padding="0,0,0,16" Margin="0,0,20,0"> <StackPanel Orientation="Vertical" Padding="0,0,0,16" Margin="0,0,12,0">
<Grid> <Grid>
<AutoSuggestBox x:Name="textBox_search" x:Uid="SearchBox" Height="48" VerticalContentAlignment="Center" ItemsSource="{x:Bind SearchMRU}" /> <AutoSuggestBox x:Name="textBox_search" x:Uid="SearchBox" Height="40" VerticalContentAlignment="Center" ItemsSource="{x:Bind SearchMRU}" />
<Button FontFamily="{ThemeResource SymbolThemeFontFamily}" VerticalAlignment="Center" Visibility="{Binding ElementName=checkBox_regex, Path=IsChecked}" MinHeight="32" Margin="4" x:Uid="RegExButton" Background="Transparent" BorderBrush="Transparent" Content="&#xE946;" HorizontalAlignment="Right"> <Button FontFamily="{ThemeResource SymbolThemeFontFamily}" VerticalAlignment="Center" Visibility="{Binding ElementName=checkBox_regex, Path=IsChecked}" MinHeight="32" Margin="4" x:Uid="RegExButton" Background="Transparent" BorderBrush="Transparent" Content="&#xE946;" HorizontalAlignment="Right">
<Button.Flyout> <Button.Flyout>
@@ -189,13 +168,13 @@
</Grid> </Grid>
<CheckBox x:Name="checkBox_regex" x:Uid="CheckBox_RegEx" Margin="2,12,0,0" /> <CheckBox x:Name="checkBox_regex" x:Uid="CheckBox_RegEx" Margin="2,6,0,0" />
<CheckBox x:Name="checkBox_matchAll" x:Uid="CheckBox_MatchAll" Margin="2,4,0,0" /> <CheckBox x:Name="checkBox_matchAll" x:Uid="CheckBox_MatchAll" Margin="2,0,0,0" />
<CheckBox x:Name="checkBox_case" x:Uid="CheckBox_Case" Margin="2,4,0,0" /> <CheckBox x:Name="checkBox_case" x:Uid="CheckBox_Case" Margin="2,0,0,0" />
<Rectangle Height="1" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" Margin="0,16,0,20" /> <Rectangle Height="1" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" Margin="0,16,0,20" />
<Grid> <Grid>
<AutoSuggestBox x:Name="textBox_replace" Margin="0,0,0,0" x:Uid="ReplaceBox" Height="48" VerticalContentAlignment="Center" Padding="12,12,0,0" ItemsSource="{x:Bind ReplaceMRU}" /> <AutoSuggestBox x:Name="textBox_replace" Margin="0,0,0,0" x:Uid="ReplaceBox" Height="40" VerticalContentAlignment="Center" Padding="12,12,0,0" ItemsSource="{x:Bind ReplaceMRU}" />
<Button FontFamily="{ThemeResource SymbolThemeFontFamily}" VerticalAlignment="Center" MinHeight="32" Margin="4" x:Uid="FileCreationButton" Background="Transparent" BorderBrush="Transparent" Content="&#xE946;" HorizontalAlignment="Right"> <Button FontFamily="{ThemeResource SymbolThemeFontFamily}" VerticalAlignment="Center" MinHeight="32" Margin="4" x:Uid="FileCreationButton" Background="Transparent" BorderBrush="Transparent" Content="&#xE946;" HorizontalAlignment="Right">
<Button.Flyout> <Button.Flyout>
@@ -230,7 +209,7 @@
</Button> </Button>
</Grid> </Grid>
<TextBlock x:Uid="TextBox_ApplyTo" x:Name="ApplyToLabel" FontSize="12" Margin="0,20,0,8" Foreground="{ThemeResource TextFillColorSecondaryBrush}" /> <TextBlock x:Uid="TextBox_ApplyTo" x:Name="ApplyToLabel" FontSize="12" Margin="0,12,0,8" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<StackPanel Orientation="Horizontal" Grid.Column="1" Spacing="4" Grid.Row="1"> <StackPanel Orientation="Horizontal" Grid.Column="1" Spacing="4" Grid.Row="1">
<ComboBox x:Name="comboBox_renameParts" SelectedIndex="0" Width="200" AutomationProperties.LabeledBy="{Binding ElementName=ApplyToLabel}" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="1"> <ComboBox x:Name="comboBox_renameParts" SelectedIndex="0" Width="200" AutomationProperties.LabeledBy="{Binding ElementName=ApplyToLabel}" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="1">
@@ -239,20 +218,20 @@
<x:String>Extension only</x:String> <x:String>Extension only</x:String>
</ComboBox> </ComboBox>
<AppBarSeparator Margin="5,0,5,0" /> <AppBarSeparator Margin="5,0,5,0" />
<ToggleButton x:Name="toggleButton_includeFiles" Content="&#xE160;" MinHeight="32" IsChecked="True" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="ToggleButton_IncludeFiles" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_includeFiles" Content="&#xE160;" MinHeight="0" Height="31" IsChecked="True" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="ToggleButton_IncludeFiles" Style="{StaticResource CustomToggleButtonStyle}" />
<ToggleButton x:Name="toggleButton_includeFolders" Content="&#xE8B7;" MinHeight="32" IsChecked="True" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="ToggleButton_IncludeFolders" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_includeFolders" Content="&#xE8B7;" MinHeight="0" Height="31" IsChecked="True" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="ToggleButton_IncludeFolders" Style="{StaticResource CustomToggleButtonStyle}" />
<ToggleButton x:Name="toggleButton_includeSubfolders" Content="&#xE12F;" MinHeight="32" IsChecked="True" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="ToggleButton_IncludeSubFolders" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_includeSubfolders" Content="&#xE12F;" MinHeight="0" Height="31" IsChecked="True" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="ToggleButton_IncludeSubFolders" Style="{StaticResource CustomToggleButtonStyle}" />
</StackPanel> </StackPanel>
<TextBlock x:Uid="TextBlock_TextFormatting" FontSize="12" Foreground="{ThemeResource TextFillColorSecondaryBrush}" Margin="0,20,0,8" /> <TextBlock x:Uid="TextBlock_TextFormatting" FontSize="12" Foreground="{ThemeResource TextFillColorSecondaryBrush}" Margin="0,12,0,8" />
<StackPanel Orientation="Horizontal" Spacing="4"> <StackPanel Orientation="Horizontal" Spacing="4">
<ToggleButton x:Name="toggleButton_lowerCase" Content="aa" FontWeight="Medium" MinHeight="32" x:Uid="ToggleButton_Lowercase" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_lowerCase" Content="aa" FontWeight="Medium" MinHeight="0" Height="31" x:Uid="ToggleButton_Lowercase" Style="{StaticResource CustomToggleButtonStyle}" />
<ToggleButton x:Name="toggleButton_upperCase" Content="AA" FontWeight="Medium" MinHeight="32" x:Uid="ToggleButton_Uppercase" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_upperCase" Content="AA" FontWeight="Medium" MinHeight="0" Height="31" x:Uid="ToggleButton_Uppercase" Style="{StaticResource CustomToggleButtonStyle}" />
<ToggleButton x:Name="toggleButton_titleCase" Content="Aa" FontWeight="Medium" MinHeight="32" x:Uid="ToggleButton_TitleCase" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_titleCase" Content="Aa" FontWeight="Medium" MinHeight="0" Height="31" x:Uid="ToggleButton_TitleCase" Style="{StaticResource CustomToggleButtonStyle}" />
<ToggleButton x:Name="toggleButton_capitalize" Content="Aa Aa" FontWeight="Medium" MinHeight="32" x:Uid="ToggleButton_Capitalize" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_capitalize" Content="Aa Aa" FontWeight="Medium" MinHeight="0" Height="31" x:Uid="ToggleButton_Capitalize" Style="{StaticResource CustomToggleButtonStyle}" />
<AppBarSeparator Margin="5,0,5,0" /> <AppBarSeparator Margin="5,0,5,0" />
<ToggleButton x:Name="toggleButton_enumItems" Content="&#xEA40;" FontFamily="{ThemeResource SymbolThemeFontFamily}" MinHeight="32" x:Uid="ToggleButton_EnumItems" Style="{StaticResource CustomToggleButtonStyle}" /> <ToggleButton x:Name="toggleButton_enumItems" Content="&#xEA40;" FontFamily="{ThemeResource SymbolThemeFontFamily}" MinHeight="32" x:Uid="ToggleButton_EnumItems" Style="{StaticResource CustomToggleButtonStyle}" />
@@ -260,29 +239,38 @@
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
<Rectangle Height="1" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" Margin="0,0,20,0" VerticalAlignment="Top" Grid.Row="1" /> <Rectangle Height="1" Fill="{ThemeResource CardStrokeColorDefaultBrush}" HorizontalAlignment="Stretch" Margin="0,0,12,0" VerticalAlignment="Top" Grid.Row="1" />
<StackPanel Orientation="Horizontal" Grid.Row="1" Spacing="8" Margin="0" Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Left">
</Grid>
<Button x:Name="button_settings" Height="32" x:Uid="TxtBlock_ButtonSettings" FontFamily="{ThemeResource SymbolThemeFontFamily}" Grid.Row="5" Padding="6" Background="Transparent" BorderBrush="Transparent" Grid.Column="1"> <StackPanel Orientation="Horizontal"
<Button.Content> Grid.Row="2"
<controls:AnimatedIcon x:Name="SearchAnimatedIcon"> Spacing="8"
<controls:AnimatedIcon.Source> Margin="0"
<animatedVisuals:AnimatedSettingsVisualSource /> Grid.Column="0"
</controls:AnimatedIcon.Source> VerticalAlignment="Bottom"
<controls:AnimatedIcon.FallbackIconSource> HorizontalAlignment="Left">
<controls:SymbolIconSource Symbol="Setting" />
</controls:AnimatedIcon.FallbackIconSource>
</controls:AnimatedIcon>
</Button.Content> <Button x:Name="button_settings" Height="32" x:Uid="TxtBlock_ButtonSettings" FontFamily="{ThemeResource SymbolThemeFontFamily}" Grid.Row="5" Padding="6" Background="Transparent" BorderBrush="Transparent" Grid.Column="1">
</Button> <Button.Content>
<controls:AnimatedIcon x:Name="SearchAnimatedIcon">
<controls:AnimatedIcon.Source>
<animatedVisuals:AnimatedSettingsVisualSource />
</controls:AnimatedIcon.Source>
<controls:AnimatedIcon.FallbackIconSource>
<controls:SymbolIconSource Symbol="Setting" />
</controls:AnimatedIcon.FallbackIconSource>
</controls:AnimatedIcon>
<Button x:Name="button_docs" Content="&#xE11B;" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="DocsButton" Background="Transparent" BorderBrush="Transparent" Grid.Row="1" Height="32" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="OpenDocs" /> </Button.Content>
</Button>
<Button x:Name="button_docs" Content="&#xE11B;" FontFamily="{ThemeResource SymbolThemeFontFamily}" x:Uid="DocsButton" Background="Transparent" BorderBrush="Transparent" Grid.Row="1" Height="32" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="OpenDocs" />
<!--<Button Content="&#xE728;" <!--<Button Content="&#xE728;"
FontFamily="{ThemeResource SymbolThemeFontFamily}" FontFamily="{ThemeResource SymbolThemeFontFamily}"
ToolTipService.ToolTip="Presets" ToolTipService.ToolTip="Presets"
Background="Transparent" Background="Transparent"
@@ -300,26 +288,27 @@
</Button.Flyout> </Button.Flyout>
</Button>--> </Button>-->
</StackPanel> </StackPanel>
<muxc:SplitButton Grid.Row="1" Style="{StaticResource SplitAccentButtonStyle}" x:Name="button_rename" Margin="0,0,20,0" x:Uid="ButtonApply" Click="button_rename_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom" IsEnabled="{x:Bind UIUpdatesItem.ButtonRenameEnabled, Mode=OneWay}">
<muxc:SplitButton.KeyboardAccelerators>
<KeyboardAccelerator Key="Enter" /> <muxc:SplitButton Grid.Row="2" Style="{StaticResource SplitAccentButtonStyle}" Grid.Column="0" Margin="0,0,12,1" x:Name="button_rename" x:Uid="ButtonApply" Click="button_rename_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom" IsEnabled="{x:Bind UIUpdatesItem.ButtonRenameEnabled, Mode=OneWay}">
<KeyboardAccelerator Key="Enter" Modifiers="Control" /> <muxc:SplitButton.KeyboardAccelerators>
</muxc:SplitButton.KeyboardAccelerators> <KeyboardAccelerator Key="Enter" />
<muxc:SplitButton.Content> <KeyboardAccelerator Key="Enter" Modifiers="Control" />
<StackPanel Orientation="Horizontal"> </muxc:SplitButton.KeyboardAccelerators>
<FontIcon Glyph="&#xE13E;" FontSize="14" VerticalAlignment="Center" Margin="0,2,10,0" /> <muxc:SplitButton.Content>
<TextBlock x:Uid="TxtBlock_ButtonApply" /> <StackPanel Orientation="Horizontal">
</StackPanel> <FontIcon Glyph="&#xE13E;" FontSize="14" VerticalAlignment="Center" Margin="0,2,10,0" />
</muxc:SplitButton.Content> <TextBlock x:Uid="TxtBlock_ButtonApply" />
<muxc:SplitButton.Flyout> </StackPanel>
<MenuFlyout> </muxc:SplitButton.Content>
<MenuFlyoutItem x:Uid="TxtBlock_ButtonApplyAndClose" Click="MenuFlyoutItem_Click" /> <muxc:SplitButton.Flyout>
</MenuFlyout> <MenuFlyout>
</muxc:SplitButton.Flyout> <MenuFlyoutItem x:Uid="TxtBlock_ButtonApplyAndClose" Click="MenuFlyoutItem_Click" />
</muxc:SplitButton> </MenuFlyout>
</Grid> </muxc:SplitButton.Flyout>
</muxc:SplitButton>
<!--<StackPanel x:Name="TitleBar" Orientation="Horizontal"> <!--<StackPanel x:Name="TitleBar" Orientation="Horizontal">
<Image Source="Assets/PowerRename.png" Width="16" Height="16" VerticalAlignment="Top" Margin="20,9,0,0"/> <Image Source="Assets/PowerRename.png" Width="16" Height="16" VerticalAlignment="Top" Margin="20,9,0,0"/>

View File

@@ -54,7 +54,8 @@
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"></ImportGroup> <ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets"> <ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
@@ -108,7 +109,6 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="app.base.h" /> <ClInclude Include="app.base.h" />
<ClInclude Include="ExplorerItem.h" /> <ClInclude Include="ExplorerItem.h" />
<ClInclude Include="ExplorerItemTemplateSelector.h" />
<ClInclude Include="MainWindow.h"> <ClInclude Include="MainWindow.h">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
@@ -146,7 +146,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ExplorerItem.cpp" /> <ClCompile Include="ExplorerItem.cpp" />
<ClCompile Include="ExplorerItemTemplateSelector.cpp" />
<ClCompile Include="MainWindow.cpp"> <ClCompile Include="MainWindow.cpp">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
@@ -166,7 +165,6 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
</Midl> </Midl>
<Midl Include="ExplorerItem.idl" /> <Midl Include="ExplorerItem.idl" />
<Midl Include="ExplorerItemTemplateSelector.idl" />
<Midl Include="MainWindow.idl"> <Midl Include="MainWindow.idl">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>

View File

@@ -64,6 +64,34 @@ namespace winrt::PowerRenameUILib::implementation
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Rename" }); m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Rename" });
} }
hstring UIUpdates::OriginalCount()
{
return m_originalCount;
}
void UIUpdates::OriginalCount(hstring value)
{
if (m_originalCount != value)
{
m_originalCount = value;
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"OriginalCount" });
}
}
hstring UIUpdates::RenamedCount()
{
return m_renamedCount;
}
void UIUpdates::RenamedCount(hstring value)
{
if (m_renamedCount != value)
{
m_renamedCount = value;
m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"RenamedCount" });
}
}
bool UIUpdates::CloseUIWindow() bool UIUpdates::CloseUIWindow()
{ {
return m_closeUIWindow; return m_closeUIWindow;

View File

@@ -21,6 +21,10 @@ namespace winrt::PowerRenameUILib::implementation
bool ButtonRenameEnabled(); bool ButtonRenameEnabled();
void ButtonRenameEnabled(bool value); void ButtonRenameEnabled(bool value);
void Rename(); void Rename();
hstring OriginalCount();
void OriginalCount(hstring value);
hstring RenamedCount();
void RenamedCount(hstring value);
private: private:
bool m_showAll; bool m_showAll;
@@ -28,6 +32,8 @@ namespace winrt::PowerRenameUILib::implementation
bool m_checked; bool m_checked;
bool m_closeUIWindow; bool m_closeUIWindow;
bool m_buttonRenameEnabled; bool m_buttonRenameEnabled;
hstring m_originalCount;
hstring m_renamedCount;
winrt::event<Windows::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged; winrt::event<Windows::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged;
}; };
} }

View File

@@ -16,6 +16,7 @@
#include <winrt/Windows.UI.Xaml.Controls.h> #include <winrt/Windows.UI.Xaml.Controls.h>
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h> #include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
#include <winrt/Windows.UI.Xaml.Data.h> #include <winrt/Windows.UI.Xaml.Data.h>
#include <winrt/Windows.UI.Xaml.Documents.h>
#include <winrt/Windows.UI.Xaml.Interop.h> #include <winrt/Windows.UI.Xaml.Interop.h>
#include <winrt/Windows.UI.Xaml.Markup.h> #include <winrt/Windows.UI.Xaml.Markup.h>
#include <winrt/Windows.UI.Xaml.Navigation.h> #include <winrt/Windows.UI.Xaml.Navigation.h>