|
|
|
|
Imports System.ComponentModel
|
|
|
|
|
Imports System.Deployment
|
|
|
|
|
Imports System.Deployment.Application
|
|
|
|
|
|
|
|
|
|
Public Class frmMain
|
|
|
|
|
Private _dataPath As String = System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "Gaesteliste.xml")
|
|
|
|
|
'I should not need this for now - we do not work with mouse pointer rows index for selection but we select them with left-click.
|
|
|
|
|
' and with ctrl select (left click, multi-select!)
|
|
|
|
|
'Private _rowIndex As Integer = 0
|
|
|
|
|
|
|
|
|
|
Private Sub LoadWindowPosition()
|
|
|
|
|
'http://christ-offer.blogspot.co.at/2012/02/vbnet-remember-application-window-size.html
|
|
|
|
|
'TODO: Change this to get loaded from registry. I'm not a huge fan of my.settings ;)
|
|
|
|
|
Dim ptLocation As System.Drawing.Point = My.Settings.WindowLocation
|
|
|
|
|
|
|
|
|
|
If (ptLocation.X = -1) And (ptLocation.Y = -1) Then
|
|
|
|
|
Return
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim bLocationVisible As Boolean = False
|
|
|
|
|
For Each S As Screen In Screen.AllScreens
|
|
|
|
|
If S.Bounds.Contains(ptLocation) Then
|
|
|
|
|
bLocationVisible = True
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
If Not bLocationVisible Then
|
|
|
|
|
Return
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Me.StartPosition = FormStartPosition.Manual
|
|
|
|
|
Me.Location = ptLocation
|
|
|
|
|
Me.Size = My.Settings.WindowSize
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub frmMain_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
|
|
|
Me.GästeDataSet.WriteXml(_dataPath)
|
|
|
|
|
|
|
|
|
|
My.Settings.WindowLocation = Me.Location
|
|
|
|
|
My.Settings.WindowSize = Me.Size
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
|
Try
|
|
|
|
|
Me.GästeDataSet.ReadXml(_dataPath)
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
' do nothing, that file gets created when we close the application ;)
|
|
|
|
|
End Try
|
|
|
|
|
|
|
|
|
|
LoadWindowPosition()
|
|
|
|
|
|
|
|
|
|
' Setting colors of grids to some fancy ones :)
|
|
|
|
|
'TODO: Save some colors in registry.
|
|
|
|
|
Me.DataGridView1.RowsDefaultCellStyle.BackColor = Color.Azure
|
|
|
|
|
Me.DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub InfoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles InfoToolStripMenuItem.Click
|
|
|
|
|
Dim oForm As New frmAbout()
|
|
|
|
|
oForm.ShowDialog()
|
|
|
|
|
oForm.Dispose()
|
|
|
|
|
oForm = Nothing
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
'We should not have to use this any more. but for backup we left this here...
|
|
|
|
|
'Private Sub DataGridView1_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseUp
|
|
|
|
|
' If e.Button = MouseButtons.Right Then
|
|
|
|
|
' Me.DataGridView1.Rows(e.RowIndex).Selected = True
|
|
|
|
|
' Me._rowIndex = e.RowIndex
|
|
|
|
|
' Me.DataGridView1.CurrentCell = Me.DataGridView1.Rows(e.RowIndex).Cells(1)
|
|
|
|
|
' Me.mnuContext.Show(Me.DataGridView1, e.Location)
|
|
|
|
|
' mnuContext.Show(Cursor.Position)
|
|
|
|
|
' End If
|
|
|
|
|
'End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub EintragLöschenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EintragLöschenToolStripMenuItem.Click
|
|
|
|
|
'TODO: Einen Button zum Hinzufügen, eine eigene Form zum Hinzufügen bzw bearbeiten.
|
|
|
|
|
For Each Row As DataGridViewRow In DataGridView1.SelectedRows
|
|
|
|
|
Me.DataGridView1.Rows.RemoveAt(Row.Index)
|
|
|
|
|
Next
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub OnlineHilfeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OnlineHilfeToolStripMenuItem.Click
|
|
|
|
|
Process.Start("http://tmsn.at/?tools&gaesteliste&hilfe")
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub UpdateToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UpdateToolStripMenuItem.Click
|
|
|
|
|
Dim Info As UpdateCheckInfo
|
|
|
|
|
|
|
|
|
|
If ApplicationDeployment.IsNetworkDeployed Then
|
|
|
|
|
Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
|
|
|
|
|
|
|
|
|
|
Info = AD.CheckForDetailedUpdate
|
|
|
|
|
If Info.UpdateAvailable Then
|
|
|
|
|
If MsgBox("Ein Update ist verfügbar und wird jetzt installiert." + Chr(13) + "Die Anwendung wird danach neu gestartet.", vbOKCancel) = vbOK Then
|
|
|
|
|
AD.Update()
|
|
|
|
|
System.Windows.Forms.Application.Restart()
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
MsgBox("Es ist kein Update verfügbar.")
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
MsgBox("Die Anwendung wurde nicht aus dem Internet bezogen und kann daher nicht aktualisiert werden.")
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
End Class
|