diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb index 27212b94..fe70ab1f 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb @@ -33,9 +33,9 @@ Partial Class frmDocumentResultList Me.BarButtonBack = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem5 = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() - Me.RibbonPageGroupNavigation = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() - Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() - Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroup_Navigation = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroup_Layout = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroup_Export = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.GridControl1 = New DevExpress.XtraGrid.GridControl() @@ -153,30 +153,32 @@ Partial Class frmDocumentResultList ' 'RibbonPage1 ' - Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroupNavigation, Me.RibbonPageGroup1, Me.RibbonPageGroup2}) + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup_Navigation, Me.RibbonPageGroup_Layout, Me.RibbonPageGroup_Export}) Me.RibbonPage1.Name = "RibbonPage1" Me.RibbonPage1.Text = "Ergebnisse" ' - 'RibbonPageGroupNavigation + 'RibbonPageGroup_Navigation ' - Me.RibbonPageGroupNavigation.AllowTextClipping = False - Me.RibbonPageGroupNavigation.ItemLinks.Add(Me.BarButtonBack) - Me.RibbonPageGroupNavigation.Name = "RibbonPageGroupNavigation" - Me.RibbonPageGroupNavigation.Text = "Navigation" + Me.RibbonPageGroup_Navigation.AllowTextClipping = False + Me.RibbonPageGroup_Navigation.ItemLinks.Add(Me.BarButtonBack) + Me.RibbonPageGroup_Navigation.Name = "RibbonPageGroup_Navigation" + Me.RibbonPageGroup_Navigation.Text = "Navigation" ' - 'RibbonPageGroup1 + 'RibbonPageGroup_Layout ' - Me.RibbonPageGroup1.ItemLinks.Add(Me.SwitchMainContainerHorizontal) - Me.RibbonPageGroup1.ItemLinks.Add(Me.SwitchDetailContainerHorizontal) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem5) - Me.RibbonPageGroup1.Name = "RibbonPageGroup1" - Me.RibbonPageGroup1.Text = "Layout" + Me.RibbonPageGroup_Layout.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far + Me.RibbonPageGroup_Layout.ItemLinks.Add(Me.SwitchMainContainerHorizontal) + Me.RibbonPageGroup_Layout.ItemLinks.Add(Me.SwitchDetailContainerHorizontal) + Me.RibbonPageGroup_Layout.ItemLinks.Add(Me.BarButtonItem5) + Me.RibbonPageGroup_Layout.Name = "RibbonPageGroup_Layout" + Me.RibbonPageGroup_Layout.Text = "Layout" ' - 'RibbonPageGroup2 + 'RibbonPageGroup_Export ' - Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItemExportGrid1) - Me.RibbonPageGroup2.Name = "RibbonPageGroup2" - Me.RibbonPageGroup2.Text = "Export" + Me.RibbonPageGroup_Export.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far + Me.RibbonPageGroup_Export.ItemLinks.Add(Me.BarButtonItemExportGrid1) + Me.RibbonPageGroup_Export.Name = "RibbonPageGroup_Export" + Me.RibbonPageGroup_Export.Text = "Export" ' 'RibbonStatusBar ' @@ -380,7 +382,7 @@ Partial Class frmDocumentResultList Friend WithEvents RibbonControl As DevExpress.XtraBars.Ribbon.RibbonControl Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage - Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroup_Layout As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonStatusBar As DevExpress.XtraBars.Ribbon.RibbonStatusBar Friend WithEvents SwitchMainContainerHorizontal As DevExpress.XtraBars.BarToggleSwitchItem Friend WithEvents SwitchDetailContainerHorizontal As DevExpress.XtraBars.BarToggleSwitchItem @@ -396,7 +398,7 @@ Partial Class frmDocumentResultList Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridView Friend WithEvents GridBand3 As DevExpress.XtraGrid.Views.BandedGrid.GridBand Friend WithEvents BarButtonItemExportGrid1 As DevExpress.XtraBars.BarButtonItem - Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroup_Export As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents SplitContainerControl3 As DevExpress.XtraEditors.SplitContainerControl Friend WithEvents DocumentViewer1 As DigitalData.Controls.DocumentViewer.DocumentViewer Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem @@ -406,6 +408,6 @@ Partial Class frmDocumentResultList Friend WithEvents labelResultCount As DevExpress.XtraBars.BarStaticItem Friend WithEvents XtraSaveFileDialog As DevExpress.XtraEditors.XtraSaveFileDialog Friend WithEvents BarButtonBack As DevExpress.XtraBars.BarButtonItem - Friend WithEvents RibbonPageGroupNavigation As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroup_Navigation As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents BarButtonItem5 As DevExpress.XtraBars.BarButtonItem End Class diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb index 57d774bc..94345a22 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb @@ -11,6 +11,7 @@ Imports DigitalData.Modules.Logging Imports DigitalData.Modules.ZooFlow Imports DigitalData.Modules.Language Imports DigitalData.Modules.EDMI.API +Imports DigitalData.Modules.EDMI.API.Client Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraGrid.Views.BandedGrid Imports System.ComponentModel @@ -18,6 +19,15 @@ Imports System.ComponentModel Public Class frmDocumentResultList Implements IResultForm + Private Const COLUMN_ICON = "ICON" + Private Const COLUMN_FILEPATH = "FULL_FILENAME" + Private Const COLUMN_FILENAME = "Filename" + Private Const COLUMN_DOCID = "DocID" + + Private _IsLoading As Boolean = True + Private _IsLegacy As Boolean = True + Private _IDBClient As Client + Private _LogConfig As LogConfig Private _Logger As Logger Private _Config As ConfigManager(Of DocumentResultConfig) @@ -29,14 +39,7 @@ Public Class frmDocumentResultList Private _ActiveGridBand As GridBand = Nothing Private _ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE - Private Const COLUMN_ICON = "ICON" - Private Const COLUMN_FILEPATH = "FULL_FILENAME" - Private Const COLUMN_FILENAME = "Filename" - Private Const COLUMN_DOCID = "DocID" - - Private _IsLoading As Boolean = True - Private _IsLegacy As Boolean = True - Private _IDBClient As Client + Private _DocumentInfo As DocumentInfo = Nothing Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm @@ -60,7 +63,7 @@ Public Class frmDocumentResultList Private Sub MaybeInitIDB() _IsLegacy = Not _Environment.Service.IsActive If _Environment.Service.IsActive Then - Dim oSplit As List(Of String) = _Environment.Service.Address.Split(";").ToList() + Dim oSplit As List(Of String) = _Environment.Service.Address.Split(":").ToList() Dim oAddress As String = oSplit.Item(0) Dim oPort As Integer = oSplit.Item(1) @@ -100,6 +103,7 @@ Public Class frmDocumentResultList ' Initialize Viewer with GDPicture.NET License DocumentViewer1.Init(_LogConfig, _Environment.Settings.GdPictureKey) + AddHandler GridView1.FocusedRowChanged, AddressOf GridView_FocusedRowChanged AddHandler GridView2.FocusedRowChanged, AddressOf GridView_FocusedRowChanged AddHandler GridView3.FocusedRowChanged, AddressOf GridView_FocusedRowChanged @@ -114,6 +118,53 @@ Public Class frmDocumentResultList End Try End Sub + Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) + _ActiveRowHandle = e.FocusedRowHandle + + If e.FocusedRowHandle >= 0 Then + Dim oRow = sender.GetDataRow(e.FocusedRowHandle) + DocumentViewer1.CloseDocument() + + If _IsLegacy Then + LoadFile_Legacy(oRow) + Else + Await LoadFile_IDB(oRow) + End If + End If + End Sub + + Private Sub LoadFile_Legacy(GridRow As DataRow) + Try + Dim oFullPath = GridRow.Item(COLUMN_FILEPATH) + + DocumentViewer1.LoadFile(oFullPath) + Catch ex As Exception + _Logger.Error(ex) + MsgBox("Error while loading file", MsgBoxStyle.Critical, Text) + End Try + End Sub + + Private Async Function LoadFile_IDB(GridRow As DataRow) As Task + Try + Dim oObjectId = GridRow.Item(COLUMN_DOCID) + _DocumentInfo = Await _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId) + + DocumentViewer1.LoadFile(_DocumentInfo.FullPath) + + If _DocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then + DocumentViewer1.SetViewOnly(True) + RibbonPageGroup_Export.Visible = False + Else + DocumentViewer1.SetViewOnly(False) + RibbonPageGroup_Export.Visible = True + End If + Catch ex As Exception + _Logger.Error(ex) + MsgBox("Error while loading file", MsgBoxStyle.Critical, Text) + End Try + End Function + + Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults _IsLoading = True Try @@ -210,32 +261,6 @@ Public Class frmDocumentResultList End Select End Sub - Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) - _ActiveRowHandle = e.FocusedRowHandle - - If _IsLegacy Then - If e.FocusedRowHandle >= 0 Then - DocumentViewer1.CloseDocument() - - Dim oRow = sender.GetDataRow(e.FocusedRowHandle) - Dim oFullPath = oRow.Item(COLUMN_FILEPATH) - - DocumentViewer1.LoadFile(oFullPath) - End If - - Else - If e.FocusedRowHandle >= 0 Then - DocumentViewer1.CloseDocument() - - Dim oRow = sender.GetDataRow(e.FocusedRowHandle) - Dim oObjectId = oRow.Item(COLUMN_DOCID) - - Dim oInfo = Await _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId) - End If - - End If - End Sub - Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable) Dim oDocDatatable As New DataTable Try @@ -607,7 +632,7 @@ Public Class frmDocumentResultList e.Menu.Items.Clear() - For Each oItem In oMenu.GetMenuItems(_IsLegacy) + For Each oItem In oMenu.GetMenuItems(_IsLegacy, _DocumentInfo.AccessRight) e.Menu.Items.Add(oItem) Next End If