diff --git a/FluentTerminal.App/Views/MainPage.xaml.cs b/FluentTerminal.App/Views/MainPage.xaml.cs index b54dbee4..b4c507a1 100644 --- a/FluentTerminal.App/Views/MainPage.xaml.cs +++ b/FluentTerminal.App/Views/MainPage.xaml.cs @@ -73,6 +73,11 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => if (sender != TopTabBar && sender != BottomTabBar) { DraggingHappensFromAnotherWindow = e; + + TerminalView terminal = TerminalContainer.Content as TerminalView; + terminal.DraggingHappens = e; + + } DraggingHappens = e; }); @@ -118,7 +123,7 @@ private void ViewModel_Closed(object sender, EventArgs e) _coreTitleBar = null; Bindings.StopTracking(); - TerminalContainer.Content = null; + // TerminalContainer.Content = null; } private void OnWindowActivated(object sender, WindowActivatedEventArgs e) @@ -242,5 +247,6 @@ private void MainPage_OnKeyDown(object sender, KeyRoutedEventArgs e) ViewModel?.OnWindowKeyDown((int) e.Key, control, alt, shift, meta); } + } } \ No newline at end of file diff --git a/FluentTerminal.App/Views/TerminalView.xaml b/FluentTerminal.App/Views/TerminalView.xaml index 7a3bc35c..e3db649e 100644 --- a/FluentTerminal.App/Views/TerminalView.xaml +++ b/FluentTerminal.App/Views/TerminalView.xaml @@ -14,7 +14,9 @@ mc:Ignorable="d"> - + + + diff --git a/FluentTerminal.App/Views/TerminalView.xaml.cs b/FluentTerminal.App/Views/TerminalView.xaml.cs index 3d7edacf..890e3a67 100644 --- a/FluentTerminal.App/Views/TerminalView.xaml.cs +++ b/FluentTerminal.App/Views/TerminalView.xaml.cs @@ -9,6 +9,9 @@ using Windows.UI.Xaml.Media.Imaging; using Windows.UI; using Microsoft.Toolkit.Mvvm.Messaging; +using Windows.ApplicationModel.DataTransfer; +using System.Threading.Tasks; +using System.Linq; namespace FluentTerminal.App.Views { @@ -19,6 +22,8 @@ public sealed partial class TerminalView : UserControl, { private ITerminalView _terminalView; + public bool DraggingHappens { get; set; } + public TerminalView(TerminalViewModel viewModel) { ViewModel = viewModel; @@ -148,5 +153,18 @@ private void SearchTextBox_LostFocus(object sender, RoutedEventArgs e) if (ViewModel != null) ViewModel.SearchHasFocus = false; } + + private void TermnalDropArea_DragEnter(object sender, DragEventArgs e) + { + e.AcceptedOperation = DataPackageOperation.Link; + + } + + private async void TermnalDropArea_Drop(object sender, DragEventArgs e) + { + var items = await e.DataView.GetStorageItemsAsync(); + + _terminalView.Paste($"\"{items.First().Path}\""); + } } } \ No newline at end of file diff --git a/FluentTerminal.App/Views/XtermTerminalView.xaml.cs b/FluentTerminal.App/Views/XtermTerminalView.xaml.cs index 1d612587..0e41f174 100644 --- a/FluentTerminal.App/Views/XtermTerminalView.xaml.cs +++ b/FluentTerminal.App/Views/XtermTerminalView.xaml.cs @@ -1,5 +1,6 @@ using FluentTerminal.App.Converters; using FluentTerminal.App.Services; +using FluentTerminal.App.Services.Utilities; using FluentTerminal.App.Utilities; using FluentTerminal.App.ViewModels; using FluentTerminal.Models; @@ -13,7 +14,9 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using Windows.ApplicationModel.DataTransfer; using Windows.Foundation; +using Windows.Storage; using Windows.System; using Windows.UI; using Windows.UI.Xaml;