add webhosting
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports System.IO
|
||||
Imports Eco2Ar.WebServer
|
||||
|
||||
Public Class MdiMain
|
||||
|
||||
@@ -20,9 +21,17 @@ Public Class MdiMain
|
||||
|
||||
'''현재열려있는폼의 이름을 변경한다.
|
||||
Public OpenedForm As E_MenuIdx = E_MenuIdx.NONE
|
||||
Private webServer As StaticFileServer
|
||||
|
||||
Private Sub MdiMain_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
|
||||
pLog.Add("FormClosed", True)
|
||||
|
||||
' 웹 서버 정리
|
||||
If webServer IsNot Nothing Then
|
||||
webServer.Stop()
|
||||
webServer.Dispose()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub MdiMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
|
||||
@@ -243,6 +252,20 @@ Public Class MdiMain
|
||||
|
||||
pLog.Add("Program Start")
|
||||
|
||||
Try
|
||||
' 웹 서버 초기화 및 시작
|
||||
Dim wwwPath = Path.Combine(Application.StartupPath, "wwwroot")
|
||||
webServer = New StaticFileServer(wwwPath, 58123)
|
||||
webServer.Start()
|
||||
If System.Diagnostics.Debugger.IsAttached Then
|
||||
webServer.OpenInBrowser()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
' 웹 서버 시작 실패해도 프로그램은 계속 실행
|
||||
Debug.WriteLine("웹 서버 시작 실패: " & ex.Message)
|
||||
End Try
|
||||
|
||||
|
||||
If Me.bt_etc.Visible = False AndAlso System.Diagnostics.Debugger.IsAttached Then
|
||||
MsgBox("debugmode import on")
|
||||
Me.bt_etc.Visible = True
|
||||
|
||||
Reference in New Issue
Block a user