mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Simplified teh ConnectionWindow drag_over handler and made it safer (actually does type checking)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using BrightIdeasSoftware;
|
||||
using mRemoteNG.Connection;
|
||||
@@ -53,7 +54,6 @@ namespace mRemoteNG.UI.Window
|
||||
TabController.ClosePressed += TabController_ClosePressed;
|
||||
TabController.DoubleClickTab += TabController_DoubleClickTab;
|
||||
TabController.DragDrop += TabController_DragDrop;
|
||||
TabController.DragEnter += TabController_DragEnter;
|
||||
TabController.DragOver += TabController_DragOver;
|
||||
TabController.SelectionChanged += TabController_SelectionChanged;
|
||||
TabController.MouseUp += TabController_MouseUp;
|
||||
@@ -565,16 +565,13 @@ namespace mRemoteNG.UI.Window
|
||||
}
|
||||
}
|
||||
|
||||
private void TabController_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", true))
|
||||
{
|
||||
e.Effect = DragDropEffects.Move;
|
||||
}
|
||||
}
|
||||
|
||||
private void TabController_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
var dropDataAsOlvDataObject = e.Data as OLVDataObject;
|
||||
var modelObjects = dropDataAsOlvDataObject?.ModelObjects;
|
||||
if (modelObjects == null) return;
|
||||
if (!modelObjects.OfType<ConnectionInfo>().Any()) return;
|
||||
e.Effect = DragDropEffects.Move;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user