neu
This commit is contained in:
198
VERAG_TELEINFO/Form1.vb
Normal file
198
VERAG_TELEINFO/Form1.vb
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text
|
||||
Imports JulMar.Atapi
|
||||
|
||||
Public Class Form1
|
||||
WithEvents myTapi As JulMar.Atapi.TapiManager
|
||||
|
||||
|
||||
Dim myLine As JulMar.Atapi.TapiLine
|
||||
Dim myCall As JulMar.Atapi.TapiCall
|
||||
|
||||
Private Sub frmEinstellungen_Tapi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
myTapi = New TapiManager("VERAG_TELEINFO")
|
||||
|
||||
AddHandler myTapi.CallStateChanged, AddressOf myCallState
|
||||
|
||||
|
||||
Try
|
||||
If Not myTapi.Initialize Then
|
||||
Console.WriteLine("TAPI-Initialize failed")
|
||||
Exit Sub
|
||||
Else
|
||||
|
||||
myLine = myTapi.GetLineByName("Andreas Luxbauer EDV (135)", True)
|
||||
myLine.Open(MediaModes.All)
|
||||
|
||||
'Dim lineArray As TapiLine() = myTapi.Lines
|
||||
'Dim i As Integer = 0
|
||||
'Dim x As String
|
||||
|
||||
|
||||
'For i = 0 To lineArray.Length - 1
|
||||
' Dim line As TapiLine = lineArray(i)
|
||||
' If i = 0 Then
|
||||
' x = "OPEN.....: "
|
||||
' line.Monitor()
|
||||
' myLine = line
|
||||
' Else
|
||||
' x = "NOT OPEN.: "
|
||||
' End If
|
||||
|
||||
' Console.WriteLine(x & line.Name)
|
||||
'Next
|
||||
End If
|
||||
|
||||
'--- Wait here ---
|
||||
Console.ReadLine()
|
||||
|
||||
'--- Exit TAPI ---
|
||||
'myTapi.Shutdown()
|
||||
|
||||
|
||||
'myLine = myTapi.GetLineByName("Andreas Luxbauer EDV (135)", True)
|
||||
''myLine = myTapi.GetLineByName("135", True)
|
||||
|
||||
'myTapi.Initialize()
|
||||
|
||||
|
||||
'myLine.Open(MediaModes.All)
|
||||
|
||||
|
||||
|
||||
'myTapi.
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
'threadsicherer Aufruf
|
||||
Delegate Sub SetLabStatusCallback(txt As String)
|
||||
Private Sub SetLabStatus(txt As String)
|
||||
If Me.InvokeRequired Then
|
||||
Dim d As New SetLabStatusCallback(AddressOf SetLabStatus)
|
||||
Try
|
||||
Me.Invoke(d, New Object() {txt})
|
||||
Catch ex As Exception : End Try
|
||||
Else
|
||||
lblStatus.Text = txt
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
'Private Delegate Sub DelegateLabstatus(ByVal txt As String)
|
||||
'Private DLabStatus As New DelegateLabstatus(AddressOf SetLabStatus)
|
||||
'Private Sub SetLabStatus(ByVal txt As String)
|
||||
' If Me.InvokeRequired Then
|
||||
' Me.Invoke(DLabStatus, New Object() {txt})
|
||||
' Else
|
||||
' Me.lblStatus.Text = txt
|
||||
' End If
|
||||
'End Sub
|
||||
Private Sub myCallState(ByVal sender As Object, ByVal e As CallStateEventArgs) Handles myTapi.CallStateChanged
|
||||
Console.WriteLine(e.CallState)
|
||||
Select Case e.CallState
|
||||
Case CallState.Busy
|
||||
SetLabStatus("Teilnehmer besetzt.")
|
||||
Case CallState.Connected
|
||||
SetLabStatus("Verbunden")
|
||||
Case CallState.Dialing
|
||||
SetLabStatus("Nummer wird gewählt...")
|
||||
Case CallState.Disconnected
|
||||
SetLabStatus("Disconnected")
|
||||
Case CallState.Idle
|
||||
SetLabStatus("Idle")
|
||||
Case CallState.Ringback, CallState.Offering, CallState.Accepted '??
|
||||
SetLabStatus("Läutet...")
|
||||
Case CallState.Proceeding
|
||||
SetLabStatus("Anruf in Arbeit...")
|
||||
Case Else
|
||||
SetLabStatus(e.CallState)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
|
||||
' myLine.Open(MediaModes.Video)
|
||||
myLine.MakeCall("06644178557")
|
||||
|
||||
'myLine.Capabilities.MediaModes.= MediaModes.Video
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnTapi_Click(sender As Object, e As EventArgs) Handles btnTapi.Click
|
||||
frmTapi.Show()
|
||||
End Sub
|
||||
End Class
|
||||
'Public Class Form1
|
||||
' Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
|
||||
' ' Try
|
||||
|
||||
' MsgBox(PlathosysApiWrapper.Plathosys.ApiVersionNumber())
|
||||
|
||||
' Dim VendorID = Nothing '&H299D '&H0x299D
|
||||
' 'Dim VendorID = 665
|
||||
' Dim ProductID = Nothing '&H1 '0
|
||||
' Dim GotVendorID = Nothing '-1
|
||||
' Dim GotProductID = Nothing '-1
|
||||
' Dim GotProductName As StringBuilder = Nothing
|
||||
' Dim gotSerialNumber As StringBuilder = Nothing
|
||||
|
||||
' Dim HookPttInfo = -1
|
||||
' PlathosysApiWrapper.Plathosys.ReadHookAndPTT(HookPttInfo)
|
||||
' MsgBox(HookPttInfo)
|
||||
|
||||
' 'PlathosysApiWrapper.Plathosys.Closedevice()
|
||||
' Try
|
||||
|
||||
' PlathosysApiWrapper.Plathosys.Opendevice(VendorID, ProductID, GotVendorID, GotProductID, GotProductName, gotSerialNumber)
|
||||
|
||||
' Catch ex As Exception
|
||||
' MsgBox(ex.Message & ex.StackTrace)
|
||||
' End Try
|
||||
|
||||
' MsgBox(GotVendorID)
|
||||
' MsgBox(GotProductID)
|
||||
|
||||
' ' Catch ex As Exception
|
||||
' ' MsgBox(ex.Message & ex.StackTrace)
|
||||
' ' End Try
|
||||
' End Sub
|
||||
|
||||
|
||||
|
||||
' '<DllImport("PlathosysApi.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
|
||||
' 'Public Shared Function Opendevice(ByRef VendorID As Integer, ByRef ProductID As Integer, ByRef Optional GotVendorID As Integer = -1, ByRef Optional GotProductID As Integer = -1, ByRef Optional GotProductName As String = "") As IntPtr
|
||||
|
||||
' 'End Function
|
||||
|
||||
' 'Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
|
||||
' ' Dim VendorID = -1
|
||||
' ' Dim ProductID = -1
|
||||
' ' Dim GotVendorID = -1
|
||||
' ' Dim GotProductID = -1
|
||||
' ' Dim GotProductName = ""
|
||||
' ' Opendevice(VendorID, ProductID, GotVendorID, GotProductID, GotProductName)
|
||||
|
||||
' ' MsgBox(GotProductName)
|
||||
' 'End Sub
|
||||
|
||||
' ''Public Shared Sub LoadNativeAssemblies(ByVal rootApplicationPath As String)
|
||||
' '' Dim nativeBinaryPath = If(IntPtr.Size > 4, Path.Combine(rootApplicationPath, "SqlServerTypes\x64\"), Path.Combine(rootApplicationPath, "SqlServerTypes\x86\"))
|
||||
' '' LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll")
|
||||
' '' LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll")
|
||||
' ''End Sub
|
||||
|
||||
' ''Private Shared Sub LoadNativeAssembly(ByVal nativeBinaryPath As String, ByVal assemblyName As String)
|
||||
' '' Dim path = System.IO.Path.Combine(nativeBinaryPath, assemblyName)
|
||||
' '' Dim ptr = LoadLibrary(path)
|
||||
|
||||
' '' If ptr = IntPtr.Zero Then
|
||||
' '' Throw New Exception(String.Format("Error loading {0} (ErrorCode: {1})", assemblyName, Marshal.GetLastWin32Error()))
|
||||
' '' End If
|
||||
' ''End Sub
|
||||
' End Class
|
||||
Reference in New Issue
Block a user