Uninstall 완료 시 Installer 창에 이벤트 전달

This commit is contained in:
jmaniuvc
2025-05-19 16:32:47 +09:00
parent dc60b8abe4
commit 1303126f1f
36 changed files with 224 additions and 11638 deletions

View File

@@ -16,6 +16,7 @@ using System.Security.Cryptography;
using System.Net.Http;
using Microsoft.Win32;
using System.Security.Policy;
using System.Runtime.InteropServices;
namespace StudioClient
{
@@ -91,15 +92,12 @@ namespace StudioClient
private async void StudioCheckButton_Click(object sender, EventArgs e)
{
// 경로에 가서 전부 삭제하고 다시 설치
// 실행된 상태라면 return 필요
//await CheckIntegrity(serverUrl, appName_Studio);
}
private async void StudioDeleteButton_Click(object sender, EventArgs e)
{
await UninstallApp(appName_Studio);
//SetButtonState(false, StudioInstallButton, StudioCheckButton, StudioDeleteButton);
}
private async void StudioTwinDeleteButton_Click(object sender, EventArgs e)
@@ -251,35 +249,11 @@ namespace StudioClient
Process.Start(startInfo);
}
private async Task CheckIntegrity(string serverUrl, string appName)
{
string appUrl = Path.Combine(serverUrl, appName);
string installPath = GetInstalledPathFromRegistry(appName);
if (!string.IsNullOrWhiteSpace(installPath) && Directory.Exists(installPath))
{
try
{
Directory.Delete(installPath, recursive: true);
WriteText("✅ 설치 경로 폴더가 성공적으로 삭제되었습니다.");
}
catch (Exception ex)
{
WriteText($"❌ 폴더 삭제 중 오류 발생: {ex.Message}");
}
}
else
{
WriteText("❌ 설치된 경로가 없습니다.");
}
}
private async Task UninstallApp(string appName)
{
string appUrl = Path.Combine(serverUrl, appName);
// Setup으로 설치를 진행했는지 체크
// 설치가 이미 되어있는지 체크
string installPath = GetInstalledPathFromRegistry(appName);
string exeFilePath;
@@ -294,6 +268,7 @@ namespace StudioClient
}
WriteText("Uninstaller 실행");
StartExecutableFile(exeFilePath, installPath);
}
else
@@ -302,35 +277,26 @@ namespace StudioClient
}
}
/*
private async void Form1_Load(object sender, EventArgs e)
{
SetControlsEnabled(false);
UpdateStateMessage.Text = "업데이트 확인 중...";
// Uninstall 완료 시
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern uint RegisterWindowMessage(string lpString);
bool surverConnect = await TryConnectToServerAsync();
private uint uninstallCompleteMsg;
if (surverConnect)
{
SetControlsEnabled(true);
UpdateStateMessage.Visible = false;
UpdateStateMessage.Enabled = false;
}
else
{
UpdateStateMessage.Text = "네트워크 연결 상태를 확인하세요.";
UpdateStateMessage.Visible = true;
UpdateStateMessage.Enabled = true;
}
}
private void SetControlsEnabled(bool enabled)
{
StudioButton.Visible = enabled;
StudioButton.Enabled = enabled;
ChunilButton.Visible = enabled;
ChunilButton.Enabled = enabled;
}
*/
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
uninstallCompleteMsg = RegisterWindowMessage("UVC_UNINSTALL_COMPLETE");
}
protected override void WndProc(ref Message m)
{
if (m.Msg == uninstallCompleteMsg)
{
SetButtonState(false, StudioInstallButton, StudioCheckButton, StudioDeleteButton);
}
base.WndProc(ref m);
}
}
}