aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-10-27 14:07:14 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-10-27 14:07:14 +0200
commit4a41df0b200191ce96a13fb80412e51d46f08cb4 (patch)
tree3c9103e1d97d3dd6601c5f1535bdc26243c6c63a /Software/Visual_Studio
parent88f609c6244121f07b45e8101174fdc293bbcb2d (diff)
downloadTango-4a41df0b200191ce96a13fb80412e51d46f08cb4.tar.gz
Tango-4a41df0b200191ce96a13fb80412e51d46f08cb4.zip
Fixed a bug with PPC storage invalid file na chars.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs29
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs9
2 files changed, 36 insertions, 2 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));
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
index beb7e0c18..224de18a8 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
@@ -24,13 +24,20 @@ namespace Tango.Touch.Controls
private PasswordBox _password_box;
private DateTime _lost_focus_time;
+ public event EventHandler TextChanged;
+
public String Text
{
get { return (String)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
- DependencyProperty.Register("Text", typeof(String), typeof(TouchTextBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+ DependencyProperty.Register("Text", typeof(String), typeof(TouchTextBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => (d as TouchTextBox).OnTextChanged()));
+
+ private void OnTextChanged()
+ {
+ TextChanged?.Invoke(this, new EventArgs());
+ }
public String Watermark
{