Files
ECO2/ArinWarev1/Forms_Basic/Frm_WebManual.vb
LGram16 40842778e0 WebView2 통합 및 Fixed Version 배포 방식 구현
- WebView2 Fixed Version 지원 추가 (오프라인 환경 대응)
- Frm_WebManual에 InitializeWebView2Async() 구현
  - WebView2Runtime 폴더 우선 사용 (Fixed Version)
  - 시스템 런타임으로 폴백
- MdiMain에 CheckWebView2Runtime() 추가
- Setup1.vdproj에 .NET Framework 4.8 배포 설정 반영
- .gitignore에 WebView2Runtime/, WebView2Data/ 추가
- claudedocs/WebView2_Deployment_Guide.md 배포 가이드 추가
  - Fixed Version 다운로드 및 배포 방법
  - 테스트 및 문제 해결 가이드

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 16:53:42 +09:00

65 lines
2.5 KiB
VB.net

Imports System.IO
Imports System.Threading.Tasks
Imports Microsoft.Web.WebView2.Core
Public Class Frm_WebManual
Public Sub Navigate(url As String)
Try
If WebView21 IsNot Nothing AndAlso WebView21.CoreWebView2 IsNot Nothing Then
WebView21.CoreWebView2.Navigate(url)
End If
Catch ex As Exception
MessageBox.Show("웹페이지 이동 중 오류가 발생했습니다: " & ex.Message,
"오류", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Async Sub Frm_WebManual_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
' WebView2 초기화 (Runtime이 없으면 자동 다운로드)
Await InitializeWebView2Async()
' 로컬 웹서버 페이지 로드
If WebView21.CoreWebView2 IsNot Nothing Then
WebView21.CoreWebView2.Navigate("http://localhost:58123/")
End If
Catch ex As Exception
MessageBox.Show("웹페이지 로드 중 오류가 발생했습니다: " & ex.Message,
"오류", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Async Function InitializeWebView2Async() As Task
Try
' Fixed Version 경로 설정
Dim fixedVersionPath = Path.Combine(Application.StartupPath, "WebView2Runtime")
Dim userDataFolder = Path.Combine(Application.StartupPath, "WebView2Data")
' Fixed Version이 있는지 확인
If Directory.Exists(fixedVersionPath) Then
' Fixed Version 사용
Dim env = Await CoreWebView2Environment.CreateAsync(fixedVersionPath, userDataFolder)
Await WebView21.EnsureCoreWebView2Async(env)
Else
' 시스템에 설치된 Runtime 사용 (폴백)
Await WebView21.EnsureCoreWebView2Async(Nothing)
End If
Catch ex As Exception
' WebView2 Runtime을 찾을 수 없는 경우
MessageBox.Show(
"WebView2 구성 요소를 찾을 수 없습니다." & vbCrLf & vbCrLf &
"프로그램 설치가 올바르지 않을 수 있습니다." & vbCrLf &
"관리자에게 문의하시기 바랍니다.",
"오류",
MessageBoxButtons.OK,
MessageBoxIcon.Error)
Me.Close()
End Try
End Function
End Class