aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/FSE')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs80
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/FileSystemView.xaml73
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/FileSystemControl.xaml34
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs7
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs85
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerStatus.cs18
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerType.cs17
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/IFileSystemProvider.cs19
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj4
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/FileSystem/DefaultFileSystemProvider.cs72
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj5
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs4
12 files changed, 379 insertions, 39 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
index 44bd03c39..f9eff7e6f 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs
@@ -1,15 +1,19 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Input;
using Tango.Core.Commands;
using Tango.FileSystem;
using Tango.FSE.Common;
+using Tango.FSE.Common.Connection;
+using static Tango.SharedUI.Controls.NavigationControl;
namespace Tango.FSE.PPCConsole.ViewModels
{
- public class FileSystemViewVM : FSEViewModel
+ public class FileSystemViewVM : FSEViewModel, INavigationViewModel
{
private FileSystemItem _currentItem;
public FileSystemItem CurrentItem
@@ -26,32 +30,92 @@ namespace Tango.FSE.PPCConsole.ViewModels
}
public RelayCommand NavigateCommand { get; set; }
+ public RelayCommand<FileSystemItem> OpenItemCommand { get; set; }
+ public RelayCommand BackCommand { get; set; }
public FileSystemViewVM()
{
- NavigateCommand = new RelayCommand(Navigate);
+ NavigateCommand = new RelayCommand(NavigateToCurrentPath);
+ OpenItemCommand = new RelayCommand<FileSystemItem>(OpenFileSystemItem);
+ BackCommand = new RelayCommand(NavigateBack, () => !(CurrentItem is FolderItem) || !(CurrentItem as FolderItem).IsRoot);
+ }
+
+ private async void NavigateBack()
+ {
+ if (CurrentItem.Path.Length == 3)
+ {
+ await Navigate(null);
+ }
+ else
+ {
+ String parent = Path.GetDirectoryName(CurrentItem.Path);
+ await Navigate(parent);
+ }
+ }
+
+ public override void OnApplicationStarted()
+ {
+ base.OnApplicationStarted();
+ MachineProvider.MachineConnected += MachineProvider_MachineConnected;
}
public override void OnApplicationReady()
{
base.OnApplicationReady();
+ }
+
+ private async void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e)
+ {
+ await Navigate(null);
+ }
+
+ private async void NavigateToCurrentPath()
+ {
+ await Navigate(CurrentPath);
+ }
- FileSystemManager manager = new FileSystemManager();
- CurrentItem = FileSystemItem.FromDTO(manager.GetFolder(@"C:\"));
+ private async void OpenFileSystemItem(FileSystemItem item)
+ {
+ if (item != null)
+ {
+ await Navigate(item.Path);
+ }
}
- private void Navigate()
+ private async Task Navigate(String path)
{
- if (CurrentPath.IsNotNullOrEmpty())
+ try
+ {
+ IsFree = false;
+
+ Mouse.OverrideCursor = Cursors.AppStarting;
+
+ if (path != null)
+ {
+ CurrentItem = await FileSystemProvider.GetFolder(path) as FileSystemItem;
+ }
+ else
+ {
+ CurrentItem = await FileSystemProvider.GetThisPC() as FileSystemItem;
+ }
+ }
+ catch (Exception ex)
+ {
+ IsFree = true;
+ Mouse.OverrideCursor = null;
+ await NotificationProvider.ShowError($"Error navigating to the specified path.\n{ex.FlattenMessage()}");
+ }
+ finally
{
- FileSystemManager manager = new FileSystemManager();
- CurrentItem = FileSystemItem.FromDTO(manager.GetFolder(CurrentPath));
+ IsFree = true;
+ Mouse.OverrideCursor = null;
}
}
private void OnCurrentItemChanged()
{
CurrentPath = CurrentItem.Path;
+ InvalidateRelayCommands();
}
}
}
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/FileSystemView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/FileSystemView.xaml
index ad503c7de..fc23ca42c 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/FileSystemView.xaml
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/Views/FileSystemView.xaml
@@ -10,7 +10,7 @@
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:FileSystemViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.FileSystemViewVM}">
- <Grid>
+ <Grid IsEnabled="{Binding IsFree}">
<Grid Margin="0 20 0 0">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
@@ -36,7 +36,7 @@
</Button>
</StackPanel>
<StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
- <Button material:ButtonAssist.CornerRadius="3 0 0 3" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Padding="0" Width="60" Height="Auto">
+ <Button Command="{Binding BackCommand}" material:ButtonAssist.CornerRadius="3 0 0 3" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Padding="0" Width="60" Height="Auto">
<material:PackIcon Kind="ChevronLeft" Width="Auto" Height="20" />
</Button>
</StackPanel>
@@ -45,17 +45,74 @@
<Border.Effect>
<DropShadowEffect BlurRadius="2" ShadowDepth="2" Opacity="0.3" Direction="270" />
</Border.Effect>
- <TextBox Padding="5 0 0 0" Text="{Binding CurrentPath,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}" CaretBrush="{StaticResource FSE_PrimaryForegroundBrush}" Background="Transparent" BorderThickness="0" VerticalContentAlignment="Center" Style="{x:Null}">
- <TextBox.InputBindings>
- <KeyBinding Key="Return" Command="{Binding NavigateCommand}" />
- </TextBox.InputBindings>
- </TextBox>
+ <Border IsHitTestVisible="False" Visibility="{Binding IsBusy,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <Border.Background>
+ <LinearGradientBrush>
+ <GradientStop Offset="0" Color="Transparent" />
+ <GradientStop Offset="0.5" Color="#6303A9F4" />
+ <GradientStop Offset="1" Color="Transparent" />
+ </LinearGradientBrush>
+ </Border.Background>
+ <Border.Style>
+ <Style TargetType="Border">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsBusy}" Value="True">
+ <DataTrigger.EnterActions>
+ <BeginStoryboard Name="loadingStory">
+ <Storyboard>
+ <DoubleAnimation Storyboard.TargetProperty="Background.GradientStops[1].Offset" From="0" To="1" AutoReverse="True" RepeatBehavior="Forever" />
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.EnterActions>
+ <DataTrigger.ExitActions>
+ <RemoveStoryboard BeginStoryboardName="loadingStory" />
+ </DataTrigger.ExitActions>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+
+ <TextBox Padding="5 0 0 0" Text="{Binding CurrentPath,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}" CaretBrush="{StaticResource FSE_PrimaryForegroundBrush}" Background="Transparent" BorderThickness="0" VerticalContentAlignment="Center" Style="{x:Null}">
+ <TextBox.InputBindings>
+ <KeyBinding Key="Return" Command="{Binding NavigateCommand}" />
+ </TextBox.InputBindings>
+ </TextBox>
+ </Border>
</Border>
</Border>
</DockPanel>
</DockPanel>
- <controls:FileSystemControl Margin="0 10 0 0" CurrentItem="{Binding CurrentItem}" Grid.Row="1" Mode="{Binding ElementName=listView,Path=SelectedItem.Tag}" />
+ <Grid Grid.Row="1" Margin="0 10 0 0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="200" />
+ <ColumnDefinition Width="5" />
+ <ColumnDefinition Width="1*" />
+ </Grid.ColumnDefinitions>
+
+ <Border Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="3" CornerRadius="3" Padding="10 5">
+ <StackPanel>
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="Computer" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Devices</controls:TextIconButton>
+ <StackPanel Margin="30 0 0 0">
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="Harddisk" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Local Disk 1</controls:TextIconButton>
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="Harddisk" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Local Disk 2</controls:TextIconButton>
+ </StackPanel>
+
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="Computer" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Computer</controls:TextIconButton>
+ <StackPanel Margin="30 0 0 0">
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="DesktopMac" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Desktop</controls:TextIconButton>
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="Downloads" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Downloads</controls:TextIconButton>
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="FileDocument" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Documents</controls:TextIconButton>
+ <controls:TextIconButton HorizontalContentAlignment="Left" Padding="5" Icon="Application" Background="Transparent" BorderThickness="0" FocusVisualStyle="{x:Null}">Tango</controls:TextIconButton>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+
+ <controls:FileSystemControl Margin="10 0 0 0" Grid.Column="2"
+ CurrentItem="{Binding CurrentItem}"
+ Mode="{Binding ElementName=listView,Path=SelectedItem.Tag}"
+ ItemDoubleClickedCommand="{Binding OpenItemCommand}"/>
+ </Grid>
</Grid>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/FileSystemControl.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/FileSystemControl.xaml
index ec490e893..7230d97fb 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/FileSystemControl.xaml
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/FileSystemControl.xaml
@@ -7,6 +7,14 @@
<converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" />
<converters:DateTimeUtcToLocalDateTime x:Key="DateTimeUtcToLocalDateTime" />
+ <Style TargetType="{x:Type local:FileSystemDataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
+ <Setter Property="DoubleClickCommand" Value="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"></Setter>
+ </Style>
+
+ <Style TargetType="{x:Type local:FileSystemDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}">
+
+ </Style>
+
<Style x:Key="FileSystemCellStyle" TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
@@ -92,7 +100,7 @@
</Style.Triggers>
</Style>
</Grid.Style>
- <DataGrid x:Name="PART_datagrid" ItemsSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=CurrentItem.Items}" CellStyle="{StaticResource FileSystemCellStyle}">
+ <local:FileSystemDataGrid x:Name="PART_datagrid" ItemsSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=CurrentItem.Items}" CellStyle="{StaticResource FileSystemCellStyle}">
<DataGrid.Style>
<Style TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="Background" Value="Transparent"></Setter>
@@ -119,11 +127,6 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DockPanel Background="Transparent">
- <DockPanel.InputBindings>
- <MouseBinding MouseAction="LeftDoubleClick"
- Command="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"
- CommandParameter="{Binding}" />
- </DockPanel.InputBindings>
<Image Width="18" Height="18" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image.Style>
<Style TargetType="Image">
@@ -150,11 +153,6 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DockPanel Background="Transparent">
- <DockPanel.InputBindings>
- <MouseBinding MouseAction="LeftDoubleClick"
- Command="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"
- CommandParameter="{Binding}" />
- </DockPanel.InputBindings>
<TextBlock Text="{Binding DateModified,Converter={StaticResource DateTimeUtcToLocalDateTime}}" VerticalAlignment="Center"></TextBlock>
</DockPanel>
</DataTemplate>
@@ -164,11 +162,6 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DockPanel Background="Transparent">
- <DockPanel.InputBindings>
- <MouseBinding MouseAction="LeftDoubleClick"
- Command="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"
- CommandParameter="{Binding}" />
- </DockPanel.InputBindings>
<TextBlock Text="{Binding Description}" VerticalAlignment="Center"></TextBlock>
</DockPanel>
</DataTemplate>
@@ -178,11 +171,6 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DockPanel Background="Transparent">
- <DockPanel.InputBindings>
- <MouseBinding MouseAction="LeftDoubleClick"
- Command="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"
- CommandParameter="{Binding}" />
- </DockPanel.InputBindings>
<TextBlock Text="{Binding Size,Converter={StaticResource ByteArrayToFileSizeConverter}}" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
@@ -200,7 +188,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
- </DataGrid>
+ </local:FileSystemDataGrid>
</Grid>
</Grid>
</Border>
@@ -208,5 +196,5 @@
</Setter.Value>
</Setter>
</Style>
-
+
</ResourceDictionary> \ No newline at end of file
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
index 997eca676..b3e832b58 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs
@@ -17,6 +17,7 @@ using Tango.FSE.BL;
using Tango.FSE.Common.Authentication;
using Tango.FSE.Common.Connection;
using Tango.FSE.Common.Diagnostics;
+using Tango.FSE.Common.FileSystem;
using Tango.FSE.Common.FSEApplication;
using Tango.FSE.Common.Gateway;
using Tango.FSE.Common.Logging;
@@ -119,6 +120,12 @@ namespace Tango.FSE.Common
public IResolutionService ResolutionService { get; set; }
/// <summary>
+ /// Gets or sets the file system provider.
+ /// </summary>
+ [TangoInject]
+ public IFileSystemProvider FileSystemProvider { get; set; }
+
+ /// <summary>
/// Gets or sets the FSE service.
/// </summary>
[TangoInject]
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs
new file mode 100644
index 000000000..1b1e5f747
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.FSE.Common.FileSystem
+{
+ public class FileSystemHandler : ExtendedObject
+ {
+ private Action _abortAction;
+
+ public FileSystemHandlerType Type { get; set; }
+
+ private FileSystemHandlerStatus _status;
+ public FileSystemHandlerStatus Status
+ {
+ get { return _status; }
+ set
+ {
+ if (_status != value)
+ {
+ _status = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+ }
+
+ private double _position;
+ public double Position
+ {
+ get { return _position; }
+ set { _position = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _length;
+ public double Length
+ {
+ get { return _length; }
+ set { _length = value; RaisePropertyChangedAuto(); }
+ }
+
+ private Exception _failedException;
+ public Exception FailedException
+ {
+ get { return _failedException; }
+ set { _failedException = value; RaisePropertyChangedAuto(); }
+ }
+
+ public String Name { get; set; }
+ public String Destination { get; set; }
+
+ public FileSystemHandler(String name, String destination, Action abortAction)
+ {
+ Name = name;
+ Destination = destination;
+ _abortAction = abortAction;
+ }
+
+ internal void InvalidateProgress(double position, double length)
+ {
+ Position = position;
+ Length = length;
+ Status = (Type == FileSystemHandlerType.FileDownload || Type == FileSystemHandlerType.FolderDownload) ? FileSystemHandlerStatus.Downloading : FileSystemHandlerStatus.Uploading;
+ }
+
+ internal void RaiseFailed(Exception exception)
+ {
+ Status = FileSystemHandlerStatus.Failed;
+ FailedException = exception;
+ }
+
+ internal void RaiseCompleted()
+ {
+ Status = FileSystemHandlerStatus.Completed;
+ }
+
+ public void Abort()
+ {
+ Status = FileSystemHandlerStatus.Aborted;
+ _abortAction?.Invoke();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerStatus.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerStatus.cs
new file mode 100644
index 000000000..fe3a030a1
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerStatus.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FSE.Common.FileSystem
+{
+ public enum FileSystemHandlerStatus
+ {
+ Pending,
+ Downloading,
+ Uploading,
+ Failed,
+ Aborted,
+ Completed
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerType.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerType.cs
new file mode 100644
index 000000000..4c60cb828
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandlerType.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FSE.Common.FileSystem
+{
+ public enum FileSystemHandlerType
+ {
+ FileDownload,
+ FileUpload,
+ FolderDownload,
+ FolderUpload
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/IFileSystemProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/IFileSystemProvider.cs
new file mode 100644
index 000000000..16099963b
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/IFileSystemProvider.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.FileSystem;
+using static System.Environment;
+
+namespace Tango.FSE.Common.FileSystem
+{
+ public interface IFileSystemProvider
+ {
+ Task<IFileSystemContainer> GetFolder(String path);
+ Task<IFileSystemContainer> GetSpecialFolder(SpecialFolder specialFolder);
+ Task<IFileSystemContainer> GetThisPC();
+ Task<FileSystemHandler> Download(FileSystemItem item, String targetFolderPath);
+ Task<FileSystemHandler> Upload(String sourcePath, String targetPath);
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
index f61b59da3..8690b742a 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj
@@ -105,6 +105,10 @@
<Compile Include="EventTriggerActions\SetterAction.cs" />
<Compile Include="ExtensionMethods\IExternalBridgeClientExtensions.cs" />
<Compile Include="ExtensionMethods\ViewModelExtensionMethods.cs" />
+ <Compile Include="FileSystem\FileSystemHandler.cs" />
+ <Compile Include="FileSystem\FileSystemHandlerStatus.cs" />
+ <Compile Include="FileSystem\FileSystemHandlerType.cs" />
+ <Compile Include="FileSystem\IFileSystemProvider.cs" />
<Compile Include="FSEApplication\IFSEApplicationManager.cs" />
<Compile Include="FSEDialogViewVM.cs" />
<Compile Include="FSEModuleAttribute.cs" />
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/FileSystem/DefaultFileSystemProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/FileSystem/DefaultFileSystemProvider.cs
new file mode 100644
index 000000000..48da65f16
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/FileSystem/DefaultFileSystemProvider.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.FileSystem;
+using Tango.FileSystem.Network;
+using Tango.FSE.Common.Connection;
+using Tango.FSE.Common.FileSystem;
+using Tango.Transport;
+
+namespace Tango.FSE.UI.FileSystem
+{
+ public class DefaultFileSystemProvider : IFileSystemProvider
+ {
+ private IMachineProvider _machineProvider;
+
+ public DefaultFileSystemProvider(IMachineProvider machineProvider)
+ {
+ _machineProvider = machineProvider;
+ }
+
+ public async Task<IFileSystemContainer> GetFolder(string path)
+ {
+ var response = await _machineProvider.MachineOperator.SendGenericRequest<GetFileSystemItemRequest, GetFileSystemItemResponse>(new GetFileSystemItemRequest()
+ {
+ Path = path
+ }, new TransportRequestConfig()
+ {
+ Timeout = TimeSpan.FromSeconds(30),
+ });
+
+ return FileSystemItem.FromDTO(response.FileSystemItem) as IFileSystemContainer;
+ }
+
+ public async Task<IFileSystemContainer> GetSpecialFolder(Environment.SpecialFolder specialFolder)
+ {
+ var response = await _machineProvider.MachineOperator.SendGenericRequest<GetFileSystemItemRequest, GetFileSystemItemResponse>(new GetFileSystemItemRequest()
+ {
+ SpecialFolder = specialFolder
+ }, new TransportRequestConfig()
+ {
+ Timeout = TimeSpan.FromSeconds(30),
+ });
+
+ return FileSystemItem.FromDTO(response.FileSystemItem) as IFileSystemContainer;
+ }
+
+ public async Task<IFileSystemContainer> GetThisPC()
+ {
+ var response = await _machineProvider.MachineOperator.SendGenericRequest<GetFileSystemItemRequest, GetFileSystemItemResponse>(new GetFileSystemItemRequest()
+ {
+ //No parameters at all
+ }, new TransportRequestConfig()
+ {
+ Timeout = TimeSpan.FromSeconds(30),
+ });
+
+ return FileSystemItem.FromDTO(response.FileSystemItem) as IFileSystemContainer;
+ }
+
+ public Task<FileSystemHandler> Download(FileSystemItem item, string targetFolderPath)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task<FileSystemHandler> Upload(string sourcePath, string targetPath)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
index 61f0f2e70..a1bdda00f 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj
@@ -133,6 +133,7 @@
<Compile Include="Dialogs\MachineConnectionUsbViewVM.cs" />
<Compile Include="Dialogs\MachineConnectionSignalRViewVM.cs" />
<Compile Include="Dialogs\MachineConnectionWifiViewVM.cs" />
+ <Compile Include="FileSystem\DefaultFileSystemProvider.cs" />
<Compile Include="Gateway\DefaultGatewayService.cs" />
<Compile Include="InternalModule.cs" />
<Compile Include="Logging\DefaultLoggingProvider.cs" />
@@ -324,6 +325,10 @@
<Project>{63561e19-ff5a-414b-a5ef-e30711543e1d}</Project>
<Name>Tango.Emulations</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.FileSystem\Tango.FileSystem.csproj">
+ <Project>{c6ebbbbe-2123-44dc-aef7-a0d47d736ac0}</Project>
+ <Name>Tango.FileSystem</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj">
<Project>{4206AC58-3B57-4699-8835-90BF6DB01A61}</Project>
<Name>Tango.Integration</Name>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
index f24a0cf99..6a3cf610a 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs
@@ -10,6 +10,7 @@ using Tango.FSE.Common.Authentication;
using Tango.FSE.Common.Connection;
using Tango.FSE.Common.Console;
using Tango.FSE.Common.Diagnostics;
+using Tango.FSE.Common.FileSystem;
using Tango.FSE.Common.FSEApplication;
using Tango.FSE.Common.Gateway;
using Tango.FSE.Common.Logging;
@@ -26,6 +27,7 @@ using Tango.FSE.UI.Authentication;
using Tango.FSE.UI.Connection;
using Tango.FSE.UI.Console;
using Tango.FSE.UI.Diagnostics;
+using Tango.FSE.UI.FileSystem;
using Tango.FSE.UI.FSEApplication;
using Tango.FSE.UI.Gateway;
using Tango.FSE.UI.Logging;
@@ -61,6 +63,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Unregister<IPerformanceProvider>();
TangoIOC.Default.Unregister<ISystemInfoProvider>();
TangoIOC.Default.Unregister<ILoggingProvider>();
+ TangoIOC.Default.Unregister<IFileSystemProvider>();
//TangoIOC.Default.Unregister<ExternalBridgeScanner>();
//TangoIOC.Default.Unregister<IDiagnosticsFrameProvider>();
//TangoIOC.Default.Unregister<IEventLogger>();
@@ -85,6 +88,7 @@ namespace Tango.FSE.UI
TangoIOC.Default.Register<IPerformanceProvider, DefaultPerformanceProvider>();
TangoIOC.Default.Register<ISystemInfoProvider, DefaultSystemInfoProvider>();
TangoIOC.Default.Register<ILoggingProvider, DefaultLoggingProvider>();
+ TangoIOC.Default.Register<IFileSystemProvider, DefaultFileSystemProvider>();
TangoIOC.Default.Register<MainWindowVM>();
TangoIOC.Default.Register<MainViewVM>();