-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
支持对话记录懒加载 优化性能 增加开机自启动设置
- Loading branch information
Showing
28 changed files
with
510 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using ChatBox.Service; | ||
|
||
namespace ChatBox.Desktop; | ||
|
||
public class MacisAutoStartService : IAutoStartService | ||
{ | ||
public bool IsAutoStart() | ||
{ | ||
return false; | ||
} | ||
|
||
public bool SetAutoStart(Boolean isAutoStart) | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using ChatBox.Service; | ||
|
||
namespace ChatBox.Desktop.Services; | ||
|
||
public class WindowAutoStartService : IAutoStartService | ||
{ | ||
public bool IsAutoStart() | ||
{ | ||
// 判断当前window系统否存在开机启动 | ||
using var userRunKey = | ||
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); | ||
|
||
|
||
string exePath = Process.GetCurrentProcess().MainModule.FileName; | ||
string exeName = Assembly.GetExecutingAssembly().GetName().Name; | ||
|
||
|
||
object runValue = userRunKey.GetValue(exeName); | ||
if (runValue != null && | ||
string.Equals(runValue.ToString(), $"\"{exePath}\"", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public bool SetAutoStart(bool isAutoStart) | ||
{ | ||
string exePath = Process.GetCurrentProcess().MainModule.FileName; | ||
string exeName = Assembly.GetExecutingAssembly().GetName().Name; | ||
using var key = | ||
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); | ||
if (isAutoStart) | ||
{ | ||
key.SetValue(exeName, $"\"{exePath}\""); | ||
} | ||
else | ||
{ | ||
key.DeleteValue(exeName, false); | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.