From 5f24e2a9e132ebc0fa5696f4b08986289a718ef5 Mon Sep 17 00:00:00 2001 From: ms Date: Thu, 5 Dec 2019 08:39:46 +0100 Subject: [PATCH] ThinClient TeamViewer --- Dokumentation/Classes/Class1.vb | 2 +- Dokumentation/Classes/Ext_Programme.vb | 6 +- Dokumentation/Classes/cHost.vb | 2 + Dokumentation/Main.vb | 2 +- .../My Project/Resources.Designer.vb | 2 +- Dokumentation/My Project/Resources.resx | 2 +- Dokumentation/uscntr_TSSitzungen.Designer.vb | 46 ++++++++++-- Dokumentation/uscntr_TSSitzungen.vb | 75 ++++++++++++++----- 8 files changed, 109 insertions(+), 28 deletions(-) diff --git a/Dokumentation/Classes/Class1.vb b/Dokumentation/Classes/Class1.vb index 5f72221..7c1286f 100644 --- a/Dokumentation/Classes/Class1.vb +++ b/Dokumentation/Classes/Class1.vb @@ -35,7 +35,7 @@ Public Class Class1 End Sub Public Shared Function CheckDebug() - Dim Debugoverride As Boolean = False 'wenn True dann Override auf Produktiv! + Dim Debugoverride As Boolean = True 'wenn True dann Override auf Produktiv! Dim Startparameter As String = "" Dim i As Integer For Each s As String In Environment.GetCommandLineArgs diff --git a/Dokumentation/Classes/Ext_Programme.vb b/Dokumentation/Classes/Ext_Programme.vb index 561329d..23a4f56 100644 --- a/Dokumentation/Classes/Ext_Programme.vb +++ b/Dokumentation/Classes/Ext_Programme.vb @@ -45,8 +45,10 @@ Public Shared Function pingip(ip As String, Optional ByVal Argument As String = "") Dim ping As New Process - ping.StartInfo.FileName = "cmd.exe" - ping.StartInfo.Arguments = " /k ping " & ip & Argument + 'ping.StartInfo.FileName = "cmd.exe" + 'ping.StartInfo.Arguments = " /k ping " & ip & Argument + ping.StartInfo.FileName = "powershell.exe" + ping.StartInfo.Arguments = " /noexit /c ping " & ip & Argument ping.Start() End Function diff --git a/Dokumentation/Classes/cHost.vb b/Dokumentation/Classes/cHost.vb index f8dc92b..9c7a23a 100644 --- a/Dokumentation/Classes/cHost.vb +++ b/Dokumentation/Classes/cHost.vb @@ -81,6 +81,8 @@ Public Class cHost list.Add(New SQLVariable("DHCP", DHCP)) 'list.Add(New SQLVariable("Netzwerk", Netzwerk)) list.Add(New SQLVariable("Firewall", Firewall)) + list.Add(New SQLVariable("TeamviewerID", TeamviewerID)) + list.Add(New SQLVariable("TeamviewerKennwort", TeamviewerKennwort)) Return list End Function diff --git a/Dokumentation/Main.vb b/Dokumentation/Main.vb index 7e9267f..ebcf49c 100644 --- a/Dokumentation/Main.vb +++ b/Dokumentation/Main.vb @@ -618,7 +618,7 @@ Public Class Main End Function Private Sub CmdTest_Click(sender As Object, e As EventArgs) Handles CmdTest.Click - cFolder.netdelete("10.4.3.17") + 'cFolder.netdelete("10.4.3.17") End Sub diff --git a/Dokumentation/My Project/Resources.Designer.vb b/Dokumentation/My Project/Resources.Designer.vb index c602b86..a8b8540 100644 --- a/Dokumentation/My Project/Resources.Designer.vb +++ b/Dokumentation/My Project/Resources.Designer.vb @@ -199,7 +199,7 @@ Namespace My.Resources End Property ''' - ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.42 ähnelt. + ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.1.44 ähnelt. ''' Friend ReadOnly Property Version() As String Get diff --git a/Dokumentation/My Project/Resources.resx b/Dokumentation/My Project/Resources.resx index eef800f..a3cdcd6 100644 --- a/Dokumentation/My Project/Resources.resx +++ b/Dokumentation/My Project/Resources.resx @@ -128,7 +128,7 @@ ..\Resources\Bearbeiten20.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - 0.0.1.42 + 0.0.1.44 ..\Resources\Print20x20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Dokumentation/uscntr_TSSitzungen.Designer.vb b/Dokumentation/uscntr_TSSitzungen.Designer.vb index 816bb8a..a236a37 100644 --- a/Dokumentation/uscntr_TSSitzungen.Designer.vb +++ b/Dokumentation/uscntr_TSSitzungen.Designer.vb @@ -35,6 +35,8 @@ Partial Class uscntr_TSSitzungen Me.chkAutoUpdate = New System.Windows.Forms.CheckBox() Me.CmdUpdate = New System.Windows.Forms.Button() Me.Panel2 = New System.Windows.Forms.Panel() + Me.btnClient = New System.Windows.Forms.Button() + Me.btnSitzung = New System.Windows.Forms.Button() Me.btnReset = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.TextBox1 = New System.Windows.Forms.TextBox() @@ -53,13 +55,13 @@ Partial Class uscntr_TSSitzungen Me.dgvTSSitzungen.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvTSSitzungen.ContextMenuStrip = Me.ContextMenuStrip1 Me.dgvTSSitzungen.Dock = System.Windows.Forms.DockStyle.Fill - Me.dgvTSSitzungen.Location = New System.Drawing.Point(0, 36) + Me.dgvTSSitzungen.Location = New System.Drawing.Point(0, 58) Me.dgvTSSitzungen.MultiSelect = False Me.dgvTSSitzungen.Name = "dgvTSSitzungen" Me.dgvTSSitzungen.ReadOnly = True Me.dgvTSSitzungen.RowTemplate.ReadOnly = True Me.dgvTSSitzungen.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect - Me.dgvTSSitzungen.Size = New System.Drawing.Size(365, 197) + Me.dgvTSSitzungen.Size = New System.Drawing.Size(365, 175) Me.dgvTSSitzungen.TabIndex = 0 ' 'ContextMenuStrip1 @@ -161,15 +163,47 @@ Partial Class uscntr_TSSitzungen 'Panel2 ' Me.Panel2.BackColor = System.Drawing.SystemColors.GradientInactiveCaption + Me.Panel2.Controls.Add(Me.btnClient) + Me.Panel2.Controls.Add(Me.btnSitzung) Me.Panel2.Controls.Add(Me.btnReset) Me.Panel2.Controls.Add(Me.Label1) Me.Panel2.Controls.Add(Me.TextBox1) Me.Panel2.Dock = System.Windows.Forms.DockStyle.Top Me.Panel2.Location = New System.Drawing.Point(0, 0) Me.Panel2.Name = "Panel2" - Me.Panel2.Size = New System.Drawing.Size(365, 36) + Me.Panel2.Size = New System.Drawing.Size(365, 58) Me.Panel2.TabIndex = 3 ' + 'btnClient + ' + Me.btnClient.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnClient.BackColor = System.Drawing.Color.DarkGray + Me.btnClient.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer)) + Me.btnClient.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnClient.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.btnClient.Location = New System.Drawing.Point(182, 30) + Me.btnClient.Margin = New System.Windows.Forms.Padding(8) + Me.btnClient.Name = "btnClient" + Me.btnClient.Size = New System.Drawing.Size(79, 20) + Me.btnClient.TabIndex = 15 + Me.btnClient.Text = "Client" + Me.btnClient.UseVisualStyleBackColor = False + ' + 'btnSitzung + ' + Me.btnSitzung.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnSitzung.BackColor = System.Drawing.Color.Green + Me.btnSitzung.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer)) + Me.btnSitzung.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnSitzung.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.btnSitzung.Location = New System.Drawing.Point(103, 30) + Me.btnSitzung.Margin = New System.Windows.Forms.Padding(8) + Me.btnSitzung.Name = "btnSitzung" + Me.btnSitzung.Size = New System.Drawing.Size(79, 20) + Me.btnSitzung.TabIndex = 14 + Me.btnSitzung.Text = "Sitzungen" + Me.btnSitzung.UseVisualStyleBackColor = False + ' 'btnReset ' Me.btnReset.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) @@ -177,7 +211,7 @@ Partial Class uscntr_TSSitzungen Me.btnReset.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer)) Me.btnReset.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.btnReset.Font = New System.Drawing.Font("Microsoft Sans Serif", 6.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnReset.Location = New System.Drawing.Point(276, 8) + Me.btnReset.Location = New System.Drawing.Point(276, 9) Me.btnReset.Margin = New System.Windows.Forms.Padding(8) Me.btnReset.Name = "btnReset" Me.btnReset.Size = New System.Drawing.Size(81, 20) @@ -201,7 +235,7 @@ Partial Class uscntr_TSSitzungen Me.TextBox1.Location = New System.Drawing.Point(103, 8) Me.TextBox1.Margin = New System.Windows.Forms.Padding(8) Me.TextBox1.Name = "TextBox1" - Me.TextBox1.Size = New System.Drawing.Size(157, 20) + Me.TextBox1.Size = New System.Drawing.Size(158, 20) Me.TextBox1.TabIndex = 0 ' 'uscntr_TSSitzungen @@ -241,4 +275,6 @@ Partial Class uscntr_TSSitzungen Friend WithEvents btnReset As Button Friend WithEvents lblAnzahl As Label Friend WithEvents VerbindenMitTeamVToolStripMenuItem As ToolStripMenuItem + Friend WithEvents btnClient As Button + Friend WithEvents btnSitzung As Button End Class diff --git a/Dokumentation/uscntr_TSSitzungen.vb b/Dokumentation/uscntr_TSSitzungen.vb index dc9995f..2456be1 100644 --- a/Dokumentation/uscntr_TSSitzungen.vb +++ b/Dokumentation/uscntr_TSSitzungen.vb @@ -1,29 +1,57 @@ Public Class uscntr_TSSitzungen + Dim Client As Boolean = False + Private Sub uscntr_TSSitzungen_Load(sender As Object, e As EventArgs) Handles Me.Load Class1.EnableDoubleBuffered(dgvTSSitzungen) Load2DGV() End Sub - Function Load2DGV(Optional ByVal WhereString As String = "") - Dim ds As New DataSet - cSQL.SQL2DS("SELECT * FROM TbL_TSSitzungen WHERE Name LIKE '" & ReturnOfTheWhere() & "' OR TSServer LIKE '" & ReturnOfTheWhere() & "' ORDER BY NAME", ds) + Function Load2DGV() ' (Optional ByVal Client As Boolean = False) + If Client = False Then + Dim ds As New DataSet + cSQL.SQL2DS("SELECT * FROM TbL_TSSitzungen WHERE Name LIKE '" & ReturnOfTheWhere() & "' OR TSServer LIKE '" & ReturnOfTheWhere() & "' ORDER BY NAME", ds) + + With dgvTSSitzungen + .RowHeadersVisible = False + .DataSource = ds.Tables(0) + .Columns("Domain").Visible = False + .Columns("LastLogon").Visible = False + .Columns("BenutzerAnmeldeName").Visible = False + + .Columns("Name").Width = 110 'AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + .Columns("TeamviewerID").Width = 80 + .Columns("TSServer").Width = 55 + + .AutoResizeColumn(1) + End With + lblAnzahl.Text = dgvTSSitzungen.Rows.Count + LoadTSServer() + Else + + Dim ds As New DataSet + 'cSQL.SQLCommand("DELETE FROM TbL_ThinClients where LastReport < (dateadd(HOUR, -1, getdate()))") + cSQL.SQL2DS("SELECT * FROM TbL_ThinClients WHERE Name LIKE '" & ReturnOfTheWhere() & "' OR ClientName LIKE '" & ReturnOfTheWhere() & "' ORDER BY NAME", ds) + + With dgvTSSitzungen + .RowHeadersVisible = False + .DataSource = ds.Tables(0) + '.Columns("Domain").Visible = False + '.Columns("LastLogon").Visible = False + '.Columns("BenutzerAnmeldeName").Visible = False + + '.Columns("Name").Width = 110 'AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + '.Columns("TeamviewerID").Width = 80 + '.Columns("TSServer").Width = 55 + + .AutoResizeColumn(1) + End With + lblAnzahl.Text = dgvTSSitzungen.Rows.Count + + End If - With dgvTSSitzungen - .RowHeadersVisible = False - .DataSource = ds.Tables(0) - .Columns("Domain").Visible = False - .Columns("LastLogon").Visible = False - .Columns("BenutzerAnmeldeName").Visible = False - .Columns("Name").Width = 110 'AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill - .Columns("TeamviewerID").Width = 80 - .Columns("TSServer").Width = 55 - .AutoResizeColumn(1) - End With - lblAnzahl.Text = dgvTSSitzungen.Rows.Count - LoadTSServer() End Function Private Sub dgvTSSitzungen_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvTSSitzungen.CellDoubleClick 'dgvTSSitzungen.CellContentDoubleClick, @@ -85,7 +113,7 @@ End Sub Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged - Load2DGV(TextBox1.Text) + Load2DGV() '(TextBox1.Text) End Sub Function ReturnOfTheWhere() @@ -101,4 +129,17 @@ Dim sitzung As String = Class1.DBNull2emptyString(dgvTSSitzungen.CurrentRow.Cells("TeamviewerID").Value) Ext_Programme.StartTeamviewer(sitzung) End Sub + + Private Sub btnClick(sender As Object, e As EventArgs) Handles btnSitzung.Click, btnClient.Click + Select Case sender.name + Case "btnSitzung" + btnSitzung.BackColor = Color.Green : btnClient.BackColor = Color.DarkGray + Client = False + Case "btnClient" + btnClient.BackColor = Color.Red : btnSitzung.BackColor = Color.DarkGray + Client = True + End Select + cmdNachricht.Enabled = Not Client + Load2DGV() + End Sub End Class