From 14e4bd850fa6730eecd7d15bd7044f364b41c986 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 12 Nov 2020 20:38:57 +0200 Subject: Working on data store view. --- .../Tango.SharedUI/Controls/SearchComboBox.cs | 24 ++++++++++++++++++---- .../Converters/EnumToItemsSourceConverter.cs | 13 +++++++++++- 2 files changed, 32 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs index 583d7b810..1f2856a32 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs @@ -12,6 +12,7 @@ using System.Windows.Input; using System.Linq; using System.Windows.Media; using System.Windows.Threading; +using Tango.Core.ExtensionMethods; namespace Tango.SharedUI.Controls { @@ -73,6 +74,11 @@ namespace Tango.SharedUI.Controls { IsOpened = false; SelectedItem = _listBox.SelectedItem; + + if (SelectedValuePath.IsNotNullOrEmpty() && SelectedItem != null) + { + SelectedValue = SelectedItem.GetPropertyValueByPath(SelectedValuePath); + } } else if (e.Key == Key.Up && _listBox.SelectedIndex == 0) { @@ -120,6 +126,11 @@ namespace Tango.SharedUI.Controls { IsOpened = false; SelectedItem = _listBox.SelectedItem; + + if (SelectedValuePath.IsNotNullOrEmpty() && SelectedItem != null) + { + SelectedValue = SelectedItem.GetPropertyValueByPath(SelectedValuePath); + } } } } @@ -152,12 +163,17 @@ namespace Tango.SharedUI.Controls if (x != null) { - var prop = x.GetType().GetProperty(SearchProperty, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); - if (prop != null) + if (!String.IsNullOrWhiteSpace(SearchProperty)) { - String propValue = prop.GetValue(x).ToString(); - return propValue.ToLower().Contains(SearchFilter.ToLower()); + var prop = x.GetType().GetProperty(SearchProperty, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); + if (prop != null) + { + String propValue = prop.GetValue(x).ToString(); + return propValue.ToLower().Contains(SearchFilter.ToLower()); + } } + + return x.ToStringSafe().ToLower().Contains(SearchFilter.ToLower()); } return false; diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs index c551f7d49..5c725e524 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs @@ -10,6 +10,17 @@ namespace Tango.SharedUI.Converters { public class EnumToItemsSourceConverter : IValueConverter { + public class EnumValue + { + public Object Value { get; set; } + public String DisplayName { get; set; } + + public override string ToString() + { + return DisplayName; + } + } + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Type result = value as Type; @@ -20,7 +31,7 @@ namespace Tango.SharedUI.Converters } else { - return Enum.GetValues(result).Cast().Select(e => new { Value = e, DisplayName = (e as Enum).ToDescription() }).ToList(); + return Enum.GetValues(result).Cast().Select(e => new EnumValue() { Value = e, DisplayName = (e as Enum).ToDescription() }).ToList(); } } -- cgit v1.3.1 From 679c6ceb5ad91431df0180ce46c2b407cfe49def Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 14 Nov 2020 01:49:42 +0200 Subject: Thread Break/Loading improvements. --- .../Controls/ImageGalleryControl.xaml | 2 +- .../PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml | 10 +++++----- .../PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs | 2 ++ .../Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml | 8 ++++---- .../Images/ThreadLoading/FeedingUnits/4.JPG | Bin 103042 -> 62531 bytes .../Images/ThreadLoading/FeedingUnits/arc/4.jpg | Bin 103042 -> 62531 bytes .../Tango.SharedUI/Controls/NavigationControl.cs | 10 ++++++++-- .../Tango.Touch/Controls/TouchPanel.xaml | 2 +- 8 files changed, 21 insertions(+), 13 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml index f3b45d5b8..495335ff1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml @@ -88,7 +88,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml index 6c64520a4..f17860d42 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml @@ -51,7 +51,7 @@ Please check guiding units on both sides of the system and fix/tie the thread if possible. - + @@ -77,7 +77,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -149,7 +149,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs index 131f976c1..e737f3b12 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs @@ -157,6 +157,7 @@ namespace Tango.PPC.UI.Dialogs catch (Exception ex) { LogManager.Log(ex, LogCategory.Warning, "Error occurred while attempting to perform thread jogging."); + await NotificationProvider.ShowError($"Thread movement verification failed.\n{ex.FlattenMessage()}"); Stage = WizardStage.FeedingUnits; } } @@ -192,6 +193,7 @@ namespace Tango.PPC.UI.Dialogs catch (Exception ex) { LogManager.Log(ex, LogCategory.Warning, "Error occurred while attempting to perform thread jogging."); + await NotificationProvider.ShowError($"Thread movement verification failed.\n{ex.FlattenMessage()}"); Stage = WizardStage.TheDryer; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml index 3d37c81bd..2bb63d909 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml @@ -17,7 +17,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -136,7 +136,7 @@ - Something went wrong + Something went wrong, press 'retry' to try again @@ -153,7 +153,7 @@ - Something went wrong + Something went wrong, press 'retry' to try again diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG index 575066c23..52063b213 100644 Binary files a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg index 575066c23..52063b213 100644 Binary files a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg differ diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs index 879401c1b..cefdbbfd6 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs @@ -252,7 +252,13 @@ namespace Tango.SharedUI.Controls public static readonly DependencyProperty KeepElementsAttachedProperty = DependencyProperty.Register("KeepElementsAttached", typeof(bool), typeof(NavigationControl), new PropertyMetadata(false)); - + public bool GalleryMode + { + get { return (bool)GetValue(GalleryModeProperty); } + set { SetValue(GalleryModeProperty, value); } + } + public static readonly DependencyProperty GalleryModeProperty = + DependencyProperty.Register("GalleryMode", typeof(bool), typeof(NavigationControl), new PropertyMetadata(false)); public int SelectedIndex { @@ -551,7 +557,7 @@ namespace Tango.SharedUI.Controls break; case TransitionTypes.Slide: - if (toIndex > fromIndex) + if (toIndex > fromIndex || GalleryMode) { fromAnimation.From = 0; fromAnimation.To = -ActualWidth; diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index 97d91477d..d54b155d2 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -242,7 +242,7 @@ OK - + -- cgit v1.3.1 From 2ef57b73b1dc6da51a9c3353d93a815f58ea22e0 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 17 Nov 2020 16:35:03 +0200 Subject: Fixed error wording on FSE firmware logs failure. Added support for raise property changed on UI thread for view model base. --- .../Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs | 4 ++-- Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs index ead8366ad..70c73a7be 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs @@ -200,8 +200,8 @@ namespace Tango.FSE.Firmware.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error loading log files."); - NotificationProvider.PushErrorReportingSnackbar(ex, "PPC Module Error", "Could not initialize the remote PPC logs history."); + LogManager.Log(ex, "Error loading remote firmware log files."); + NotificationProvider.PushErrorReportingSnackbar(ex, "Firmware Module Error", "Could not initialize the remote Firmware logs history."); } finally { diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index 421e098ce..564d8fce0 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -41,7 +41,7 @@ namespace Tango.SharedUI public bool IsBusy { get { return _isBusy; } - set { _isBusy = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsFree)); InvalidateRelayCommands(); } + set { _isBusy = value; RaisePropertyChanged(nameof(IsBusy), true); RaisePropertyChanged(nameof(IsFree), true); InvalidateRelayCommands(); } } /// @@ -172,6 +172,18 @@ namespace Tango.SharedUI { TangoMessenger.Default.Register(handler); } + + /// + /// Raises the property changed event. + /// + /// Name of the property. + protected virtual void RaisePropertyChanged(String propName, bool onUIThread) + { + InvokeUI(() => + { + RaisePropertyChanged(propName); + }); + } } /// -- cgit v1.3.1 From 10b86a94011c449f6630f29513cbc4176e650643 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 19 Nov 2020 17:48:19 +0200 Subject: Revert changes to view model base causing hangs. --- Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI') diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index 564d8fce0..421e098ce 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -41,7 +41,7 @@ namespace Tango.SharedUI public bool IsBusy { get { return _isBusy; } - set { _isBusy = value; RaisePropertyChanged(nameof(IsBusy), true); RaisePropertyChanged(nameof(IsFree), true); InvalidateRelayCommands(); } + set { _isBusy = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsFree)); InvalidateRelayCommands(); } } /// @@ -172,18 +172,6 @@ namespace Tango.SharedUI { TangoMessenger.Default.Register(handler); } - - /// - /// Raises the property changed event. - /// - /// Name of the property. - protected virtual void RaisePropertyChanged(String propName, bool onUIThread) - { - InvokeUI(() => - { - RaisePropertyChanged(propName); - }); - } } /// -- cgit v1.3.1