From 386e67f30620724d4608ca7c6e8074e24c876f38 Mon Sep 17 00:00:00 2001 From: Kleinrotti Date: Sun, 8 Mar 2020 21:55:44 +0100 Subject: [PATCH] added info label for empty Installed/available page --- VoukoderManager.Core/ProgramDetector.cs | 4 ++-- .../Pages/ComponentPage.xaml.cs | 23 ++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/VoukoderManager.Core/ProgramDetector.cs b/VoukoderManager.Core/ProgramDetector.cs index 6139775..6023a8b 100644 --- a/VoukoderManager.Core/ProgramDetector.cs +++ b/VoukoderManager.Core/ProgramDetector.cs @@ -115,13 +115,13 @@ public static IProgramEntry GetVoukoderComponent(ProgramType connectorType) var ad = vComponents.Single(x => x.DisplayName.Any(char.IsDigit)); ConvertFromRegistryEntry(out entry, ad, ProgramType.VoukoderCore); } - catch (InvalidOperationException ex) { } + catch (Exception ex) { } try { var re = vComponents.Single(x => x.DisplayName.Contains(connectorType.ToString())); ConvertFromRegistryEntry(out entry, re, connectorType); } - catch (InvalidOperationException ex) { } + catch (Exception ex) { } if (entry != null && connectorType == entry.ComponentType) return entry; diff --git a/VoukoderManager.GUI/Pages/ComponentPage.xaml.cs b/VoukoderManager.GUI/Pages/ComponentPage.xaml.cs index f9ad527..c06bdc6 100644 --- a/VoukoderManager.GUI/Pages/ComponentPage.xaml.cs +++ b/VoukoderManager.GUI/Pages/ComponentPage.xaml.cs @@ -19,6 +19,7 @@ public partial class ComponentPage : Page { private BackgroundWorker _worker; private List _detectedPrograms; + private TextBlock _textBlockInfo; public ObservableCollection VoukoderItemControls { get; set; } @@ -31,15 +32,35 @@ public ComponentPage(bool isInstalledPage) DataContext = this; _isInstalledPage = isInstalledPage; VoukoderItemControls = new ObservableCollection(); - VoukoderItemControls = new ObservableCollection(); + VoukoderItemControls.CollectionChanged += VoukoderItemControls_CollectionChanged; _worker = new BackgroundWorker(); this.Unloaded += ComponentPage_Unloaded; this.Loaded += ComponentPage_Loaded; VKProgramEntry.UninstallationFinished += ProgramEntry_UninstallationFinished; VKPackage.InstallationFinished += Package_InstallationFinished; + _textBlockInfo = new TextBlock(); + if (!_isInstalledPage) + _textBlockInfo.Text = "There is currently no NLE available where Voukoder can be installed for."; + else + _textBlockInfo.Text = "There is currently no Voukoder component installed."; + _textBlockInfo.FontSize = 15; + stackpanelPrograms.Children.Add(_textBlockInfo); LoadProgramLists(); } + private void VoukoderItemControls_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + var v = (ObservableCollection)sender; + if (e.NewStartingIndex != -1) + { + _textBlockInfo.Visibility = System.Windows.Visibility.Collapsed; + } + else if (v.Count == 0) + { + _textBlockInfo.Visibility = System.Windows.Visibility.Visible; + } + } + private void Package_InstallationFinished(object sender, OperationFinishedEventArgs e) { if (!e.Cancelled)