aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.FileSystem
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-03-25 00:26:47 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-03-25 00:26:47 +0200
commit42c06402ff6648c356fba8315958283762ed2542 (patch)
tree24edf6b746afef0f3a7887e8d83d371d3cf351dc /Software/Visual_Studio/Tango.FileSystem
parentc7ceaf96e0ae6d8cb0e1ae7373e6a054f72f52cd (diff)
downloadTango-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')
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs53
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs17
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj2
5 files changed, 95 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))
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
index f72785f81..46ca080a2 100644
--- a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
+++ b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
@@ -181,5 +181,22 @@ namespace Tango.FileSystem
throw new FileNotFoundException("Could not locate the source file or folder.");
}
}
+
+ public FileSystemItemDTO CreateFolder(String path, String folderName)
+ {
+ String fullPath = Path.Combine(path, folderName);
+
+ if (Directory.Exists(fullPath))
+ {
+ throw new IOException("The specified directory name already exists.");
+ }
+
+ Directory.CreateDirectory(fullPath);
+
+ return GetFolder(new GetFileSystemItemRequest()
+ {
+ Path = fullPath
+ });
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs
new file mode 100644
index 000000000..77452dcdf
--- /dev/null
+++ b/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FileSystem.Network
+{
+ public class CreateFolderRequest
+ {
+ public String Path { get; set; }
+ public String FolderName { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs
new file mode 100644
index 000000000..d52e52c47
--- /dev/null
+++ b/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FileSystem.Network
+{
+ public class CreateFolderResponse
+ {
+ public FileSystemItemDTO FolderItem { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj b/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj
index a1218f12d..a31af216c 100644
--- a/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj
+++ b/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj
@@ -60,6 +60,8 @@
<Compile Include="Network\ChunkDownloadResponse.cs" />
<Compile Include="Network\CopyRequest.cs" />
<Compile Include="Network\CopyResponse.cs" />
+ <Compile Include="Network\CreateFolderRequest.cs" />
+ <Compile Include="Network\CreateFolderResponse.cs" />
<Compile Include="Network\DeleteRequest.cs" />
<Compile Include="Network\DeleteResponse.cs" />
<Compile Include="Network\InitWebRtcRequest.cs" />