mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add display of all loaded applications
This commit is contained in:
parent
f51c391e84
commit
9d3f0d45d5
7 changed files with 43 additions and 10 deletions
|
|
@ -54,7 +54,7 @@ namespace Wox.Plugin.Program
|
||||||
{
|
{
|
||||||
Location = Directory.Text,
|
Location = Directory.Text,
|
||||||
};
|
};
|
||||||
_settings.ProgramSources.Add(source);
|
_settings.ProgramSources.Insert(0, source);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,19 @@ namespace Wox.Plugin.Program
|
||||||
Task.WaitAll(t1, t2);
|
Task.WaitAll(t1, t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddLoadedApplicationsToSettings()
|
||||||
|
{
|
||||||
|
_win32s
|
||||||
|
.Where(t1 => !_settings.ProgramSources.Any(x => x.Name == t1.Name))
|
||||||
|
.ToList()
|
||||||
|
.ForEach(t1 => _settings.ProgramSources.Add(new Settings.ProgramSource (){Name = t1.Name, Location = t1.ParentDirectory }));
|
||||||
|
|
||||||
|
_uwps
|
||||||
|
.Where(t1 => !_settings.ProgramSources.Any(x => x.Name == t1.DisplayName))
|
||||||
|
.ToList()
|
||||||
|
.ForEach(t1 => _settings.ProgramSources.Add(new Settings.ProgramSource() { Name = t1.DisplayName, Location = t1.Package.Location }));
|
||||||
|
}
|
||||||
|
|
||||||
public Control CreateSettingPanel()
|
public Control CreateSettingPanel()
|
||||||
{
|
{
|
||||||
return new ProgramSetting(_context, _settings);
|
return new ProgramSetting(_context, _settings);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,13 @@
|
||||||
Drop="programSourceView_Drop" >
|
Drop="programSourceView_Drop" >
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView>
|
<GridView>
|
||||||
|
<GridViewColumn Header="Name" Width="150">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
<GridViewColumn Header="{DynamicResource wox_plugin_program_location}" Width="550">
|
<GridViewColumn Header="{DynamicResource wox_plugin_program_location}" Width="550">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|
@ -44,6 +51,7 @@
|
||||||
<Button x:Name="btnDeleteProgramSource" Click="btnDeleteProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_delete}"/>
|
<Button x:Name="btnDeleteProgramSource" Click="btnDeleteProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_delete}"/>
|
||||||
<Button x:Name="btnEditProgramSource" Click="btnEditProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_edit}"/>
|
<Button x:Name="btnEditProgramSource" Click="btnEditProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_edit}"/>
|
||||||
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_add}"/>
|
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_program_add}"/>
|
||||||
|
<Button x:Name="btnLoadAllProgramSource" Click="btnLoadAllProgramSource_OnClick" Width="100" Margin="10" Content="Load All"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ namespace Wox.Plugin.Program
|
||||||
{
|
{
|
||||||
ReIndexing();
|
ReIndexing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
programSourceView.Items.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
|
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
|
@ -142,5 +144,12 @@ namespace Wox.Plugin.Program
|
||||||
_settings.EnableRegistrySource = RegistryEnabled.IsChecked ?? false;
|
_settings.EnableRegistrySource = RegistryEnabled.IsChecked ?? false;
|
||||||
ReIndexing();
|
ReIndexing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnLoadAllProgramSource_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Main.AddLoadedApplicationsToSettings();
|
||||||
|
|
||||||
|
programSourceView.Items.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -207,12 +207,12 @@ namespace Wox.Plugin.Program.Programs
|
||||||
if(enableProgramSourceOnly)
|
if(enableProgramSourceOnly)
|
||||||
return applications
|
return applications
|
||||||
.Where(t1 => applicationsToRetainPaths
|
.Where(t1 => applicationsToRetainPaths
|
||||||
.Any(x => x.LocationFile == t1.Package.Location
|
.Any(x => x.Location == t1.Package.Location
|
||||||
&& x.EnableIndexing))
|
&& x.Enabled))
|
||||||
.Select(t1 => t1).ToArray();
|
.Select(t1 => t1).ToArray();
|
||||||
|
|
||||||
// Do not return if the application is disabled for indexing
|
// Do not return if the application is disabled for indexing
|
||||||
return applications.Where(t1 => !applicationsToRetainPaths.Any(x => x.LocationFile == t1.Package.Location && !x.EnableIndexing))
|
return applications.Where(t1 => !applicationsToRetainPaths.Any(x => x.Location == t1.Package.Location && !x.Enabled))
|
||||||
.Select(t1 => t1).ToArray();
|
.Select(t1 => t1).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,15 +263,15 @@ namespace Wox.Plugin.Program.Programs
|
||||||
private static ParallelQuery<Win32> UnregisteredPrograms(List<Settings.ProgramSource> sources, string[] suffixes)
|
private static ParallelQuery<Win32> UnregisteredPrograms(List<Settings.ProgramSource> sources, string[] suffixes)
|
||||||
{
|
{
|
||||||
var list = new List<string>();
|
var list = new List<string>();
|
||||||
sources.Where(s => Directory.Exists(s.Location) && s.EnableIndexing)
|
sources.Where(s => Directory.Exists(s.Location) && s.Enabled)
|
||||||
.SelectMany(s => ProgramPaths(s.Location, suffixes))
|
.SelectMany(s => ProgramPaths(s.Location, suffixes))
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(x => list.Add(x));
|
.ForEach(x => list.Add(x));
|
||||||
|
|
||||||
sources.Where(x=> File.Exists(x.LocationFile) && x.EnableIndexing)
|
sources.Where(s => File.Exists(s.Location) && s.Enabled)
|
||||||
.Select(y => y.LocationFile)
|
.Select(s => s.Location)
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(z => list.Add(z));
|
.ForEach(x => list.Add(x));
|
||||||
|
|
||||||
var paths = list.ToArray();
|
var paths = list.ToArray();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using Wox.Plugin.Program.Programs;
|
using Wox.Plugin.Program.Programs;
|
||||||
|
|
||||||
namespace Wox.Plugin.Program
|
namespace Wox.Plugin.Program
|
||||||
|
|
@ -18,9 +19,11 @@ namespace Wox.Plugin.Program
|
||||||
|
|
||||||
public class ProgramSource
|
public class ProgramSource
|
||||||
{
|
{
|
||||||
|
private string name;
|
||||||
|
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
public string LocationFile { get; set; }
|
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
|
||||||
public bool EnableIndexing { get; set; } = true;
|
public bool Enabled { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue