Common/DocumentResultList: Add Dragdrop from Window to outside, check for rights on doubleclick
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Drawing
|
||||
Imports System.IO
|
||||
Imports System.Windows.Forms
|
||||
Imports DevExpress.Utils
|
||||
@@ -575,7 +576,7 @@ Public Class frmDocumentResultList
|
||||
Dim oRow = GetActiveRow()
|
||||
|
||||
If oRow IsNot Nothing Then
|
||||
Dim oFilename = oRow.Item(COLUMN_FILEPATH)
|
||||
Dim oFilename = _DocumentInfo.FullPath
|
||||
Dim oDirectory = IO.Path.GetDirectoryName(oFilename)
|
||||
Process.Start(oDirectory)
|
||||
End If
|
||||
@@ -602,7 +603,7 @@ Public Class frmDocumentResultList
|
||||
Dim oRow = GetActiveRow()
|
||||
|
||||
If oRow IsNot Nothing Then
|
||||
Dim oFilename = oRow.Item(COLUMN_FILEPATH)
|
||||
Dim oFilename = _DocumentInfo.FullPath
|
||||
Clipboard.SetText(oFilename)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -657,7 +658,9 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub GridControl_DoubleClick(sender As Object, e As EventArgs) Handles GridControl1.DoubleClick, GridControl2.DoubleClick, GridControl3.DoubleClick
|
||||
OpenFile()
|
||||
If _DocumentInfo IsNot Nothing And _DocumentInfo.AccessRight > Rights.AccessRight.VIEW_ONLY Then
|
||||
OpenFile()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridView_PopupMenuShowing(sender As Object, e As PopupMenuShowingEventArgs) _
|
||||
@@ -668,7 +671,7 @@ Public Class frmDocumentResultList
|
||||
If e.MenuType = GridMenuType.Row Then
|
||||
Dim oRowHandle = e.HitInfo.RowHandle
|
||||
Dim oRow As DataRow = oView.GetDataRow(oRowHandle)
|
||||
Dim oFilepath As String = oRow.Item(COLUMN_FILEPATH)
|
||||
Dim oFilepath As String = _DocumentInfo.FullPath
|
||||
Dim oObjectId As Long = oRow.Item(COLUMN_DOCID)
|
||||
Dim oMenu As New DocumentPropertyMenu(_LogConfig, _Environment, _IDBClient, oFilepath, oObjectId)
|
||||
|
||||
@@ -749,8 +752,8 @@ Public Class frmDocumentResultList
|
||||
If Not IsNothing(_ActiveGrid) Then
|
||||
Try
|
||||
Dim oFile = GetDevexpressGrid_LayoutName(_ActiveGrid.MainView)
|
||||
If IO.File.Exists(oFile) Then
|
||||
IO.File.Delete(oFile)
|
||||
If File.Exists(oFile) Then
|
||||
File.Delete(oFile)
|
||||
End If
|
||||
UpdateGridData()
|
||||
Catch ex As Exception
|
||||
@@ -762,4 +765,39 @@ Public Class frmDocumentResultList
|
||||
Private Sub frmDocumentResultList_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
GridViewSave_Layout(_ActiveGrid.MainView)
|
||||
End Sub
|
||||
|
||||
Private _DragBoxFromMouseDown As Rectangle
|
||||
Private _ScreenOffset As Point
|
||||
|
||||
Private Sub GridView1_MouseDown(sender As GridView, e As MouseEventArgs) Handles GridView1.MouseDown
|
||||
If sender.FocusedRowHandle >= 0 Then
|
||||
Dim oDragSize As Size = SystemInformation.DragSize
|
||||
|
||||
_DragBoxFromMouseDown = New Rectangle(New Point(e.X - (oDragSize.Width / 2),
|
||||
e.Y - (oDragSize.Height / 2)), oDragSize)
|
||||
|
||||
Else
|
||||
_DragBoxFromMouseDown = Rectangle.Empty
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_MouseUp(sender As GridView, e As MouseEventArgs) Handles GridView1.MouseUp
|
||||
_DragBoxFromMouseDown = Rectangle.Empty
|
||||
End Sub
|
||||
|
||||
Private Sub GridView1_MouseMove(sender As GridView, e As MouseEventArgs) Handles GridView1.MouseMove
|
||||
If e.Button AndAlso e.Button = MouseButtons.Left Then
|
||||
If _DragBoxFromMouseDown <> Rectangle.Empty And Not _DragBoxFromMouseDown.Contains(e.X, e.Y) Then
|
||||
If _DocumentInfo IsNot Nothing AndAlso _DocumentInfo.AccessRight > Rights.AccessRight.VIEW_ONLY Then
|
||||
_ScreenOffset = SystemInformation.WorkingArea.Location
|
||||
|
||||
Dim oFullPath As String = _DocumentInfo.FullPath
|
||||
Dim oFiles As String() = {oFullPath}
|
||||
Dim oData As New DataObject(DataFormats.FileDrop, oFiles)
|
||||
|
||||
sender.GridControl.DoDragDrop(oData, DragDropEffects.All)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user