diff --git a/app/DD_Clipboard_Searcher/ctrlApplicationAssignment.vb b/app/DD_Clipboard_Searcher/ctrlApplicationAssignment.vb index 72a58d0..6741397 100644 --- a/app/DD_Clipboard_Searcher/ctrlApplicationAssignment.vb +++ b/app/DD_Clipboard_Searcher/ctrlApplicationAssignment.vb @@ -7,10 +7,10 @@ Imports DigitalData.Controls.RegexEditor Imports DigitalData.Modules.Windows.Window Public Class ctrlApplicationAssignment - Public SelectedProfileId As Integer = 0 - Public SelectedProcessId As Integer = 0 - Public SelectedWindowId As Integer = 0 - Public SelectedControlId As Integer = 0 + Public Property SelectedProfileId As Integer = 0 + Public Property SelectedProcessId As Integer = 0 + Public Property SelectedWindowId As Integer = 0 + Public Property SelectedControlId As Integer = 0 Private Sub ctrlApplicationAssignment_Load(sender As Object, e As EventArgs) Handles Me.Load TBCW_PROFILE_PROCESSTableAdapter.Connection.ConnectionString = MyConnectionString @@ -352,6 +352,7 @@ Public Class ctrlApplicationAssignment MyDataset.TBCW_PROF_REL_WINDOW.Clear() If e.FocusedRowHandle < 0 Then + SelectedProcessId = 0 Exit Sub End If @@ -377,17 +378,18 @@ Public Class ctrlApplicationAssignment Private Sub GridView_Window_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Window.FocusedRowChanged Try If e.FocusedRowHandle < 0 Then + SelectedWindowId = 0 Exit Sub End If Dim oSelectedRow As DataRow = GridView_Window.GetDataRow(e.FocusedRowHandle) Dim oWindowId As String = oSelectedRow.Item("GUID") + SelectedWindowId = oWindowId + If Control_Load() = False Then MsgBox($"Error while loading controls for window {oWindowId}", vbCritical, "") End If - - SelectedWindowId = oWindowId Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) End Try @@ -395,7 +397,7 @@ Public Class ctrlApplicationAssignment Private Sub GridView_Control_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Control.FocusedRowChanged If e.FocusedRowHandle < 0 Then - SelectedControlId = Nothing + SelectedControlId = 0 Exit Sub End If diff --git a/app/DD_Clipboard_Searcher/frmAdministration.vb b/app/DD_Clipboard_Searcher/frmAdministration.vb index 6b7bd96..ea5b9de 100644 --- a/app/DD_Clipboard_Searcher/frmAdministration.vb +++ b/app/DD_Clipboard_Searcher/frmAdministration.vb @@ -679,6 +679,10 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem24_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem24.ItemClick + If CtrlApplicationAssignment1.SelectedControlId = 0 Then + Exit Sub + End If + If MsgBox($"Wollen Sie die Feld-Zuordnung löschen?", MsgBoxStyle.Exclamation Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.No Then Exit Sub End If @@ -691,6 +695,10 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem25_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem25.ItemClick + If CtrlApplicationAssignment1.SelectedControlId = 0 Then + Exit Sub + End If + If CtrlApplicationAssignment1.Control_SaveAssignment() = False Then MsgBox("Error while saving control", MsgBoxStyle.Critical, Text) Else @@ -699,6 +707,10 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem27_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem27.ItemClick + If CtrlApplicationAssignment1.SelectedControlId = 0 Then + Exit Sub + End If + If CtrlApplicationAssignment1.Control_EditAssignment() = False Then MsgBox("Error while saving control", MsgBoxStyle.Critical, Text) Else @@ -716,8 +728,4 @@ Public Class frmAdministration MsgBox("Profile has been duplicated. Please check the dependencies!", MsgBoxStyle.Information) End If End Sub - - Private Sub GridViewProfiles_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewProfiles.FocusedRowChanged - - End Sub End Class \ No newline at end of file