Public Class MainForm

    Private m_objServerSIP As cVaxServerExCOM = New cVaxServerExCOM()

    Public Sub New()
        InitializeComponent()
        m_objServerSIP.m_RefMainForm = Me
    End Sub

    Private Sub BtnInit_Click(sender As Object, e As EventArgs) Handles BtnInit.Click

        If BtnInit.Text = "Stop" Then

            m_objServerSIP.StopServer()
            SetStatus("Server stopped.")

            BtnInit.Text = "Start"
            Return

        End If

        Dim bResult As Boolean = m_objServerSIP.StartServer(Convert.ToInt32(EditListenPort.Text))

        If bResult = False Then
            SetStatus("Server is not running [Failed]")
            Return
        End If

        SetStatus("Server is running successfully.")
        BtnInit.Text = "Stop"

    End Sub

    Private Sub BtnAddLine_Click(sender As Object, e As EventArgs) Handles BtnAddLine.Click
        ' m_objServerSIP.AddLine("TestLine", cVaxServerCOM.VAX_LINE_TYPE_UDP, "", "", "7090", "7090", "", "192.168.0.119", 5060, "32")
        ' m_objServerSIP.RegisterLine("TestLine", 1800)
    End Sub

    Public Sub SetStatus(ByVal sStatus As String)
        ListBoxStatus.Items.Add(sStatus)
    End Sub

    Private Sub BtnClearLog_Click(sender As Object, e As EventArgs) Handles BtnClearLog.Click
        ListBoxStatus.Items.Clear()
    End Sub

End Class
