GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — PTZPro/FrmCameraConfig.vb at master · jairbj/PTZPro Expand file tree/ Copy pathFrmCameraConfig.vbMore file actions 121 lines (107 loc) · 3.61 KB / Copy pathFrmCameraConfig.vbFile metadata and controls121 lines (107 loc) · 3.61 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 Imports System.IO Public Class FrmCameraConfig Private modeAdd As Boolean Private fileName As String Public Enum FormMode Add = True Edit = False End Enum Public Sub New(mode As FormMode, fileName As String) ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Me.modeAdd = mode Me.fileName = fileName If Not modeAdd Then loadData() End If End Sub Private Sub btSave_Click(sender As Object, e As EventArgs) Handles btSave.Click If txbName.Text = "" Then MsgBox("Please fill a name for your camera") Return End If If txbIP.Text = "" Then MsgBox("Please fill your camera IP") Return End If If txbPort.Text = "" Then MsgBox("Please fill your camera port") Return End If If Not IsNumeric(txbPort.Text) Then MsgBox("Your camera ip should be a number") Return End If If cmbProtocol.Text = "" Then MsgBox("Please select your camera protocol") Return End If If txbVmixUrl.Text = "" Then numInputNumber.Value = 0 txbVmixUsername.Text = "" txbVmixPassword.Text = "" Else Dim validatedUri As Uri = Nothing If Not Uri.TryCreate(txbVmixUrl.Text, UriKind.Absolute, validatedUri) Then MsgBox("Please fill a valid Vmix URL") Return End If If numInputNumber.Value = 0 Then MsgBox("Vmix input number cannot be zero") Return End If End If If modeAdd Then createFile() End If saveConfig() Dispose() End Sub Public Sub createFile() Dim fileCreated As Boolean = False Do Until fileCreated Dim rand = New System.Random().Next(100000, 999999) fileName = frmMain.dataDir & "\Camera_" & rand & ".ini" If Not File.Exists(fileName) Then File.Create(fileName).Close() fileCreated = True End If Loop End Sub Public Sub saveConfig() Dim camera As New Camera(fileName) camera.name = txbName.Text camera.ip = txbIP.Text camera.port = txbPort.Text Select Case cmbProtocol.Text Case "VISCA TCP" camera.protocol = Camera.ProtocolType.ViscaTCP Case "ONVIF" camera.protocol = Camera.ProtocolType.Onvif End Select camera.vmixApiUrl = txbVmixUrl.Text camera.vmixInputNumber = numInputNumber.Value camera.vmixUsername = txbVmixUsername.Text camera.vmixPassword = txbVmixPassword.Text camera.SaveSettings() End Sub Private Sub loadData() Dim camera As New Camera(fileName) txbName.Text = camera.name txbIP.Text = camera.ip txbPort.Text = camera.port Select Case camera.protocol Case Camera.ProtocolType.ViscaTCP cmbProtocol.Text = "VISCA TCP" Case Camera.ProtocolType.Onvif cmbProtocol.Text = "ONVIF" End Select txbVmixUrl.Text = camera.vmixApiUrl numInputNumber.Value = camera.vmixInputNumber txbVmixUsername.Text = camera.vmixUsername txbVmixPassword.Text = camera.vmixPassword End Sub Private Sub FrmCameraConfig_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub End Class |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |