실행환경검사 invoke 오류 수정

This commit is contained in:
ChiKyun Kim
2025-07-29 08:38:21 +09:00
parent e309864262
commit c0eb33f60a
22 changed files with 773 additions and 209 deletions

View File

@@ -95,6 +95,7 @@ namespace Project
Pub.log.Flush();
}
//ConnectionMultiplexer redisConnection;
//IDatabase db;
@@ -102,52 +103,23 @@ namespace Project
{
EnsureVisibleAndUsableSize();
this.Text = Application.ProductName + " v" + Application.ProductVersion;
Pub.init();
Pub.InitializeWebView2();
// 실행환경 체크는 fWarning에서 이미 완료됨
setToolbar();
var f = new Dialog.fWarning();
f.TopMost = true;
f.Show();
_SetLang();
if (Pub.setting.FullScreen) this.WindowState = FormWindowState.Maximized;
else this.WindowState = FormWindowState.Normal;
this.Show();
Application.DoEvents();
// 데이터베이스 접속 정보 확인
Pub.dbinfo = DatabaseConnectionString.Utility.Read();
if (Pub.dbinfo.IsValid == false)
{
Application.DoEvents();
this.Visible = false;
MessageBox.Show("데이터베이스 접속정보가 존재하지 않습니다\n개발부서에 접속정보를 문의하세요", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
Pub.dbinfo = DatabaseConnectionString.Utility.ShowForm();
if (Pub.dbinfo.IsValid == false)
{
MessageBox.Show("데이터 베이스 정보가 없습니다\n프로그램이 정상 작동하지 않을 수 있습니다", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Visible = true;
}
Properties.Settings.Default["CS"] = Pub.dbinfo.ToString();
Properties.Settings.Default["gwcs"] = Pub.dbinfo.ToString();
//Util.MsgE(Pub.dbinfo.ToString());
//Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D;Encrypt=False;TrustServerCertificate=True
Pub.barcode = new Device.Barcode();
if (!Pub.setting.Barcode.isEmpty()) Pub.barcode.PortName = Pub.setting.Barcode;
// 바코드 이벤트 연결
Pub.barcode.ReceiveData += barcode_ReceiveData;
FCOMMON.info.camIndex = Pub.setting.CamIndex;
UpdateControls();
tmDisplay.Start(); //display timer
// Start OWIN host
// Start OWIN host (실행환경 체크는 이미 완료됨)
try
{
var options = new StartOptions(Pub.setting.WebServiceURL);
@@ -164,22 +136,36 @@ namespace Project
webok = false;
}
// WebView2 초기화 재시도 (필요시)
if (Pub.InitWebView == 0)
{
try
{
Console.WriteLine("WebView2 재초기화 시도...");
Pub.InitializeWebView2();
}
catch (Exception retryEx)
{
Console.WriteLine($"WebView2 재초기화 실패: {retryEx.Message}");
// 실패해도 계속 진행
}
}
// WebView2 대기 (짧게 조정)
var wat = new System.Diagnostics.Stopwatch();
wat.Restart();
while (true)
{
if (Pub.InitWebView != 0) break;
if (wat.ElapsedMilliseconds > 5000) break;
System.Threading.Thread.Sleep(1000);
if (wat.ElapsedMilliseconds > 3000) break; // 5초에서 3초로 단축
System.Threading.Thread.Sleep(500); // 1초에서 0.5초로 단축
Application.DoEvents();
}
f.Dispose();
Console.WriteLine($"WebView2 초기화 상태: {Pub.InitWebView}");
Func_Login();
///즐겨찾기 목록 갱신
Update_FavoriteSite();
@@ -187,8 +173,6 @@ namespace Project
//사용기록추적
Pub.CheckNRegister3(Application.ProductName, "chi", Application.ProductVersion);
}
void Update_FavoriteSite()
@@ -243,7 +227,7 @@ namespace Project
//220421
FCOMMON.info.Disable_8hourover = Pub.setting.Disable8HourOver;
if (FCOMMON.info.Login.level >= 10) btDev.Visible = true;
if ( FCOMMON.info.Login.level >= 10) btDev.Visible = true;
sbLogin.Text = string.Format("[{0}] ({1}-{2} T:{3}) - ({5}){4}",
FCOMMON.info.Login.title,
@@ -383,9 +367,9 @@ namespace Project
string formkey = "WORKBOOK";
if (!ShowForm(formkey))
{
if (this.webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached)
AddForm(formkey, new Dialog.fJobReport());
else
//if (this.webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached)
// AddForm(formkey, new Dialog.fJobReport());
//else
AddForm(formkey, new FPJ0000.fJobReport());
}