diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-25 00:26:47 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-25 00:26:47 +0200 |
| commit | 42c06402ff6648c356fba8315958283762ed2542 (patch) | |
| tree | 24edf6b746afef0f3a7887e8d83d371d3cf351dc /Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs | |
| parent | c7ceaf96e0ae6d8cb0e1ae7373e6a054f72f52cd (diff) | |
| download | Tango-42c06402ff6648c356fba8315958283762ed2542.tar.gz Tango-42c06402ff6648c356fba8315958283762ed2542.zip | |
Added Download menu implementation to file system.
Added several stun and turn servers to web rtc.
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs b/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs index c624178a0..3660a18f0 100644 --- a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs +++ b/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs @@ -105,6 +105,22 @@ namespace Tango.FileSystem public static readonly DependencyProperty DeleteCommandInternalProperty = DependencyProperty.Register("DeleteCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null)); + public ICommand NewFolderCommandInternal + { + get { return (ICommand)GetValue(NewFolderCommandInternalProperty); } + set { SetValue(NewFolderCommandInternalProperty, value); } + } + public static readonly DependencyProperty NewFolderCommandInternalProperty = + DependencyProperty.Register("NewFolderCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null)); + + public ICommand NewFolderCommand + { + get { return (ICommand)GetValue(NewFolderCommandProperty); } + set { SetValue(NewFolderCommandProperty, value); } + } + public static readonly DependencyProperty NewFolderCommandProperty = + DependencyProperty.Register("NewFolderCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null)); + public ICommand DropCommand { get { return (ICommand)GetValue(DropCommandProperty); } @@ -273,7 +289,6 @@ namespace Tango.FileSystem public static readonly DependencyProperty SelectionModeProperty = DependencyProperty.Register("SelectionMode", typeof(SelectionMode), typeof(FileExplorerControl), new PropertyMetadata(SelectionMode.Extended)); - static FileExplorerControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(FileExplorerControl), new FrameworkPropertyMetadata(typeof(FileExplorerControl))); @@ -343,21 +358,43 @@ namespace Tango.FileSystem OpenCommand = new RelayCommand(() => { ItemDoubleClickedCommand?.Execute(SelectedItems.FirstOrDefault()); - }, () => SelectedItems != null && SelectedItems.Count == 1); + }, () => + { + return SelectedItems != null && SelectedItems.Count == 1; + }); DeleteCommandInternal = new RelayCommand(() => { DeleteCommand?.Execute(SelectedItems.ToList()); - }, () => SelectedItems != null && SelectedItems.Count > 1 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive)); + }, () => SelectedItems != null && SelectedItems.Count > 0 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive)); - RenameCommandInternal = new RelayCommand(() => + RenameCommandInternal = new RelayCommand(() => { RenameCommand?.Execute(SelectedItems.FirstOrDefault()); }, () => SelectedItems != null && SelectedItems.Count == 1 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive)); + + NewFolderCommandInternal = new RelayCommand(() => + { + NewFolderCommand?.Execute(null); + }, + () => + { + if (CurrentItem == null) return false; + + if (CurrentItem is FolderItem) + { + if ((CurrentItem as FolderItem).IsRoot) + { + return false; + } + } + + return true; + }); } private void OnIsContextMenuOpenedChanged() @@ -370,6 +407,7 @@ namespace Tango.FileSystem (OpenCommand as RelayCommand)?.RaiseCanExecuteChanged(); (DeleteCommandInternal as RelayCommand)?.RaiseCanExecuteChanged(); (RenameCommandInternal as RelayCommand)?.RaiseCanExecuteChanged(); + (NewFolderCommandInternal as RelayCommand)?.RaiseCanExecuteChanged(); if (IsContextMenuOpened) { @@ -479,6 +517,13 @@ namespace Tango.FileSystem DownloadCommandInternal.Execute(null); } } + else if (e.Key == Key.N && Keyboard.IsKeyDown(Key.LeftCtrl)) + { + if (NewFolderCommandInternal != null && NewFolderCommandInternal.CanExecute(null)) + { + DownloadCommandInternal.Execute(null); + } + } else if (e.Key == Key.F2) { if (RenameCommandInternal != null && RenameCommandInternal.CanExecute(null)) |
