Skip to content

Commit d93d395

Browse files
committed
Refactor imports and fix WPF type usage
Standardized and expanded using directives across multiple files for better clarity and maintainability. Replaced ambiguous WPF type references with fully qualified names (e.g., System.Windows.MessageBoxButton) to avoid conflicts and improve code readability. Removed invalid StackPanel spacing styles from XAML and updated comments to guide correct usage. Added a new PrivacyMode property to SettingsManager. Minor UI string and property assignment fixes in settings and editor windows.
1 parent 80a90c0 commit d93d395

21 files changed

Lines changed: 130 additions & 73 deletions

App.xaml.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
using System.Windows;
44
using System.Windows.Threading;
55
using Wpf.Ui.Appearance;
6+
using PrettyScreenSHOT.Helpers;
7+
using PrettyScreenSHOT.Services;
8+
using PrettyScreenSHOT.Services.Update;
9+
using PrettyScreenSHOT.Services.Cloud;
10+
using PrettyScreenSHOT.Services.Settings;
11+
using PrettyScreenSHOT.Services.Screenshot;
12+
using PrettyScreenSHOT.Views.Windows;
613

714
namespace PrettyScreenSHOT
815
{
@@ -59,11 +66,8 @@ private void InitializeWpfUiTheme()
5966
}
6067
else
6168
{
62-
ApplicationThemeManager.Apply(
63-
appTheme,
64-
WindowBackdropType.Mica, // Windows 11 Mica effect
65-
true // updateAccents
66-
);
69+
// Apply theme - WindowBackdropType may not be available in this WPF UI version
70+
ApplicationThemeManager.Apply(appTheme);
6771
}
6872

6973
DebugHelper.LogInfo("App", $"WPF UI Theme initialized: {themeName} -> {appTheme}");

Helpers/LocalizationHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Globalization;
22
using System.Resources;
33
using System.Windows;
4+
using PrettyScreenSHOT.Services.Settings;
45

56
namespace PrettyScreenSHOT.Helpers
67
{

Helpers/StackPanelHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static void StackPanel_Loaded(object sender, RoutedEventArgs e)
5353
private static void ApplySpacing(StackPanel stackPanel)
5454
{
5555
var spacing = GetSpacing(stackPanel);
56-
var isHorizontal = stackPanel.Orientation == Orientation.Horizontal;
56+
var isHorizontal = stackPanel.Orientation == System.Windows.Controls.Orientation.Horizontal;
5757

5858
for (int i = 0; i < stackPanel.Children.Count; i++)
5959
{

PrettyScreenSHOT.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
<StartupObject>PrettyScreenSHOT.App</StartupObject>
1212
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
1313
<AssemblyTitle>$(MSBuildProjectName)</AssemblyTitle>
14-
<ApplicationIcon>app.ico</ApplicationIcon>
14+
<!-- <ApplicationIcon>app.ico</ApplicationIcon> -->
1515
<PlatformTarget>x64</PlatformTarget>
1616
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
1717
<Platforms>AnyCPU;x64</Platforms>
18+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1819

1920
<!-- Version strategy:
2021
- 0.0.X = Development builds (X = CI build number)
@@ -50,6 +51,12 @@
5051
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
5152
</ItemGroup>
5253

54+
<ItemGroup>
55+
<Compile Remove="Tests\**" />
56+
<EmbeddedResource Remove="Tests\**" />
57+
<None Remove="Tests\**" />
58+
</ItemGroup>
59+
5360
<ItemGroup>
5461
<EmbeddedResource Update="Properties\Resources.resx">
5562
<Generator>ResXFileCodeGenerator</Generator>

Services/PerformanceOptimizer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Windows.Media.Imaging;
44
using System.IO;
55
using System.Threading.Tasks;
6+
using PrettyScreenSHOT.Helpers;
67

78
namespace PrettyScreenSHOT.Services
89
{

Services/Screenshot/ScreenshotManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
using System.Windows.Media.Imaging;
33
using System.IO;
44
using System.Linq;
5+
using PrettyScreenSHOT.Helpers;
6+
using PrettyScreenSHOT.Services.Cloud;
7+
using PrettyScreenSHOT.Services.Security;
58
using PrettyScreenSHOT.Services.Settings;
69

710
namespace PrettyScreenSHOT.Services.Screenshot

Services/Screenshot/ScrollCaptureHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Windows.Input;
99
using System.Windows.Media.Imaging;
1010
using System.Windows.Media;
11+
using PrettyScreenSHOT.Helpers;
1112

1213
namespace PrettyScreenSHOT.Services.Screenshot
1314
{

Services/SearchAndFilterManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Collections.ObjectModel;
44
using System.Linq;
5+
using PrettyScreenSHOT.Services.Screenshot;
56

67
namespace PrettyScreenSHOT.Services
78
{

Services/Settings/SettingsManager.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System.IO;
22
using System.Text.Json;
3+
using PrettyScreenSHOT.Helpers;
34
using PrettyScreenSHOT.Services;
5+
using PrettyScreenSHOT.Services.Cloud;
46

57
namespace PrettyScreenSHOT.Services.Settings
68
{
@@ -249,6 +251,12 @@ public bool RemoveMetadata
249251
set { settings.RemoveMetadata = value; SaveSettings(); }
250252
}
251253

254+
public bool PrivacyMode
255+
{
256+
get => settings.PrivacyMode;
257+
set { settings.PrivacyMode = value; SaveSettings(); }
258+
}
259+
252260
// Performance settings
253261
public bool EnableCache
254262
{
@@ -405,6 +413,7 @@ private class AppSettings
405413
public bool EnableWatermark { get; set; } = false;
406414
public string WatermarkText { get; set; } = "PrettyScreenSHOT";
407415
public bool RemoveMetadata { get; set; } = false;
416+
public bool PrivacyMode { get; set; } = false;
408417

409418
// Performance
410419
public bool EnableCache { get; set; } = true;

Services/ThemeService.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using Wpf.Ui.Appearance;
3+
using PrettyScreenSHOT.Helpers;
34

45
namespace PrettyScreenSHOT.Services
56
{
@@ -77,11 +78,8 @@ private void ApplyTheme(ApplicationTheme theme)
7778
}
7879
else
7980
{
80-
ApplicationThemeManager.Apply(
81-
theme,
82-
WindowBackdropType.Mica, // Windows 11 Mica effect
83-
true // updateAccents
84-
);
81+
// Apply theme - WindowBackdropType may not be available in this WPF UI version
82+
ApplicationThemeManager.Apply(theme);
8583

8684
DebugHelper.LogInfo("ThemeService", $"Applied theme: {theme}");
8785
}

0 commit comments

Comments
 (0)