EDMI: Checkin/out
This commit is contained in:
@@ -37,22 +37,22 @@ Public Class frmDocumentResultList
|
||||
|
||||
' Helper Classes
|
||||
Private Client As Client
|
||||
Private Documentloader As DocumentResultList.Loader
|
||||
Private Documentloader As Loader
|
||||
Private ControlManager As AttributeControls
|
||||
Private CheckoutManager As CheckInOut
|
||||
|
||||
Private ReadOnly Config As ConfigManager(Of DocumentResultList.Config)
|
||||
Private ReadOnly Config As ConfigManager(Of Config)
|
||||
Private ReadOnly Environment As Environment
|
||||
Private ReadOnly Filesystem As Modules.Filesystem.File
|
||||
Private ReadOnly GridBuilder As GridBuilder
|
||||
Private ReadOnly FileEx As Modules.Windows.File
|
||||
Private ReadOnly Helpers As DocumentResultList.Helpers
|
||||
Private ReadOnly Params As DocumentResultList.Params
|
||||
Private ReadOnly LayoutManager As DocumentResultList.Layout
|
||||
Private WithEvents Watcher As DocumentResultList.Watcher
|
||||
Private ReadOnly Params As Params
|
||||
Private ReadOnly LayoutManager As Layout
|
||||
Private WithEvents Watcher As Watcher
|
||||
|
||||
' Runtime variables
|
||||
Private Property ResultLists As List(Of DocumentResultList.DocumentResult)
|
||||
Private Property ResultLists As List(Of DocumentResult)
|
||||
|
||||
Private IsLoading As Boolean = True
|
||||
Private _DragBoxFromMouseDown As Rectangle
|
||||
@@ -72,7 +72,11 @@ Public Class frmDocumentResultList
|
||||
Private Property ViewList As List(Of BandedGridView)
|
||||
Private Property OperationMode As OperationMode Implements IResultForm.OperationMode
|
||||
|
||||
|
||||
Public ReadOnly Property Config1 As ConfigManager(Of Config)
|
||||
Get
|
||||
Return Config
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Event NeedsRefresh As EventHandler(Of Integer) Implements IResultForm.NeedsRefresh
|
||||
Public Event ResultsRefreshed As EventHandler(Of List(Of DocumentResultList.DocumentResult))
|
||||
@@ -151,10 +155,12 @@ Public Class frmDocumentResultList
|
||||
'Load config
|
||||
LayoutManager.LoadWindowLocationAndSize(Me)
|
||||
LayoutManager.DockManager_RestoreLayout(DockManager1)
|
||||
SplitContainerControl1.SplitterPosition = Config.Config.SplitContainer1Distance
|
||||
SwitchMainContainerHorizontal.Checked = Config.Config.SplitContainer1Horizontal
|
||||
SplitContainerControl2.SplitterPosition = Config.Config.SplitContainer2Distance
|
||||
SwitchDetailContainerHorizontal.Checked = Config.Config.SplitContainer2Horizontal
|
||||
LayoutManager.Workspace_Restore(WorkspaceManager1)
|
||||
|
||||
SplitContainerControl1.SplitterPosition = Config1.Config.SplitContainer1Distance
|
||||
SwitchMainContainerHorizontal.Checked = Config1.Config.SplitContainer1Horizontal
|
||||
SplitContainerControl2.SplitterPosition = Config1.Config.SplitContainer2Distance
|
||||
SwitchDetailContainerHorizontal.Checked = Config1.Config.SplitContainer2Horizontal
|
||||
|
||||
' Hide options relating to a filepath for zooflow
|
||||
If OperationMode = OperationMode.ZooFlow Then
|
||||
@@ -163,17 +169,17 @@ Public Class frmDocumentResultList
|
||||
RibbonPageGroupFilesystem.Visible = False
|
||||
End If
|
||||
|
||||
If OperationMode = OperationMode.NoAppServer Then
|
||||
DockPanelMetadata.Visibility = Docking.DockVisibility.Hidden
|
||||
End If
|
||||
|
||||
If OperationMode <> OperationMode.NoAppServer Then
|
||||
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
|
||||
CtrlObjectPropertyDialog.Initialize(LogConfig, Me, Client, Environment)
|
||||
|
||||
SwitchMainContainerHorizontal.Visibility = BarItemVisibility.Never
|
||||
SwitchDetailContainerHorizontal.Visibility = BarItemVisibility.Never
|
||||
End If
|
||||
|
||||
If OperationMode = OperationMode.NoAppServer Then
|
||||
DockPanelMetadata.Visibility = Docking.DockVisibility.Hidden
|
||||
End If
|
||||
|
||||
UpdateTotalResults()
|
||||
LoadGridDataAndLayout()
|
||||
|
||||
@@ -195,6 +201,7 @@ Public Class frmDocumentResultList
|
||||
Private Sub frmDocumentResultList_Closing(sender As Object, e As CancelEventArgs) Handles Me.FormClosing
|
||||
Try
|
||||
LayoutManager.GridView_SaveLayout(_ActiveGrid.MainView)
|
||||
LayoutManager.Workspace_Save(WorkspaceManager1)
|
||||
LayoutManager.DockManager_SaveLayout(DockManager1)
|
||||
LayoutManager.SaveWindowLocationAndSize(Me)
|
||||
|
||||
@@ -214,7 +221,7 @@ Public Class frmDocumentResultList
|
||||
Dim oRow = sender.GetDataRow(Helpers.ActiveRowHandle)
|
||||
Dim oObjectId = oRow.ItemEx(Of Long)(ColumnDocumentId, 0)
|
||||
Dim oFullPath = oRow.ItemEx(ColumnFilepath, "")
|
||||
Dim oDocumentInfo As DocumentResultList.Document = Nothing
|
||||
Dim oDocument As DocumentResultList.Document = Nothing
|
||||
|
||||
' Show Ribbon Category
|
||||
If RibbonPageCategoryFile.Visible = False Then
|
||||
@@ -223,41 +230,31 @@ Public Class frmDocumentResultList
|
||||
End If
|
||||
|
||||
' Load DocumentInfo
|
||||
oDocumentInfo = Documentloader.Load(oObjectId, oFullPath)
|
||||
If IsNothing(oDocumentInfo) Then
|
||||
DocumentViewer1.CloseDocument()
|
||||
ErrorHandler.ShowErrorMessage("File could not be loaded!")
|
||||
oDocument = Documentloader.Load(oObjectId, oFullPath)
|
||||
|
||||
If oDocument Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
UpdateRibbonActions(oDocument)
|
||||
|
||||
' Save reference to current document
|
||||
_CurrentDocument = oDocumentInfo
|
||||
_CurrentDocument = oDocument
|
||||
|
||||
' Load Document in Document Viewer
|
||||
Dim oFileName = $"{oObjectId}.{oDocumentInfo.Extension}"
|
||||
DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocumentInfo.Contents))
|
||||
Dim oFileName = $"{oObjectId}.{oDocument.Extension}"
|
||||
DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocument.Contents))
|
||||
If IsNothing(oDocument) Then
|
||||
DocumentViewer1.CloseDocument()
|
||||
ErrorHandler.ShowErrorMessage("File could not be loaded!")
|
||||
|
||||
' Hide Export and filesystem options for view only right
|
||||
If oDocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||
DocumentViewer1.SetViewOnly(True)
|
||||
RibbonPageGroupExport.Visible = False
|
||||
RibbonPageGroupFilesystem.Visible = False
|
||||
Else
|
||||
DocumentViewer1.SetViewOnly(False)
|
||||
RibbonPageGroupExport.Visible = True
|
||||
RibbonPageGroupFilesystem.Visible = True
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
|
||||
'Dim oEntityId = 1
|
||||
'Dim oAttributes = Await ControlManager.GetAttributesForBusinessEntity(oEntityId)
|
||||
'If oAttributes.Count = 0 Then
|
||||
' MsgBox($"Es konnten keine Attribute für das Objekt '{oObjectId}' geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
'End If
|
||||
|
||||
Await CtrlObjectPropertyDialog.LoadObject(oObjectId)
|
||||
|
||||
Dim oCheckoutState = Await CheckOutManager.GetCheckoutState(oObjectId)
|
||||
Dim oCheckoutState = Await CheckoutManager.GetCheckoutState(oObjectId)
|
||||
If oCheckoutState IsNot Nothing Then
|
||||
txtCheckedOutWho.EditValue = oCheckoutState.CheckedOutWho
|
||||
dateCheckedOutWhen.EditValue = oCheckoutState.CheckedOutWhen
|
||||
@@ -266,9 +263,9 @@ Public Class frmDocumentResultList
|
||||
dateCheckedOutWhen.EditValue = Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
RibbonPageCategoryFile.Visible = False
|
||||
RibbonControl.SelectedPage = RibbonPageStart
|
||||
UpdateRibbonActions(Nothing)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorHandler.ShowErrorMessage(ex, "GridView_FocusedRowChanged")
|
||||
@@ -277,6 +274,40 @@ Public Class frmDocumentResultList
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function UpdateRibbonActions(pDocument As DocumentResultList.Document) As Boolean
|
||||
Try
|
||||
If pDocument Is Nothing Then
|
||||
RibbonPageCategoryFile.Visible = False
|
||||
RibbonControl.SelectedPage = RibbonPageStart
|
||||
Return True
|
||||
End If
|
||||
|
||||
' Hide Export and filesystem options for view only right
|
||||
If pDocument.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||
DocumentViewer1.SetViewOnly(True)
|
||||
RibbonPageGroupExport.Visible = False
|
||||
|
||||
If OperationMode = OperationMode.NoAppServer Then
|
||||
RibbonPageGroupFilesystem.Visible = False
|
||||
MenuItemProperties.Visibility = BarItemVisibility.Never
|
||||
End If
|
||||
Else
|
||||
DocumentViewer1.SetViewOnly(False)
|
||||
RibbonPageGroupExport.Visible = True
|
||||
|
||||
If OperationMode = OperationMode.NoAppServer Then
|
||||
RibbonPageGroupFilesystem.Visible = True
|
||||
MenuItemProperties.Visibility = BarItemVisibility.Always
|
||||
End If
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
#Region "Watcher"
|
||||
|
||||
Public Async Sub Watcher_FileOpened(sender As Object, e As DocumentResultList.Watcher.FileOpenedArgs) Handles Watcher.FileOpened
|
||||
@@ -940,29 +971,29 @@ Public Class frmDocumentResultList
|
||||
#Region "Layout"
|
||||
Private Sub SplitContainerControl1_SplitterPositionChanged(sender As Object, e As EventArgs) Handles SplitContainerControl1.SplitterPositionChanged
|
||||
If IsLoading = False Then
|
||||
Config.Config.SplitContainer1Distance = SplitContainerControl1.SplitterPosition
|
||||
Config1.Config.SplitContainer1Distance = SplitContainerControl1.SplitterPosition
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SplitContainerControl2_SplitterPositionChanged(sender As Object, e As EventArgs) Handles SplitContainerControl2.SplitterPositionChanged
|
||||
If IsLoading = False Then
|
||||
Config.Config.SplitContainer2Distance = SplitContainerControl2.SplitterPosition
|
||||
Config1.Config.SplitContainer2Distance = SplitContainerControl2.SplitterPosition
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SwitchMainContainerHorizontal_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchMainContainerHorizontal.CheckedChanged
|
||||
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
|
||||
If Config IsNot Nothing And IsLoading = False Then
|
||||
Config.Config.SplitContainer1Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
If Config1 IsNot Nothing And IsLoading = False Then
|
||||
Config1.Config.SplitContainer1Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SwitchDetailContainerHorizontal2_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchDetailContainerHorizontal.CheckedChanged
|
||||
SplitContainerControl2.Horizontal = SwitchDetailContainerHorizontal.Checked
|
||||
|
||||
If Config IsNot Nothing And IsLoading = False Then
|
||||
Config.Config.SplitContainer2Horizontal = SwitchDetailContainerHorizontal.Checked
|
||||
If Config1 IsNot Nothing And IsLoading = False Then
|
||||
Config1.Config.SplitContainer2Horizontal = SwitchDetailContainerHorizontal.Checked
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Reference in New Issue
Block a user