Skip to content

Commit

Permalink
Remove UnreferenceHelper
Browse files Browse the repository at this point in the history
Remove UnreferenceHelper
  • Loading branch information
Gaoyifei1011 committed May 28, 2024
1 parent a6293e1 commit e8d754a
Show file tree
Hide file tree
Showing 27 changed files with 76 additions and 536 deletions.
16 changes: 0 additions & 16 deletions WindowsTools/Helpers/Root/UnreferenceHelper.cs

This file was deleted.

6 changes: 3 additions & 3 deletions WindowsTools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
[assembly: AssemblyCompany("高怡飞")]
[assembly: AssemblyCopyright("Copyright ©2024 高怡飞, All Rights Reserved.")]
[assembly: AssemblyDescription("Windows 工具箱")]
[assembly: AssemblyFileVersion("2.5.526.0")]
[assembly: AssemblyInformationalVersion("2.5.526.0")]
[assembly: AssemblyFileVersion("2.5.528.0")]
[assembly: AssemblyInformationalVersion("2.5.528.0")]
[assembly: AssemblyProduct("Windows 工具箱")]
[assembly: AssemblyTitle("Windows 工具箱")]
[assembly: AssemblyVersion("2.5.526.0")]
[assembly: AssemblyVersion("2.5.528.0")]
6 changes: 3 additions & 3 deletions WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using WindowsTools.UI.TeachingTips;
using WindowsTools.Views.Windows;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.UI.Dialogs.About
{
/// <summary>
Expand Down Expand Up @@ -115,9 +118,6 @@ public AppInformationDialog()
/// </summary>
private void OnLoaded(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
IReadOnlyList<Package> dependencyList = Package.Current.Dependencies;
Expand Down
10 changes: 3 additions & 7 deletions WindowsTools/UI/Dialogs/FileCheckDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
using Windows.UI.Xaml.Controls;
using WindowsTools.Extensions.DataType.Enums;
using WindowsTools.Helpers.Controls.Extensions;
using WindowsTools.Helpers.Root;
using WindowsTools.Services.Controls.Download;
using WindowsTools.UI.TeachingTips;
using WindowsTools.Views.Windows;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.UI.Dialogs
{
/// <summary>
Expand All @@ -32,9 +34,6 @@ public FileCheckDialog(string url, string saveFilePath)
/// </summary>
private void OnPrimaryButtonClicked(object sender, ContentDialogButtonClickEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
try
Expand All @@ -58,9 +57,6 @@ private void OnPrimaryButtonClicked(object sender, ContentDialogButtonClickEvent
/// </summary>
private void OnSecondaryButtonClicked(object sender, ContentDialogButtonClickEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start(Path.GetDirectoryName(downloadFilePath));
Expand Down
5 changes: 3 additions & 2 deletions WindowsTools/UI/Dialogs/OperationFailedDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
using WindowsTools.Strings;
using WindowsTools.UI.TeachingTips;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.UI.Dialogs
{
/// <summary>
Expand All @@ -33,8 +36,6 @@ public OperationFailedDialog(ObservableCollection<OperationFailedModel> operatio
/// </summary>
private void OnCopyExecuteRequested(XamlUICommand sender, ExecuteRequestedEventArgs args)
{
UnreferenceHelper.Unreference(sender);

OperationFailedModel operationFailedItem = args.Parameter as OperationFailedModel;
if (operationFailedItem is not null)
{
Expand Down
7 changes: 3 additions & 4 deletions WindowsTools/UI/Dialogs/RestartAppsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using WindowsTools.Helpers.Root;
using WindowsTools.Views.Windows;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.UI.Dialogs
{
/// <summary>
Expand All @@ -22,9 +24,6 @@ public RestartAppsDialog()
/// </summary>
private void OnRestartAppsClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start(Process.GetCurrentProcess().MainModule.FileName, "Restart");
Expand Down
39 changes: 3 additions & 36 deletions WindowsTools/Views/Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
using WindowsTools.WindowsAPI.ComTypes;
using WindowsTools.WindowsAPI.PInvoke.Kernel32;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.Views.Pages
{
/// <summary>
Expand Down Expand Up @@ -119,9 +122,6 @@ private void OnPinToDesktopClicked(object sender, RoutedEventArgs args)
/// </summary>
private async void OnPinToStartScreenClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

bool isPinnedSuccessfully = false;

try
Expand Down Expand Up @@ -162,9 +162,6 @@ private async void OnPinToStartScreenClicked(object sender, RoutedEventArgs args
/// </summary>
private void OnPinToTaskbarClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

bool isPinnedSuccessfully = false;

try
Expand Down Expand Up @@ -206,9 +203,6 @@ private void OnPinToTaskbarClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnShowReleaseNotesClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start("https://github.com/Gaoyifei1011/WindowsTools/releases");
Expand All @@ -220,9 +214,6 @@ private void OnShowReleaseNotesClicked(object sender, RoutedEventArgs args)
/// </summary>
private async void OnShowLicenseClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

await ContentDialogHelper.ShowAsync(new LicenseDialog(), this);
}

Expand All @@ -231,9 +222,6 @@ private async void OnShowLicenseClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnHelpTranslateClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start("https://github.com/Gaoyifei1011/WindowsTools/releases");
Expand All @@ -245,9 +233,6 @@ private void OnHelpTranslateClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnProjectDescriptionClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start("https://github.com/Gaoyifei1011/WindowsTools");
Expand All @@ -259,9 +244,6 @@ private void OnProjectDescriptionClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnSendFeedbackClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start("https://github.com/Gaoyifei1011/WindowsTools/issues");
Expand All @@ -273,9 +255,6 @@ private void OnSendFeedbackClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnCheckUpdateClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

if (!IsChecking)
{
IsChecking = true;
Expand Down Expand Up @@ -368,9 +347,6 @@ private void OnCheckUpdateClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnSystemInformationClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start("ms-settings:about");
Expand All @@ -382,9 +358,6 @@ private void OnSystemInformationClicked(object sender, RoutedEventArgs args)
/// </summary>
private async void OnAppInformationClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

await ContentDialogHelper.ShowAsync(new AppInformationDialog(), this);
}

Expand All @@ -393,9 +366,6 @@ private async void OnAppInformationClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnAppSettingsClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

if (RuntimeHelper.IsElevated)
{
Task.Run(() =>
Expand All @@ -410,9 +380,6 @@ private void OnAppSettingsClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnTroubleShootClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

Task.Run(() =>
{
Process.Start("ms-settings:troubleshoot");
Expand Down
19 changes: 3 additions & 16 deletions WindowsTools/Views/Pages/AddDownloadTaskPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using WindowsTools.Helpers.Controls;
using WindowsTools.Helpers.Root;
using WindowsTools.Services.Controls.Download;
using WindowsTools.Services.Controls.Settings;
using WindowsTools.Services.Root;
using WindowsTools.Strings;
using WindowsTools.UI.Dialogs;
using WindowsTools.Views.Windows;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.Views.Pages
{
/// <summary>
Expand Down Expand Up @@ -118,8 +120,6 @@ public AddDownloadTaskPage()
/// </summary>
private void OnDownloadLinkTextChanged(object sender, TextChangedEventArgs args)
{
UnreferenceHelper.Unreference(args);

DownloadLinkText = (sender as global::Windows.UI.Xaml.Controls.TextBox).Text;

if (!string.IsNullOrEmpty(DownloadLinkText))
Expand Down Expand Up @@ -160,8 +160,6 @@ private void OnDownloadLinkTextChanged(object sender, TextChangedEventArgs args)
/// </summary>
private void OnDownloadFileNameTextChanged(object sender, TextChangedEventArgs args)
{
UnreferenceHelper.Unreference(args);

DownloadFileNameText = (sender as global::Windows.UI.Xaml.Controls.TextBox).Text;

IsPrimaryButtonEnabled = !string.IsNullOrEmpty(DownloadLinkText) && !string.IsNullOrEmpty(DownloadFileNameText) && !string.IsNullOrEmpty(DownloadFolderText);
Expand All @@ -172,8 +170,6 @@ private void OnDownloadFileNameTextChanged(object sender, TextChangedEventArgs a
/// </summary>
private void OnDownloadFolderTextChanged(object sender, TextChangedEventArgs args)
{
UnreferenceHelper.Unreference(args);

DownloadFolderText = (sender as global::Windows.UI.Xaml.Controls.TextBox).Text;
}

Expand All @@ -182,9 +178,6 @@ private void OnDownloadFolderTextChanged(object sender, TextChangedEventArgs arg
/// </summary>
private void OnSelectFolderClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

FolderBrowserDialog dialog = new()
{
Description = FileProperties.SelectFolder,
Expand All @@ -203,9 +196,6 @@ private void OnSelectFolderClicked(object sender, RoutedEventArgs args)
/// </summary>
private async void OnDownloadClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

// 检查文件路径
if (DownloadFileNameText.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 || DownloadFolderText.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
{
Expand Down Expand Up @@ -238,9 +228,6 @@ private async void OnDownloadClicked(object sender, RoutedEventArgs args)
/// </summary>
private void OnCloseClicked(object sender, RoutedEventArgs args)
{
UnreferenceHelper.Unreference(sender);
UnreferenceHelper.Unreference(args);

AddDownloadTaskWindow.Current?.Close();
}
}
Expand Down
6 changes: 3 additions & 3 deletions WindowsTools/Views/Pages/AllToolsPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using Windows.UI.Xaml.Controls;
using WindowsTools.Helpers.Root;
using WindowsTools.Models;
using WindowsTools.Strings;
using WindowsTools.Views.Windows;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060

namespace WindowsTools.Views.Pages
{
/// <summary>
Expand Down Expand Up @@ -145,8 +147,6 @@ public AllToolsPage()
/// </summary>
private void OnItemClicked(object sender, ItemClickEventArgs args)
{
UnreferenceHelper.Unreference(sender);

ControlItemModel controlItem = args.ClickedItem as ControlItemModel;

if (controlItem is not null)
Expand Down
Loading

0 comments on commit e8d754a

Please sign in to comment.