diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-27 14:07:14 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-27 14:07:14 +0200 |
| commit | 4a41df0b200191ce96a13fb80412e51d46f08cb4 (patch) | |
| tree | 3c9103e1d97d3dd6601c5f1535bdc26243c6c63a /Software/Visual_Studio/PPC | |
| parent | 88f609c6244121f07b45e8101174fdc293bbcb2d (diff) | |
| download | Tango-4a41df0b200191ce96a13fb80412e51d46f08cb4.tar.gz Tango-4a41df0b200191ce96a13fb80412e51d46f08cb4.zip | |
Fixed a bug with PPC storage invalid file na chars.
Diffstat (limited to 'Software/Visual_Studio/PPC')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index 23d471138..4a756e7ea 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -21,6 +21,7 @@ namespace Tango.PPC.Storage.ViewModels { private bool _allow_exit; private ExplorerFileItem _selectedItem; + private static char[] _invalidChars = System.IO.Path.GetInvalidFileNameChars(); private String _currentPath; public String CurrentPath @@ -49,7 +50,17 @@ namespace Tango.PPC.Storage.ViewModels public String FileName { get { return _fileName; } - set { _fileName = value; RaisePropertyChangedAuto(); SaveCommand.RaiseCanExecuteChanged(); } + set + { + if (_fileName != value) + { + _fileName = value; + OnFileNameChanged(); + } + + RaisePropertyChangedAuto(); + SaveCommand.RaiseCanExecuteChanged(); + } } public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; } @@ -182,5 +193,21 @@ namespace Tango.PPC.Storage.ViewModels }; NavigationManager.NavigateBack(); } + + private void OnFileNameChanged() + { + String text = FileName; + + if (text != null) + { + foreach (var c in _invalidChars) + { + text = text.Replace(c.ToString(), ""); + } + + _fileName = text; + RaisePropertyChanged(nameof(FileName)); + } + } } } |
