Skip to content

Commit

Permalink
Modify as follows
Browse files Browse the repository at this point in the history
1.SoftwareHelper was renamed Nimble
2.Added dynamic desktop background that can be set
  • Loading branch information
yanjinhuagood committed Sep 24, 2023
1 parent aacb44e commit 1f33fb9
Show file tree
Hide file tree
Showing 63 changed files with 847 additions and 523 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################

/SoftWareHelper/obj/Debug
/SoftWareHelper/bin
/SoftWareHelper/obj/Release/TempPE
/SoftWareHelper/obj/Release
/Nimble/obj/Debug
/Nimble/bin
/Nimble/obj/Release/TempPE
/Nimble/obj/Release
/.vs
/SoftwareHelper.v12.suo
/Nimble.v12.suo
/packages
/SoftwareHelper.sln.DotSettings.user
/Nimble.sln.DotSettings.user
/Output
6 changes: 3 additions & 3 deletions SoftwareHelper.sln → Nimble.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftwareHelper", "SoftwareHelper\SoftwareHelper.csproj", "{04C91D63-7279-4E5F-9D3A-DE780122DC02}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nimble", "Nimble\Nimble.csproj", "{04C91D63-7279-4E5F-9D3A-DE780122DC02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
58 changes: 33 additions & 25 deletions SoftwareHelper/App.xaml → Nimble/App.xaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
<Application x:Class="SoftwareHelper.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="https://github.com/WPFDevelopersOrg/WPFDevelopers"
xmlns:helpers="clr-namespace:SoftwareHelper.Helpers">
<!--StartupUri="Views/MainView.xaml"-->
<!--StartupUri="MainWindow.xaml">-->
<Application
x:Class="Nimble.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:helpers="clr-namespace:Nimble.Helpers"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers">
<!-- StartupUri="Views/MainView.xaml" -->
<!-- StartupUri="MainWindow.xaml"> -->
<Application.Resources>
<ResourceDictionary>
<FontFamily x:Key="NormalFontFamily">
Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif
</FontFamily>

<Style TargetType="{x:Type TextElement }">
<Style TargetType="{x:Type TextElement}">
<Setter Property="TextElement.FontFamily" Value="{DynamicResource NormalFontFamily}" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
</Style>
<Style TargetType="{x:Type TextBlock }">
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextBlock.TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextBlock.FontFamily" Value="{DynamicResource NormalFontFamily}" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextBlock.FontFamily" Value="{DynamicResource NormalFontFamily}" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
</Style>

<DropShadowEffect x:Key="NormalShadowDepth" BlurRadius="5" ShadowDepth="1" Direction="270" Color="#AA000000" Opacity=".42" RenderingBias="Performance" />
<DropShadowEffect
x:Key="NormalShadowDepth"
BlurRadius="5"
Direction="270"
Opacity=".42"
RenderingBias="Performance"
ShadowDepth="1"
Color="#AA000000" />



<helpers:Bool2VisibilityConverter x:Key="bool2VisibilityConverter"/>
<helpers:Bool2VisibilityConverter x:Key="bool2VisibilityConverter" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Themes/Dark.xaml"/>
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml"/>
<!--需要注意ws:Resources 必须再配色主题后,Theme="Dark" 为黑色皮肤-->
<ws:Resources Theme="Light"/>
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml"/>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Styles/Geometry.xaml"/>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Styles/Colors.xaml"/>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Styles/ButtonsStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Styles/WindowsStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Styles/SwitchMenuStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/SoftwareHelper;component/Styles/ContextMenuStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Themes/Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml" />
<!-- 需要注意wd:Resources 必须再配色主题后,Theme="Dark" 为黑色皮肤 -->
<wd:Resources Theme="Light" />
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml" />
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Styles/Geometry.xaml" />
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Styles/ButtonsStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Styles/WindowsStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Styles/SwitchMenuStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/Nimble;component/Styles/ContextMenuStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
6 changes: 3 additions & 3 deletions SoftwareHelper/App.xaml.cs → Nimble/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Threading;
using SoftwareHelper.Helpers;
using SoftwareHelper.Views;
using Nimble.Helpers;
using Nimble.Views;

namespace SoftwareHelper
namespace Nimble
{
/// <summary>
/// App.xaml 的交互逻辑
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SoftwareHelper.Controls
namespace Nimble.Controls
{
public class SwitchMenu : Selector
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Windows;
using System.Windows.Data;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public class Bool2VisibilityConverter : IValueConverter
{
Expand Down
6 changes: 3 additions & 3 deletions SoftwareHelper/Helpers/Common.cs → Nimble/Helpers/Common.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Expression.Drawing.Core;
using Microsoft.Win32;
using Newtonsoft.Json;
using SoftwareHelper.Models;
using Nimble.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand All @@ -15,7 +15,7 @@
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public partial class Common
{
Expand Down Expand Up @@ -723,7 +723,7 @@ public static void AppShortcutToStartup(bool isDel = false)
{
var startupDir = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
if (!Directory.Exists(startupDir)) return;
var path = startupDir + "\\" + "SoftwareHelperStart" + ".url";
var path = startupDir + "\\" + "NimbleStart" + ".url";
if (isDel)
{
if (File.Exists(path))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Configuration;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
/// <summary>
/// Config帮助类
Expand All @@ -12,6 +12,7 @@ public partial class ConfigHelper
public static double Opacity { get; set; }
public static bool CustomJson { get;private set; }
public static bool Startup { get; set; }
public static string WallpaperPath { get; set; }
public static void GetConfigHelper()
{
double opacity = 80;
Expand All @@ -35,6 +36,8 @@ public static void GetConfigHelper()
startup = false;
else
startup = Convert.ToBoolean(string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["Startup"]) ? "false" : ConfigurationManager.AppSettings["Startup"]);

WallpaperPath = string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["WallpaperPath"]) ? string.Empty : ConfigurationManager.AppSettings["WallpaperPath"];
}
double GetOpacity()
{
Expand Down Expand Up @@ -68,6 +71,10 @@ public static void SaveStartup(bool startUp)
{
SaveConfig("Startup", startUp.ToString());
}
public static void SaveWallpaperPath(string path)
{
SaveConfig("WallpaperPath", path);
}
static void SaveConfig(string key,string value)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Windows;
using System.Windows.Media;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public static partial class ControlsHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Data;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public class DarkAndLightConvert : IValueConverter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Data;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public class EmbeddedConvert : IValueConverter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.IO;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public partial class FileHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using System.Text;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public partial class JsonHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.InteropServices;
using System.Windows.Input;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public partial class KeyboardHook
{
Expand Down
2 changes: 1 addition & 1 deletion SoftwareHelper/Helpers/Log.cs → Nimble/Helpers/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public sealed class Log
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace SoftwareHelper.Helpers.MouseHelper
namespace Nimble.Helpers.MouseHelper
{
/// <summary>
/// Abstract base class for Mouse and Keyboard hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace SoftwareHelper.Helpers.MouseHelper
namespace Nimble.Helpers.MouseHelper
{
/// <summary>
/// Captures global mouse events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Drawing;
using System.Runtime.InteropServices;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public partial class PrimaryScreen
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Windows.Input;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public class RelayCommand : ICommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Data;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public class StartupConvert : IValueConverter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Windows;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
/// <summary>
/// Themes 帮助类
Expand All @@ -21,10 +21,10 @@ public static void SetLightDark(bool isDark)
{
var existingResourceDictionary = Application.Current.Resources.MergedDictionaries
.Where(rd => rd.Source != null)
.SingleOrDefault(rd => rd.Source.OriginalString.Contains("/SoftwareHelper;component/Themes")
.SingleOrDefault(rd => rd.Source.OriginalString.Contains("/Nimble;component/Themes")
&&
(rd.Source.OriginalString.Contains("Light") || rd.Source.OriginalString.Contains("Dark")));
var source = $"pack://application:,,,/SoftwareHelper;component/Themes/{(isDark ? "Dark" : "Light")}.xaml";
var source = $"pack://application:,,,/Nimble;component/Themes/{(isDark ? "Dark" : "Light")}.xaml";
var newResourceDictionary = new ResourceDictionary() { Source = new Uri(source) };
App.Current.Resources.MergedDictionaries.Remove(existingResourceDictionary);
App.Current.Resources.MergedDictionaries.Add(newResourceDictionary);
Expand Down
32 changes: 28 additions & 4 deletions SoftwareHelper/Helpers/Win32Api.cs → Nimble/Helpers/Win32Api.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using SoftwareHelper.ViewModels;
using SoftwareHelper.Views;
using Nimble.ViewModels;
using Nimble.Views;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
Expand All @@ -14,7 +14,7 @@
using System.Windows.Media.Imaging;
using System.Windows.Threading;

namespace SoftwareHelper.Helpers
namespace Nimble.Helpers
{
public partial class Win32Api
{
Expand Down Expand Up @@ -183,6 +183,9 @@ internal struct RECT

public const int SWP_NOMOVE = 0x2;

public const int SWP_NOSIZE = 0x0001;


public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
#endregion

Expand Down Expand Up @@ -487,6 +490,28 @@ static public System.Windows.Media.Color GetPixelColor(int x, int y)
}

#endregion


[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string className, string winName);

[DllImport("user32.dll")]
public static extern IntPtr SendMessageTimeout(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, uint fuFlage, uint timeout, IntPtr result);

public delegate bool EnumWindowsProc(IntPtr hwnd, IntPtr lParam);
[DllImport("user32.dll")]
public static extern bool EnumWindows(EnumWindowsProc proc, IntPtr lParam);

[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string className, string winName);

[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);

[DllImport("user32.dll")]
public static extern IntPtr SetParent(IntPtr hwnd, IntPtr parentHwnd);


}
public class MousePoint
{
Expand All @@ -504,6 +529,5 @@ public POINT(int x, int y)

[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool GetCursorPos(out POINT pt);

}
}
Loading

0 comments on commit 1f33fb9

Please sign in to comment.