mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Add "Move"
- Adjust Function Name
This commit is contained in:
parent
dde5a513d3
commit
d0c281ef35
2 changed files with 16 additions and 24 deletions
|
|
@ -264,8 +264,8 @@
|
|||
<flowlauncher:ResultListBox
|
||||
x:Name="ResultListBox"
|
||||
DataContext="{Binding Results}"
|
||||
MouseMove="FileView_MouseMove"
|
||||
PreviewMouseLeftButtonDown="FileView_PreviewMouseLeftButtonDown"
|
||||
MouseMove="ResultList_MouseMove"
|
||||
PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown"
|
||||
PreviewMouseLeftButtonUp="OnPreviewMouseButtonDown" />
|
||||
</ContentControl>
|
||||
</Border>
|
||||
|
|
|
|||
|
|
@ -390,42 +390,34 @@ namespace Flow.Launcher
|
|||
|
||||
private Point start;
|
||||
|
||||
private void FileView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.start = e.GetPosition(null);
|
||||
}
|
||||
|
||||
private void FileView_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
private void ResultList_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
{
|
||||
if (this.ResultListBox.SelectedItems.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Point mpos = e.GetPosition(null);
|
||||
Vector diff = this.start - mpos;
|
||||
|
||||
var r = (ResultListBox)sender;
|
||||
var d = (DependencyObject)e.OriginalSource;
|
||||
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
|
||||
var result = (ResultViewModel)item?.DataContext;
|
||||
|
||||
if (e.LeftButton == MouseButtonState.Pressed &&
|
||||
Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance &&
|
||||
Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
|
||||
{
|
||||
|
||||
if (this.ResultListBox.SelectedItems.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var r = (ResultListBox)sender;
|
||||
var d = (DependencyObject)e.OriginalSource;
|
||||
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
|
||||
var result = (ResultViewModel)item?.DataContext;
|
||||
|
||||
|
||||
string copyText = string.IsNullOrEmpty(result.Result.CopyText) ? result.Result.SubTitle : result.Result.CopyText;
|
||||
var isFile = File.Exists(copyText);
|
||||
var isFolder = Directory.Exists(copyText);
|
||||
|
||||
//string path = @"D:\test.png";
|
||||
string path = Convert.ToString(copyText);
|
||||
string[] files = { path };
|
||||
string[] files = { copyText };
|
||||
var data = new DataObject(System.Windows.DataFormats.FileDrop, files);
|
||||
//data.SetData(System.Windows.DataFormats.FileDrop, files[0]);
|
||||
DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy);
|
||||
DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy | System.Windows.DragDropEffects.Move);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue