diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-12 20:38:57 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-12 20:38:57 +0200 |
| commit | 14e4bd850fa6730eecd7d15bd7044f364b41c986 (patch) | |
| tree | 4e1945a18def6d1c91f239b2b4dbf6e11c0d51db /Software/Visual_Studio/FSE/Tango.FSE.Common | |
| parent | 775f0015321f91aa5be3aca079e289e89d4719f5 (diff) | |
| download | Tango-14e4bd850fa6730eecd7d15bd7044f364b41c986.tar.gz Tango-14e4bd850fa6730eecd7d15bd7044f364b41c986.zip | |
Working on data store view.
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.Common')
4 files changed, 39 insertions, 4 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs index bab513e36..36e026317 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs @@ -10,5 +10,6 @@ namespace Tango.FSE.Common.DataStore public interface IDataStoreProvider { Task<DataStoreModel> GetDataStoreModel(String machineGuid); + Task<DataStoreModel> UpdateDataStoreModel(DataStoreModel model, String machineGuid); } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs index 3c7350be7..027555022 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs @@ -138,7 +138,7 @@ namespace Tango.FSE.Common.Notifications /// <param name="okText">The ok text.</param> /// <param name="cancelText">The cancel text.</param> /// <returns></returns> - Task<InputBoxResult> ShowInputBox(String title, String message, PackIconKind icon = PackIconKind.InfoOutline, String defaultInput = null, String inputHint = null, int? maxChars = null, String okText = null, String cancelText = null); + Task<InputBoxResult> ShowInputBox(String title, String message, PackIconKind icon = PackIconKind.InfoOutline, String defaultInput = null, String inputHint = null, int? maxChars = null, String okText = null, String cancelText = null, Func<String, String> validationFunc = null); /// <summary> /// Shows a question message box. diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs index 7744d04d0..415c6cfc5 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs @@ -14,11 +14,45 @@ namespace Tango.FSE.Common.Notifications public int MaxCharacters { get; set; } + internal Func<String,String> ValidationFunction { get; set; } + private String _input; public String Input { get { return _input; } - set { _input = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + set + { + _input = value; + RaisePropertyChangedAuto(); + + if (_input.IsNotNullOrEmpty()) + { + if (ValidationFunction != null) + { + Error = ValidationFunction.Invoke(_input); + } + } + else + { + Error = null; + } + + RaisePropertyChanged(nameof(HasValidationError)); + + InvalidateRelayCommands(); + } + } + + public bool HasValidationError + { + get { return !String.IsNullOrWhiteSpace(Error); } + } + + private String _error; + public String Error + { + get { return _error; } + set { _error = value; RaisePropertyChangedAuto(); } } public InputBoxVM() : base() @@ -28,7 +62,7 @@ namespace Tango.FSE.Common.Notifications protected override bool CanOK() { - return base.CanOK() && Input.IsNotNullOrEmpty(); + return base.CanOK() && Input.IsNotNullOrEmpty() && !HasValidationError; } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml index 2b7ea3640..4b5d8f8d2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml @@ -896,7 +896,7 @@ </Border.Effect> <DockPanel> <TextBox x:Name="txt" KeyboardNavigation.DirectionalNavigation="Once" DockPanel.Dock="Top" Margin="10" Padding="0 5" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=SearchFilter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> - <ListBox x:Name="list" FocusVisualStyle="{x:Null}" ItemsSource="{TemplateBinding ListItemsSource}" ItemTemplate="{TemplateBinding ItemTemplate}" SelectedValue="{TemplateBinding SelectedValue}" SelectedValuePath="{TemplateBinding SelectedValuePath}" DisplayMemberPath="{TemplateBinding DisplayMemberPath}"> + <ListBox x:Name="list" FocusVisualStyle="{x:Null}" ItemsSource="{TemplateBinding ListItemsSource}" ItemTemplate="{TemplateBinding ItemTemplate}" DisplayMemberPath="{TemplateBinding DisplayMemberPath}"> </ListBox> </DockPanel> |
