From 6ad8ce74977f06bd8f42d1f8c212cd84c0971f48 Mon Sep 17 00:00:00 2001 From: MouriNaruto Date: Tue, 18 Jul 2023 23:55:01 +0800 Subject: [PATCH] Tidy the MainPage implementation. --- NanaGet/MainPage.cpp | 38 +- NanaGet/MainPage.h | 30 +- NanaGet/MainPage.xaml | 504 +++++++++--------- .../{TaskManagerGrid.resw => MainPage.resw} | 0 .../{TaskManagerGrid.resw => MainPage.resw} | 0 .../{TaskManagerGrid.resw => MainPage.resw} | 0 .../{TaskManagerGrid.resw => MainPage.resw} | 0 .../{TaskManagerGrid.resw => MainPage.resw} | 0 8 files changed, 285 insertions(+), 287 deletions(-) rename NanaGetPackage/Strings/de/{TaskManagerGrid.resw => MainPage.resw} (100%) rename NanaGetPackage/Strings/en/{TaskManagerGrid.resw => MainPage.resw} (100%) rename NanaGetPackage/Strings/ja/{TaskManagerGrid.resw => MainPage.resw} (100%) rename NanaGetPackage/Strings/zh-Hans/{TaskManagerGrid.resw => MainPage.resw} (100%) rename NanaGetPackage/Strings/zh-Hant/{TaskManagerGrid.resw => MainPage.resw} (100%) diff --git a/NanaGet/MainPage.cpp b/NanaGet/MainPage.cpp index 04ec6aa..9bf08fc 100644 --- a/NanaGet/MainPage.cpp +++ b/NanaGet/MainPage.cpp @@ -57,7 +57,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridNewTaskButtonClick( + void MainPage::NewTaskButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -71,7 +71,7 @@ namespace winrt::NanaGet::implementation 0); } - void MainPage::TaskManagerGridStartAllButtonClick( + void MainPage::StartAllButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -88,7 +88,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridPauseAllButtonClick( + void MainPage::PauseAllButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -105,7 +105,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridClearListButtonClick( + void MainPage::ClearListButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -122,7 +122,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridOpenDownloadsFolderButtonClick( + void MainPage::OpenDownloadsFolderButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -139,7 +139,7 @@ namespace winrt::NanaGet::implementation ::ShellExecuteExW(&ExecInfo); } - void MainPage::TaskManagerGridSettingsButtonClick( + void MainPage::SettingsButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -153,7 +153,7 @@ namespace winrt::NanaGet::implementation 0); } - void MainPage::TaskManagerGridAboutButtonClick( + void MainPage::AboutButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -167,20 +167,20 @@ namespace winrt::NanaGet::implementation 0); } - void MainPage::TaskManagerGridTaskListContainerContentChanging( + void MainPage::TaskListContainerContentChanging( ListViewBase const& sender, ContainerContentChangingEventArgs const& e) { UNREFERENCED_PARAMETER(sender); UNREFERENCED_PARAMETER(e); - this->TaskManagerGridTaskListNoItemsTextBlock().Visibility( + this->TaskListNoItemsTextBlock().Visibility( !sender.ItemsSource() ? Visibility::Visible : Visibility::Collapsed); } - void MainPage::TaskManagerGridTaskItemRetryButtonClick( + void MainPage::TaskItemRetryButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -200,7 +200,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridTaskItemResumeButtonClick( + void MainPage::TaskItemResumeButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -218,7 +218,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridTaskItemPauseButtonClick( + void MainPage::TaskItemPauseButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -236,7 +236,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridTaskItemCopyLinkButtonClick( + void MainPage::TaskItemCopyLinkButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -256,7 +256,7 @@ namespace winrt::NanaGet::implementation } } - /*void MainPage::TaskManagerGridTaskItemOpenFolderButtonClick( + /*void MainPage::TaskItemOpenFolderButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -270,7 +270,7 @@ namespace winrt::NanaGet::implementation 0); }*/ - void MainPage::TaskManagerGridTaskItemCancelButtonClick( + void MainPage::TaskItemCancelButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -288,7 +288,7 @@ namespace winrt::NanaGet::implementation } } - void MainPage::TaskManagerGridTaskItemRemoveButtonClick( + void MainPage::TaskItemRemoveButtonClick( IInspectable const& sender, RoutedEventArgs const& e) { @@ -427,11 +427,11 @@ namespace winrt::NanaGet::implementation DispatcherQueuePriority::Normal, [&]() { - this->TaskManagerGridGlobalStatusTextBlock().Text(GlobalStatusText); + this->GlobalStatusTextBlock().Text(GlobalStatusText); if (NeedFullRefresh) { - this->TaskManagerGridTaskList().ItemsSource(this->m_Tasks); + this->TaskList().ItemsSource(this->m_Tasks); } else if(this->m_Tasks) { @@ -444,7 +444,7 @@ namespace winrt::NanaGet::implementation } catch (...) { - + } } diff --git a/NanaGet/MainPage.h b/NanaGet/MainPage.h index 564dd75..92a9b58 100644 --- a/NanaGet/MainPage.h +++ b/NanaGet/MainPage.h @@ -32,63 +32,63 @@ namespace winrt::NanaGet::implementation ~MainPage(); - void TaskManagerGridNewTaskButtonClick( + void NewTaskButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridStartAllButtonClick( + void StartAllButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridPauseAllButtonClick( + void PauseAllButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridClearListButtonClick( + void ClearListButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridOpenDownloadsFolderButtonClick( + void OpenDownloadsFolderButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridSettingsButtonClick( + void SettingsButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridAboutButtonClick( + void AboutButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridTaskListContainerContentChanging( + void TaskListContainerContentChanging( ListViewBase const& sender, ContainerContentChangingEventArgs const& e); - void TaskManagerGridTaskItemRetryButtonClick( + void TaskItemRetryButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridTaskItemResumeButtonClick( + void TaskItemResumeButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridTaskItemPauseButtonClick( + void TaskItemPauseButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridTaskItemCopyLinkButtonClick( + void TaskItemCopyLinkButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - /*void TaskManagerGridTaskItemOpenFolderButtonClick( + /*void TaskItemOpenFolderButtonClick( IInspectable const& sender, RoutedEventArgs const& e);*/ - void TaskManagerGridTaskItemCancelButtonClick( + void TaskItemCancelButtonClick( IInspectable const& sender, RoutedEventArgs const& e); - void TaskManagerGridTaskItemRemoveButtonClick( + void TaskItemRemoveButtonClick( IInspectable const& sender, RoutedEventArgs const& e); diff --git a/NanaGet/MainPage.xaml b/NanaGet/MainPage.xaml index ac97b7b..7228168 100644 --- a/NanaGet/MainPage.xaml +++ b/NanaGet/MainPage.xaml @@ -10,264 +10,262 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - - - - - - - - - - - - - - - + + + + + - - - - - - + + + + + + diff --git a/NanaGetPackage/Strings/de/TaskManagerGrid.resw b/NanaGetPackage/Strings/de/MainPage.resw similarity index 100% rename from NanaGetPackage/Strings/de/TaskManagerGrid.resw rename to NanaGetPackage/Strings/de/MainPage.resw diff --git a/NanaGetPackage/Strings/en/TaskManagerGrid.resw b/NanaGetPackage/Strings/en/MainPage.resw similarity index 100% rename from NanaGetPackage/Strings/en/TaskManagerGrid.resw rename to NanaGetPackage/Strings/en/MainPage.resw diff --git a/NanaGetPackage/Strings/ja/TaskManagerGrid.resw b/NanaGetPackage/Strings/ja/MainPage.resw similarity index 100% rename from NanaGetPackage/Strings/ja/TaskManagerGrid.resw rename to NanaGetPackage/Strings/ja/MainPage.resw diff --git a/NanaGetPackage/Strings/zh-Hans/TaskManagerGrid.resw b/NanaGetPackage/Strings/zh-Hans/MainPage.resw similarity index 100% rename from NanaGetPackage/Strings/zh-Hans/TaskManagerGrid.resw rename to NanaGetPackage/Strings/zh-Hans/MainPage.resw diff --git a/NanaGetPackage/Strings/zh-Hant/TaskManagerGrid.resw b/NanaGetPackage/Strings/zh-Hant/MainPage.resw similarity index 100% rename from NanaGetPackage/Strings/zh-Hant/TaskManagerGrid.resw rename to NanaGetPackage/Strings/zh-Hant/MainPage.resw