Skip to content

Commit

Permalink
added info label for empty Installed/available page
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleinrotti committed Mar 8, 2020
1 parent 8e964d3 commit 386e67f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions VoukoderManager.Core/ProgramDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
23 changes: 22 additions & 1 deletion VoukoderManager.GUI/Pages/ComponentPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public partial class ComponentPage : Page
{
private BackgroundWorker _worker;
private List<IProgramEntry> _detectedPrograms;
private TextBlock _textBlockInfo;

public ObservableCollection<VoukoderItemControl> VoukoderItemControls { get; set; }

Expand All @@ -31,15 +32,35 @@ public ComponentPage(bool isInstalledPage)
DataContext = this;
_isInstalledPage = isInstalledPage;
VoukoderItemControls = new ObservableCollection<VoukoderItemControl>();
VoukoderItemControls = new ObservableCollection<VoukoderItemControl>();
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<VoukoderItemControl>)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)
Expand Down

0 comments on commit 386e67f

Please sign in to comment.