Skip to content
This repository was archived by the owner on Jan 25, 2026. It is now read-only.

Commit 78ad048

Browse files
committed
fix(single-instance): 修复上次未正常关闭导致单例锁写入有误
1 parent fc2030a commit 78ad048

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Service/RpcService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.IO;
55
using System.IO.Pipes;
66
using System.Text;
7+
using System.Windows;
78
using PCL.Core.Helper;
89
using PCL.Core.LifecycleManagement;
910

@@ -248,6 +249,7 @@ void ActivateMainWindow()
248249
app.Dispatcher.BeginInvoke(() =>
249250
{
250251
var window = app.MainWindow!;
252+
if (window.WindowState == WindowState.Minimized) window.WindowState = WindowState.Normal;
251253
if (!window.Topmost)
252254
{
253255
window.Topmost = true;

Service/SingleInstanceService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override void Start()
3333
{
3434
try
3535
{
36-
var stream = File.Open(_LockFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
36+
var stream = File.Open(_LockFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
3737
Context.Debug("未发现重复实例,正在向单例锁写入信息");
3838
using var sw = new StreamWriter(stream, Encoding.ASCII, 8, true);
3939
sw.Write(NativeInterop.CurrentProcessId);

0 commit comments

Comments
 (0)