diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-04-09 00:29:06 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-04-09 00:29:06 +0300 |
| commit | 5774f40b650a376e9b622dba9df6c43589b0d398 (patch) | |
| tree | 8d80f23cbb9cc264cc5be1bd82c52402eed612e6 /Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs | |
| parent | 42391bb46aa9dda0f56a7909268a2cffdf36f1d8 (diff) | |
| download | Tango-5774f40b650a376e9b622dba9df6c43589b0d398.tar.gz Tango-5774f40b650a376e9b622dba9df6c43589b0d398.zip | |
Logs, Comments & General organization on FSE/PPC.
Several improvements.
Diffstat (limited to 'Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/FileSystemViewVM.cs | 149 |
1 files changed, 133 insertions, 16 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 3a4a87884..6fb46320b 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 @@ -18,9 +18,19 @@ using static Tango.SharedUI.Controls.NavigationControl; namespace Tango.FSE.PPCConsole.ViewModels { + /// <summary> + /// Represents the remote file system view model. + /// </summary> + /// <seealso cref="Tango.FSE.Common.FSEViewModel" /> + /// <seealso cref="Tango.SharedUI.Controls.NavigationControl.INavigationViewModel" /> public class FileSystemViewVM : FSEViewModel, INavigationViewModel { + #region Properties + private FileSystemItem _currentItem; + /// <summary> + /// Gets or sets the current file system item. + /// </summary> public FileSystemItem CurrentItem { get { return _currentItem; } @@ -28,6 +38,9 @@ namespace Tango.FSE.PPCConsole.ViewModels } private String _currentPath; + /// <summary> + /// Gets or sets the current remote path. + /// </summary> public String CurrentPath { get { return _currentPath; } @@ -35,34 +48,123 @@ namespace Tango.FSE.PPCConsole.ViewModels } private List<DriveItem> _drives; + /// <summary> + /// Gets or sets the file system drives. + /// </summary> public List<DriveItem> Drives { get { return _drives; } set { _drives = value; RaisePropertyChangedAuto(); } } + /// <summary> + /// Gets or sets the selected file system items. + /// </summary> public ObservableCollection<FileSystemItem> SelectedItems { get; set; } + + /// <summary> + /// Gets or sets the list of file system handlers downloads/uploads. + /// </summary> public ObservableCollection<FileSystemHandler> FileSystemHandlers { get; set; } + #endregion + + #region Commands + + /// <summary> + /// Navigates to the current path. + /// </summary> public RelayCommand NavigateCommand { get; set; } + + /// <summary> + /// Opens the current selected item (context menu). + /// </summary> public RelayCommand<FileSystemItem> OpenItemCommand { get; set; } + + /// <summary> + /// Navigates back. + /// </summary> public RelayCommand BackCommand { get; set; } + + /// <summary> + /// Navigates to the specified special folder. + /// </summary> public RelayCommand<String> NavigateSpecialFolderCommand { get; set; } + + /// <summary> + /// Navigates to the specified folder. + /// </summary> public RelayCommand<String> NavigateToFolderCommand { get; set; } + + /// <summary> + /// Deletes the specified file system item (context menu or DEL key). + /// </summary> public RelayCommand<IList<FileSystemItem>> DeleteCommand { get; set; } + + /// <summary> + /// Handles the drag & drop of items from the operation system shell onto the file system view. + /// </summary> public RelayCommand<List<FileSystemItem>> DropCommand { get; set; } + + /// <summary> + /// Handles the drag & drop of items from the file system view onto the operation system shell. + /// </summary> public RelayCommand<List<DragItem>> DragCommand { get; set; } + + /// <summary> + /// Removes the specified file system handler. + /// </summary> public RelayCommand<FileSystemHandler> DeleteFileSystemHandlerCommand { get; set; } + + /// <summary> + /// Opens the parent directory of a file system handler item. + /// A download will execute the local explorer.exe. + /// An upload will navigate to the remote parent folder. + /// </summary> public RelayCommand<FileSystemHandler> OpenFileSystemHandlerDestinationCommand { get; set; } + + /// <summary> + /// Not supported. + /// </summary> public RelayCommand<FileSystemHandler> RetryFailedFileSystemHandlerCommand { get; set; } + + /// <summary> + /// Handles the copy paste of remote items to a remote location. + /// </summary> public RelayCommand<List<FileSystemItem>> CopyPasteCommand { get; set; } + + /// <summary> + /// Handles the cut parse of remote items to a remote location. + /// </summary> public RelayCommand<List<FileSystemItem>> CutPasteCommand { get; set; } + + /// <summary> + /// Downloads the specified remote items. + /// </summary> public RelayCommand<List<FileSystemItem>> DownloadCommand { get; set; } + + /// <summary> + /// Invokes a dialog for choosing items to upload and starts the upload. + /// </summary> public RelayCommand UploadCommand { get; set; } + + /// <summary> + /// Renames the specified file system item. + /// </summary> public RelayCommand<FileSystemItem> RenameCommand { get; set; } + + /// <summary> + /// Creates a new folder at the current remote path. + /// </summary> public RelayCommand NewFolderCommand { get; set; } + #endregion + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="FileSystemViewVM"/> class. + /// </summary> public FileSystemViewVM() { SelectedItems = new ObservableCollection<FileSystemItem>(); @@ -86,36 +188,49 @@ namespace Tango.FSE.PPCConsole.ViewModels UploadCommand = new RelayCommand(UploadFilesAndFolder); } - private async void NavigateBack() - { - if (CurrentItem.Path.Length == 3) - { - await Navigate(null); - } - else - { - String parent = Path.GetDirectoryName(CurrentItem.Path); - await Navigate(parent); - } - } + #endregion + #region Override Methods + + /// <summary> + /// Called when the application has been started. + /// </summary> public override void OnApplicationStarted() { base.OnApplicationStarted(); MachineProvider.MachineConnected += MachineProvider_MachineConnected; } - public override void OnApplicationReady() + #endregion + + #region Event Handlers + + private async void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e) { - base.OnApplicationReady(); + if (MachineProvider.ConnectionType.IsRemote()) + { + if (e.DifferentFromPrevious) + { + await Navigate(null); + } + } } - private async void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e) + #endregion + + #region Private Methods + + private async void NavigateBack() { - if (e.DifferentFromPrevious) + if (CurrentItem.Path.Length == 3) { await Navigate(null); } + else + { + String parent = Path.GetDirectoryName(CurrentItem.Path); + await Navigate(parent); + } } private void NavigateToCurrentPath() @@ -521,5 +636,7 @@ namespace Tango.FSE.PPCConsole.ViewModels CurrentPath = CurrentItem.Path; InvalidateRelayCommands(); } + + #endregion } } |
