Imports System
Imports System.IO
Imports System.Windows.Forms

Public Module Program
    <STAThread>
    Public Sub Main()
        Try
            Application.SetHighDpiMode(HighDpiMode.PerMonitorV2)
            Application.EnableVisualStyles()
            Application.SetCompatibleTextRenderingDefault(False)
            Application.Run(New MainForm())
        Catch ex As Exception
            Dim logPath As String = Path.Combine(AppContext.BaseDirectory, "launcher-startup-error.log")
            File.WriteAllText(logPath, ex.ToString())
            MessageBox.Show(
                "Aplikasi gagal saat startup." & Environment.NewLine &
                "Log:" & Environment.NewLine & logPath & Environment.NewLine & Environment.NewLine &
                ex.Message,
                "Portfolio Suite Launcher",
                MessageBoxButtons.OK,
                MessageBoxIcon.Error
            )
            Environment.ExitCode = 1
        End Try
    End Sub
End Module
