work on resultlists
This commit is contained in:
@@ -3,7 +3,7 @@ Imports System.Windows.Forms
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace Base
|
||||
Public Class ClassMessageBox
|
||||
Public Class BaseErrorHandler
|
||||
Private _Logger As Logger
|
||||
Private _Form As Form
|
||||
|
||||
@@ -17,7 +17,12 @@ Namespace Base
|
||||
|
||||
Public Sub ShowErrorMessage(Exception As Exception)
|
||||
_Logger.Error(Exception)
|
||||
MsgBox(GetMessage(Exception), MsgBoxStyle.Critical, _Form.Text)
|
||||
MessageBox.Show(GetMessage(Exception), _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
End Sub
|
||||
|
||||
Public Sub ShowInfoMessage(Text As String)
|
||||
_Logger.Info(Text)
|
||||
MessageBox.Show(Text, _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||||
End Sub
|
||||
|
||||
Private Function GetMessage(Exception As Exception) As String
|
||||
83
GUIs.Common/Base/BaseRibbonForm.vb
Normal file
83
GUIs.Common/Base/BaseRibbonForm.vb
Normal file
@@ -0,0 +1,83 @@
|
||||
Imports DevExpress.XtraBars.Docking
|
||||
Imports DevExpress.XtraBars.Ribbon
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace Base
|
||||
''' <summary>
|
||||
''' This BaseClass is used to provide common functionality like the Logger or ErrorHandler to all Forms
|
||||
''' To use it, create a form and change the `Inherits` statement in FormName.Designer.vb to this form, eg.:
|
||||
'''
|
||||
''' Partial Class frmExample
|
||||
''' Inherits BaseRibbonForm
|
||||
'''
|
||||
''' ...
|
||||
''' End Class
|
||||
'''
|
||||
''' Only BaseRibbonForms can have panels attached to it!
|
||||
''' </summary>
|
||||
Public Class BaseRibbonForm
|
||||
Inherits RibbonForm
|
||||
|
||||
Private ReadOnly _Logger As Logger
|
||||
Private ReadOnly _ErrorHandler As BaseErrorHandler
|
||||
|
||||
Protected ReadOnly Property Logger As Logger
|
||||
Get
|
||||
Return _Logger
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Sets or gets the ribbon Page that will be shown when the window is visible
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Property DefaultRibbonPage As RibbonPage
|
||||
|
||||
Protected Overrides Sub OnLoad(e As EventArgs)
|
||||
MyBase.OnLoad(e)
|
||||
|
||||
If DefaultRibbonPage IsNot Nothing Then
|
||||
Ribbon.SelectPage(DefaultRibbonPage)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnVisibleChanged(e As EventArgs)
|
||||
MyBase.OnVisibleChanged(e)
|
||||
|
||||
If Visible And DefaultRibbonPage IsNot Nothing Then
|
||||
Ribbon.SelectPage(DefaultRibbonPage)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnActivated(e As EventArgs)
|
||||
MyBase.OnVisibleChanged(e)
|
||||
|
||||
If Visible And DefaultRibbonPage IsNot Nothing Then
|
||||
Ribbon.SelectPage(DefaultRibbonPage)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
' Get the full name of the inheriting form
|
||||
' so the log messages have the right classname
|
||||
Dim oClassName = [GetType]().FullName
|
||||
|
||||
' My.LogConfig is undefined in the designer
|
||||
_Logger = LogConfig?.GetLogger(oClassName)
|
||||
_ErrorHandler = New BaseErrorHandler(_Logger, Me)
|
||||
|
||||
' When you add something, be careful if it
|
||||
' depends on a global var like My.LogConfig
|
||||
' you might need to check for its existence with ?
|
||||
End Sub
|
||||
|
||||
Public Sub ShowErrorMessage(Exception As Exception)
|
||||
_ErrorHandler.ShowErrorMessage(Exception)
|
||||
End Sub
|
||||
|
||||
Public Sub ShowErrorMessage(ErrorMessage As String)
|
||||
_ErrorHandler.ShowErrorMessage(New Exception(ErrorMessage))
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -88,7 +88,10 @@
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Base\ClassMessageBox.vb" />
|
||||
<Compile Include="Base\BaseMessageBox.vb" />
|
||||
<Compile Include="Base\BaseRibbonForm.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Constants.vb" />
|
||||
<Compile Include="DataResultList\DataResultConfig.vb" />
|
||||
<Compile Include="DataResultList\DataResultParams.vb" />
|
||||
|
||||
@@ -27,7 +27,7 @@ Public Class frmDataResultList
|
||||
Private _ActiveGridBand As GridBand = Nothing
|
||||
Private _ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE
|
||||
|
||||
Public Property ShouldReturnToMatchForm As Boolean Implements IResultForm.ShouldReturnToMatchForm
|
||||
Public Property ShouldReturnToPreviousForm As Boolean Implements IResultForm.ShouldReturnToPreviousForm
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DataResultParams)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@@ -43,7 +43,7 @@ Public Class frmDataResultList
|
||||
_Params = Params
|
||||
_ResultLists = Params.Results
|
||||
|
||||
ShouldReturnToMatchForm = False
|
||||
ShouldReturnToPreviousForm = False
|
||||
End Sub
|
||||
|
||||
Private Sub frmDataResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
@@ -234,7 +234,7 @@ Public Class frmDataResultList
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
ShouldReturnToMatchForm = True
|
||||
ShouldReturnToPreviousForm = True
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class frmDocumentResultList
|
||||
Inherits DevExpress.XtraBars.Ribbon.RibbonForm
|
||||
Inherits Base.BaseRibbonForm
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
|
||||
@@ -35,9 +35,11 @@ Public Class frmDocumentResultList
|
||||
|
||||
Private _IsLoading As Boolean = True
|
||||
|
||||
Public Property ShouldReturnToMatchForm As Boolean Implements IResultForm.ShouldReturnToMatchForm
|
||||
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DocumentResultParams)
|
||||
MyBase.New(LogConfig)
|
||||
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
|
||||
@@ -50,8 +52,6 @@ Public Class frmDocumentResultList
|
||||
_Environment = Environment
|
||||
_Params = Params
|
||||
_ResultLists = Params.Results
|
||||
|
||||
ShouldReturnToMatchForm = False
|
||||
End Sub
|
||||
|
||||
Private Sub frmDocumentResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
@@ -481,7 +481,7 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
||||
ShouldReturnToMatchForm = True
|
||||
ShouldReturnToPreviousForm = True
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Public Interface IResultForm
|
||||
Property ShouldReturnToMatchForm As Boolean
|
||||
Property ShouldReturnToPreviousForm As Boolean
|
||||
End Interface
|
||||
|
||||
Reference in New Issue
Block a user