Windows 软件快捷小工具

2022-07-27 10:07:37 +08:00
 yanjinhua

分享一个WPF 实现 Windows 软件快捷小工具

Windows 软件快捷小工具

作者:WPFDevelopersOrg

原文链接: https://github.com/WPFDevelopersOrg/SoftwareHelper

预览

启动页

嵌入桌面

悬浮桌面

颜色拾取

预览原文

启动页

搜索定位功能 LeftAlt+(应用首字的首字母)

托盘、换肤、透明度

移动应用顺序

移除应用

自动更新(失效)

1 )开机启动

        private void appShortcutToStartup()
        {
            var startupDir = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
            if (!Directory.Exists(startupDir)) return;
            var path = startupDir + "\\" + "SoftwareHelperStart" + ".url";
            if (!File.Exists(path))
                using (var writer = new StreamWriter(path))
                {
                    var app = Assembly.GetExecutingAssembly().Location;
                    writer.WriteLine("[InternetShortcut]");
                    writer.WriteLine("URL=file:///" + app);
                    writer.WriteLine("IconIndex=0");
                    var icon = app.Replace('\\', '/');
                    writer.WriteLine("IconFile=" + icon);
                }
        }
    }

2 ) 换肤 Dark|Light

using System;
using System.Configuration;
using System.Linq;
using System.Windows;

namespace SoftwareHelper.Helpers
{
    /// <summary>
    /// Themes 帮助类
    /// </summary>
    public partial class ThemesHelper
    {
        /// <summary>
        /// 切换 Themes
        /// </summary>
        /// <param name="isDark">true:Dark false:light</param>
        public static void SetLightDark(bool isDark)
        {

            try
            {
                var existingResourceDictionary = Application.Current.Resources.MergedDictionaries
                                                    .Where(rd => rd.Source != null)
                                                    .SingleOrDefault(rd => rd.Source.OriginalString.Contains("Light") || rd.Source.OriginalString.Contains("Dark"));
                var source = $"pack://application:,,,/SoftwareHelper;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);
                //节点
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                config.AppSettings.Settings["Dark"].Value = isDark.ToString();
                config.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection("appSettings");
            }
            catch (Exception ex)
            {
                Log.Error($"MainView.SetLightDark Error:{ex.Message}");
            }

        }

        public static bool GetLightDark()
        {
            bool dark;
            if (!bool.TryParse(string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["Dark"]) ? "false" : ConfigurationManager.AppSettings["Dark"], out dark))
            {
                dark = false;
            }
            else
            {
                dark = Convert.ToBoolean(string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["Dark"]) ? "false" : ConfigurationManager.AppSettings["Dark"]);
            }
            return dark;
        }

       
    }
}

Hook 按键 Hook 鼠标 颜色拾取

2251 次点击
所在节点    Windows
6 条回复
Kareless
2022-07-27 10:16:06 +08:00
试着用用看
yanjinhua
2022-07-27 13:17:12 +08:00
@Kareless 欢迎🤗
Angzk3348
2022-07-27 15:56:21 +08:00
支持一下
yanjinhua
2022-07-27 17:11:04 +08:00
@Angzk3348 谢谢
codefever
2022-07-27 22:51:43 +08:00
支持
yanjinhua
2022-07-28 11:18:45 +08:00
@codefever 谢谢

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/868953

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX