Skip to content

Commit

Permalink
perf: remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraZiling committed Apr 14, 2024
1 parent f08c947 commit cab72be
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
param(
[string] $Architecture = "x64",
[string] $Version = "0.0.3.0"
[string] $Version = "0.0.4.0"
)

$ErrorActionPreference = "Stop";
Expand Down
1 change: 0 additions & 1 deletion src/PipManager/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:valueConverters="clr-namespace:ValueConverters;assembly=ValueConverters"
xmlns:xamlFlair="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
DispatcherUnhandledException="OnDispatcherUnhandledException"
Exit="OnExit"
Startup="OnStartup">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace PipManager.Resources.Library;
public class DeletionWarningContentDialog
{
private readonly ContentDialog _contentDialog;
public List<LibraryListItem> LibraryList { get; set; }
private List<LibraryListItem> LibraryList { get; set; }

public DeletionWarningContentDialog(ContentPresenter? contentPresenter, List<LibraryListItem> libraryList)
{
Expand Down
4 changes: 1 addition & 3 deletions src/PipManager/Resources/Library/LibraryStyles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lang="clr-namespace:PipManager.Languages"
xmlns:library="clr-namespace:PipManager.Resources.Library"
xmlns:pages="clr-namespace:PipManager.Models.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:valueConverters="clr-namespace:ValueConverters;assembly=ValueConverters">
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Grid x:Key="LibraryDeletionWarningContentDialogContent" VerticalAlignment="Top">
<TextBlock
VerticalAlignment="Top"
Expand Down
1 change: 0 additions & 1 deletion src/PipManager/ViewModels/Pages/Lab/LabViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using PipManager.Models.Action;
using PipManager.Services.Action;
using PipManager.ViewModels.Pages.Overlay;
using Serilog;
using Wpf.Ui.Controls;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using PipManager.Views.Pages.Library;
using Serilog;
using System.Collections.ObjectModel;
using System.IO.Packaging;
using PipManager.ViewModels.Pages.Overlay;
using Wpf.Ui;
using Wpf.Ui.Appearance;
Expand Down
7 changes: 3 additions & 4 deletions src/PipManager/ViewModels/Pages/Overlay/OverlayViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Collections.ObjectModel;
using PipManager.Models.Package;
using PipManager.Views.Pages.Overlay;
using PipManager.Views.Windows;

namespace PipManager.ViewModels.Pages.Overlay;

public partial class OverlayViewModel: ObservableObject
{
private System.Action? ConfirmCallback;
private System.Action? _confirmCallback;

[ObservableProperty]
private bool _isOverlayVisible;
Expand All @@ -29,7 +28,7 @@ private void ShowOverlay()

public void ShowPackageUpdateOverlay(List<PackageUpdateItem> packageUpdates, System.Action callback)
{
ConfirmCallback = callback;
_confirmCallback = callback;
PackageUpdateItems = new ObservableCollection<PackageUpdateItem>(packageUpdates);
ShowOverlay();
}
Expand All @@ -38,6 +37,6 @@ public void ShowPackageUpdateOverlay(List<PackageUpdateItem> packageUpdates, Sys
private void Confirm()
{
CloseOverlay();
ConfirmCallback?.Invoke();
_confirmCallback?.Invoke();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Microsoft.Win32;
using PipManager.Models.Action;
using PipManager.Services.Action;
using PipManager.Services.Mask;
using Wpf.Ui;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
Expand All @@ -28,7 +27,6 @@ public record SearchDetailMessage(QueryListItemModel Package);
private readonly HttpClient _httpClient;
private readonly IThemeService _themeService;
private readonly IToastService _toastService;
private readonly IMaskService _maskService;
private readonly IActionService _actionService;
private readonly IEnvironmentService _environmentService;

Expand Down Expand Up @@ -61,14 +59,13 @@ public record SearchDetailMessage(QueryListItemModel Package);
[ObservableProperty]
private QueryListItemModel? _package;

public SearchDetailViewModel(INavigationService navigationService, HttpClient httpClient, IThemeService themeService, IToastService toastService, IEnvironmentService environmentService, IMaskService maskService, IActionService actionService)
public SearchDetailViewModel(INavigationService navigationService, HttpClient httpClient, IThemeService themeService, IToastService toastService, IEnvironmentService environmentService, IActionService actionService)
{
_navigationService = navigationService;
_httpClient = httpClient;
_themeService = themeService;
_toastService = toastService;
_environmentService = environmentService;
_maskService = maskService;
_actionService = actionService;

WeakReferenceMessenger.Default.Register<SearchDetailMessage>(this, Receive);
Expand Down
1 change: 0 additions & 1 deletion src/PipManager/Views/Pages/Lab/LabPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
mc:Ignorable="d">

<Grid>
<ui:Button Command="{Binding ViewModel.OverlayTestCommand}" Content="Overlay Test" />
</Grid>
</Page>
3 changes: 2 additions & 1 deletion src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Page
<!-- ReSharper disable Xaml.PossibleNullReferenceException -->
<Page
x:Class="PipManager.Views.Pages.Library.LibraryDetailPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
3 changes: 1 addition & 2 deletions src/PipManager/Views/Pages/Overlay/OverlayPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Windows.Controls;
using PipManager.ViewModels.Pages.Overlay;
using PipManager.ViewModels.Pages.Overlay;

namespace PipManager.Views.Pages.Overlay;

Expand Down
3 changes: 2 additions & 1 deletion src/PipManager/Views/Pages/Search/SearchDetailPage.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Page
<!-- ReSharper disable Xaml.PossibleNullReferenceException -->
<Page
FontFamily="/PipManager;component/Resources/Fonts/MiSans-Regular.ttf#MiSans"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Title="SearchDetailPage"
Expand Down
3 changes: 1 addition & 2 deletions src/PipManager/Views/Pages/Settings/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:settings="clr-namespace:PipManager.Views.Pages.Settings"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xamlFlair="clr-namespace:XamlFlair;assembly=XamlFlair.WPF">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<converters:ThemeEnumToBooleanConverter x:Key="ThemeEnumToBooleanConverter" />
<converters:PackageSourceEnumToBooleanConverter x:Key="PackageSourceEnumToBooleanConverter" />
Expand Down

0 comments on commit cab72be

Please sign in to comment.