2022-10-20 08:15:56 +00:00
|
|
|
|
using System.Collections.Generic;
|
2019-09-07 05:58:13 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2016-05-05 20:15:13 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2014-08-10 14:22:54 +00:00
|
|
|
|
using System.Windows;
|
2014-03-29 06:42:43 +00:00
|
|
|
|
using System.Windows.Controls;
|
2019-09-07 05:58:13 +00:00
|
|
|
|
using System.Windows.Input;
|
2020-04-21 09:12:17 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Program.Views.Models;
|
|
|
|
|
|
using Flow.Launcher.Plugin.Program.Views.Commands;
|
|
|
|
|
|
using Flow.Launcher.Plugin.Program.Programs;
|
2019-09-11 21:42:42 +00:00
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Windows.Data;
|
2014-03-29 06:42:43 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.Program.Views
|
2014-03-29 06:42:43 +00:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Interaction logic for ProgramSetting.xaml
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class ProgramSetting : UserControl
|
|
|
|
|
|
{
|
2015-01-06 15:24:11 +00:00
|
|
|
|
private PluginInitContext context;
|
2016-04-21 00:53:21 +00:00
|
|
|
|
private Settings _settings;
|
2019-09-11 21:42:42 +00:00
|
|
|
|
private GridViewColumnHeader _lastHeaderClicked;
|
|
|
|
|
|
private ListSortDirection _lastDirection;
|
|
|
|
|
|
|
2019-10-16 20:04:56 +00:00
|
|
|
|
// We do not save all program sources to settings, so using
|
|
|
|
|
|
// this as temporary holder for displaying all loaded programs sources.
|
2019-09-08 12:16:47 +00:00
|
|
|
|
internal static List<ProgramSource> ProgramSettingDisplayList { get; set; }
|
2015-01-06 15:24:11 +00:00
|
|
|
|
|
2021-05-20 09:07:44 +00:00
|
|
|
|
public bool EnableDescription
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _settings.EnableDescription;
|
2021-11-30 00:31:48 +00:00
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Main.ResetCache();
|
|
|
|
|
|
_settings.EnableDescription = value;
|
|
|
|
|
|
}
|
2021-05-20 09:07:44 +00:00
|
|
|
|
}
|
2022-10-18 12:25:43 +00:00
|
|
|
|
|
2021-11-30 00:31:48 +00:00
|
|
|
|
public bool HideAppsPath
|
2021-11-27 20:05:25 +00:00
|
|
|
|
{
|
2021-11-30 00:31:48 +00:00
|
|
|
|
get => _settings.HideAppsPath;
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
Main.ResetCache();
|
|
|
|
|
|
_settings.HideAppsPath = value;
|
|
|
|
|
|
}
|
2021-11-27 20:05:25 +00:00
|
|
|
|
}
|
2021-05-20 09:07:44 +00:00
|
|
|
|
|
|
|
|
|
|
public bool EnableRegistrySource
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _settings.EnableRegistrySource;
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_settings.EnableRegistrySource = value;
|
|
|
|
|
|
ReIndexing();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool EnableStartMenuSource
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _settings.EnableStartMenuSource;
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_settings.EnableStartMenuSource = value;
|
|
|
|
|
|
ReIndexing();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string CustomizedExplorerPath
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _settings.CustomizedExplorer;
|
|
|
|
|
|
set => _settings.CustomizedExplorer = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string CustomizedExplorerArg
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _settings.CustomizedArgs;
|
|
|
|
|
|
set => _settings.CustomizedArgs = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-08 12:16:47 +00:00
|
|
|
|
public ProgramSetting(PluginInitContext context, Settings settings, Win32[] win32s, UWP.Application[] uwps)
|
2014-03-29 06:42:43 +00:00
|
|
|
|
{
|
2015-01-06 15:24:11 +00:00
|
|
|
|
this.context = context;
|
2016-03-28 02:09:57 +00:00
|
|
|
|
_settings = settings;
|
2021-05-20 09:07:44 +00:00
|
|
|
|
Loaded += Setting_Loaded;
|
|
|
|
|
|
InitializeComponent();
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Setting_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2022-10-24 15:26:41 +00:00
|
|
|
|
ProgramSettingDisplayList = ProgramSettingDisplay.LoadProgramSources();
|
2019-09-08 12:16:47 +00:00
|
|
|
|
programSourceView.ItemsSource = ProgramSettingDisplayList;
|
|
|
|
|
|
|
2020-05-01 06:36:40 +00:00
|
|
|
|
ViewRefresh();
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-05-01 06:36:40 +00:00
|
|
|
|
private void ViewRefresh()
|
2014-03-29 06:42:43 +00:00
|
|
|
|
{
|
2021-01-23 04:40:10 +00:00
|
|
|
|
if (programSourceView.Items.Count == 0
|
2020-05-01 06:36:40 +00:00
|
|
|
|
&& btnProgramSourceStatus.Visibility == Visibility.Visible
|
|
|
|
|
|
&& btnEditProgramSource.Visibility == Visibility.Visible)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnProgramSourceStatus.Visibility = Visibility.Hidden;
|
|
|
|
|
|
btnEditProgramSource.Visibility = Visibility.Hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (programSourceView.Items.Count > 0
|
|
|
|
|
|
&& btnProgramSourceStatus.Visibility == Visibility.Hidden
|
|
|
|
|
|
&& btnEditProgramSource.Visibility == Visibility.Hidden)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnProgramSourceStatus.Visibility = Visibility.Visible;
|
|
|
|
|
|
btnEditProgramSource.Visibility = Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-03-29 06:42:43 +00:00
|
|
|
|
programSourceView.Items.Refresh();
|
2020-05-01 06:36:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-23 04:40:10 +00:00
|
|
|
|
private async void ReIndexing()
|
2020-05-01 06:36:40 +00:00
|
|
|
|
{
|
|
|
|
|
|
ViewRefresh();
|
2021-01-23 04:40:10 +00:00
|
|
|
|
indexingPanel.Visibility = Visibility.Visible;
|
2022-08-09 00:35:38 +00:00
|
|
|
|
await Main.IndexProgramsAsync();
|
2021-01-23 04:40:10 +00:00
|
|
|
|
indexingPanel.Visibility = Visibility.Hidden;
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2018-12-22 06:07:42 +00:00
|
|
|
|
var add = new AddProgramSource(context, _settings);
|
2021-01-23 04:40:10 +00:00
|
|
|
|
if (add.ShowDialog() ?? false)
|
2015-05-02 14:17:42 +00:00
|
|
|
|
{
|
2016-01-06 21:34:42 +00:00
|
|
|
|
ReIndexing();
|
2015-05-02 14:17:42 +00:00
|
|
|
|
}
|
2019-09-05 22:06:51 +00:00
|
|
|
|
|
2020-05-01 06:36:40 +00:00
|
|
|
|
ViewRefresh();
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-16 19:43:18 +00:00
|
|
|
|
private void DeleteProgramSources(List<ProgramSource> itemsToDelete)
|
2014-03-29 06:42:43 +00:00
|
|
|
|
{
|
2019-10-16 21:00:54 +00:00
|
|
|
|
itemsToDelete.ForEach(t1 => _settings.ProgramSources
|
|
|
|
|
|
.Remove(_settings.ProgramSources
|
|
|
|
|
|
.Where(x => x.UniqueIdentifier == t1.UniqueIdentifier)
|
|
|
|
|
|
.FirstOrDefault()));
|
2019-10-16 19:43:18 +00:00
|
|
|
|
itemsToDelete.ForEach(x => ProgramSettingDisplayList.Remove(x));
|
2019-10-16 21:00:54 +00:00
|
|
|
|
|
2019-10-16 19:43:18 +00:00
|
|
|
|
ReIndexing();
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2022-10-20 08:15:56 +00:00
|
|
|
|
var selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
|
2014-07-10 15:16:46 +00:00
|
|
|
|
if (selectedProgramSource != null)
|
2014-03-29 06:42:43 +00:00
|
|
|
|
{
|
2016-03-28 02:09:57 +00:00
|
|
|
|
var add = new AddProgramSource(selectedProgramSource, _settings);
|
2015-05-02 14:17:42 +00:00
|
|
|
|
if (add.ShowDialog() ?? false)
|
2014-08-10 14:22:54 +00:00
|
|
|
|
{
|
2016-01-06 21:34:42 +00:00
|
|
|
|
ReIndexing();
|
2014-08-10 14:22:54 +00:00
|
|
|
|
}
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-04-21 12:54:41 +00:00
|
|
|
|
string msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
|
2015-01-06 15:24:11 +00:00
|
|
|
|
MessageBox.Show(msg);
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-08-12 15:07:54 +00:00
|
|
|
|
|
|
|
|
|
|
private void btnReindex_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ReIndexing();
|
|
|
|
|
|
}
|
2014-08-13 15:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
private void BtnProgramSuffixes_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2019-10-27 09:43:22 +00:00
|
|
|
|
var p = new ProgramSuffixes(context, _settings);
|
|
|
|
|
|
if (p.ShowDialog() ?? false)
|
|
|
|
|
|
{
|
|
|
|
|
|
ReIndexing();
|
|
|
|
|
|
}
|
2014-08-13 15:16:45 +00:00
|
|
|
|
}
|
2015-01-09 02:23:48 +00:00
|
|
|
|
|
|
|
|
|
|
private void programSourceView_DragEnter(object sender, DragEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Effects = DragDropEffects.Link;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Effects = DragDropEffects.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void programSourceView_Drop(object sender, DragEventArgs e)
|
|
|
|
|
|
{
|
2019-10-16 20:35:27 +00:00
|
|
|
|
var directories = (string[])e.Data.GetData(DataFormats.FileDrop);
|
2015-01-09 02:23:48 +00:00
|
|
|
|
|
2019-10-16 20:35:27 +00:00
|
|
|
|
var directoriesToAdd = new List<ProgramSource>();
|
|
|
|
|
|
|
|
|
|
|
|
if (directories != null && directories.Length > 0)
|
2015-01-09 02:23:48 +00:00
|
|
|
|
{
|
2019-10-16 20:35:27 +00:00
|
|
|
|
foreach (string directory in directories)
|
2015-01-09 02:23:48 +00:00
|
|
|
|
{
|
2022-10-24 06:31:19 +00:00
|
|
|
|
if (Directory.Exists(directory)
|
|
|
|
|
|
&& !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(directory, System.StringComparison.InvariantCultureIgnoreCase)))
|
2015-01-09 02:23:48 +00:00
|
|
|
|
{
|
2022-10-20 09:15:16 +00:00
|
|
|
|
var source = new ProgramSource(directory);
|
2015-01-09 02:23:48 +00:00
|
|
|
|
|
2021-01-23 04:40:10 +00:00
|
|
|
|
directoriesToAdd.Add(source);
|
2015-01-09 02:23:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-10-16 20:35:27 +00:00
|
|
|
|
|
2022-10-20 09:22:31 +00:00
|
|
|
|
if (directoriesToAdd.Count() > 0)
|
2019-10-16 20:35:27 +00:00
|
|
|
|
{
|
|
|
|
|
|
directoriesToAdd.ForEach(x => _settings.ProgramSources.Add(x));
|
2021-01-23 04:40:10 +00:00
|
|
|
|
directoriesToAdd.ForEach(x => ProgramSettingDisplayList.Add(x));
|
2019-10-16 20:35:27 +00:00
|
|
|
|
|
2020-05-01 06:36:40 +00:00
|
|
|
|
ViewRefresh();
|
2019-10-16 20:35:27 +00:00
|
|
|
|
ReIndexing();
|
|
|
|
|
|
}
|
2015-01-09 02:23:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-05-02 13:47:03 +00:00
|
|
|
|
|
2019-09-05 22:06:51 +00:00
|
|
|
|
private void btnLoadAllProgramSource_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2022-10-24 15:26:41 +00:00
|
|
|
|
ProgramSettingDisplay.DisplayAllPrograms();
|
2019-09-05 22:06:51 +00:00
|
|
|
|
|
2020-05-01 06:36:40 +00:00
|
|
|
|
ViewRefresh();
|
2019-09-05 22:06:51 +00:00
|
|
|
|
}
|
2019-09-07 05:58:13 +00:00
|
|
|
|
|
2019-10-14 21:05:21 +00:00
|
|
|
|
private void btnProgramSourceStatus_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2019-10-15 11:39:55 +00:00
|
|
|
|
var selectedItems = programSourceView
|
|
|
|
|
|
.SelectedItems.Cast<ProgramSource>()
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
2022-10-18 11:28:12 +00:00
|
|
|
|
if (selectedItems.Count == 0)
|
2019-10-16 19:43:18 +00:00
|
|
|
|
{
|
2020-04-21 12:54:41 +00:00
|
|
|
|
string msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
|
2019-10-16 19:43:18 +00:00
|
|
|
|
MessageBox.Show(msg);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 11:28:12 +00:00
|
|
|
|
if (IsAllItemsUserAdded(selectedItems))
|
2019-10-16 19:43:18 +00:00
|
|
|
|
{
|
2020-04-21 12:54:41 +00:00
|
|
|
|
var msg = string.Format(context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source"));
|
2019-10-16 19:43:18 +00:00
|
|
|
|
|
|
|
|
|
|
if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DeleteProgramSources(selectedItems);
|
|
|
|
|
|
}
|
2022-10-18 11:28:12 +00:00
|
|
|
|
else if (HasMoreOrEqualEnabledItems(selectedItems))
|
2019-10-14 21:05:21 +00:00
|
|
|
|
{
|
2022-10-24 15:26:41 +00:00
|
|
|
|
ProgramSettingDisplay.SetProgramSourcesStatus(selectedItems, false);
|
2019-10-15 11:39:55 +00:00
|
|
|
|
|
2022-10-24 15:26:41 +00:00
|
|
|
|
ProgramSettingDisplay.StoreDisabledInSettings();
|
2019-10-14 21:05:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-10-24 15:26:41 +00:00
|
|
|
|
ProgramSettingDisplay.SetProgramSourcesStatus(selectedItems, true);
|
2019-10-15 11:39:55 +00:00
|
|
|
|
|
2022-10-24 15:26:41 +00:00
|
|
|
|
ProgramSettingDisplay.RemoveDisabledFromSettings();
|
2021-01-23 04:40:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-15 11:39:55 +00:00
|
|
|
|
if (selectedItems.IsReindexRequired())
|
|
|
|
|
|
ReIndexing();
|
2019-10-14 21:05:21 +00:00
|
|
|
|
|
|
|
|
|
|
programSourceView.SelectedItems.Clear();
|
|
|
|
|
|
|
2020-05-01 06:36:40 +00:00
|
|
|
|
ViewRefresh();
|
2019-10-14 21:05:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-07 05:58:13 +00:00
|
|
|
|
private void ProgramSourceView_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
programSourceView.SelectedItems.Clear();
|
|
|
|
|
|
}
|
2019-09-11 21:42:42 +00:00
|
|
|
|
|
|
|
|
|
|
private void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var headerClicked = e.OriginalSource as GridViewColumnHeader;
|
|
|
|
|
|
ListSortDirection direction;
|
|
|
|
|
|
|
|
|
|
|
|
if (headerClicked != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (headerClicked.Role != GridViewColumnHeaderRole.Padding)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (headerClicked != _lastHeaderClicked)
|
|
|
|
|
|
{
|
|
|
|
|
|
direction = ListSortDirection.Ascending;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_lastDirection == ListSortDirection.Ascending)
|
|
|
|
|
|
{
|
|
|
|
|
|
direction = ListSortDirection.Descending;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
direction = ListSortDirection.Ascending;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var columnBinding = headerClicked.Column.DisplayMemberBinding as Binding;
|
|
|
|
|
|
var sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string;
|
|
|
|
|
|
|
|
|
|
|
|
Sort(sortBy, direction);
|
2021-01-23 04:40:10 +00:00
|
|
|
|
|
2019-09-11 21:42:42 +00:00
|
|
|
|
_lastHeaderClicked = headerClicked;
|
|
|
|
|
|
_lastDirection = direction;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Sort(string sortBy, ListSortDirection direction)
|
|
|
|
|
|
{
|
2019-10-15 11:39:55 +00:00
|
|
|
|
var dataView = CollectionViewSource.GetDefaultView(programSourceView.ItemsSource);
|
2019-09-11 21:42:42 +00:00
|
|
|
|
|
|
|
|
|
|
dataView.SortDescriptions.Clear();
|
|
|
|
|
|
SortDescription sd = new SortDescription(sortBy, direction);
|
|
|
|
|
|
dataView.SortDescriptions.Add(sd);
|
|
|
|
|
|
dataView.Refresh();
|
|
|
|
|
|
}
|
2019-10-14 21:05:21 +00:00
|
|
|
|
|
2022-10-18 11:28:12 +00:00
|
|
|
|
private static bool HasMoreOrEqualEnabledItems(List<ProgramSource> items)
|
2019-10-16 19:43:18 +00:00
|
|
|
|
{
|
2022-10-18 11:28:12 +00:00
|
|
|
|
return items.Where(x => x.Enabled).Count() >= items.Count / 2;
|
2019-10-16 19:43:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-18 11:28:12 +00:00
|
|
|
|
private void programSourceView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
2019-10-14 21:05:21 +00:00
|
|
|
|
{
|
|
|
|
|
|
var selectedItems = programSourceView
|
|
|
|
|
|
.SelectedItems.Cast<ProgramSource>()
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
2022-10-18 11:28:12 +00:00
|
|
|
|
if (IsAllItemsUserAdded(selectedItems))
|
2019-10-16 19:43:18 +00:00
|
|
|
|
{
|
2020-04-21 12:54:41 +00:00
|
|
|
|
btnProgramSourceStatus.Content = context.API.GetTranslation("flowlauncher_plugin_program_delete");
|
2019-10-16 19:43:18 +00:00
|
|
|
|
}
|
2022-10-18 11:28:12 +00:00
|
|
|
|
else if (HasMoreOrEqualEnabledItems(selectedItems))
|
2019-10-14 21:05:21 +00:00
|
|
|
|
{
|
2022-10-18 11:28:12 +00:00
|
|
|
|
btnProgramSourceStatus.Content = context.API.GetTranslation("flowlauncher_plugin_program_disable");
|
2019-10-14 21:05:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-10-18 11:28:12 +00:00
|
|
|
|
btnProgramSourceStatus.Content = context.API.GetTranslation("flowlauncher_plugin_program_enable");
|
2019-10-14 21:05:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-18 06:51:13 +00:00
|
|
|
|
|
2022-10-18 11:28:12 +00:00
|
|
|
|
private void programSourceView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
2022-10-18 06:51:13 +00:00
|
|
|
|
{
|
2022-10-25 06:20:01 +00:00
|
|
|
|
var selectedProgramSource = programSourceView.SelectedItem as ProgramSource;
|
2022-10-18 06:51:13 +00:00
|
|
|
|
if (selectedProgramSource != null)
|
2022-10-18 11:28:12 +00:00
|
|
|
|
{
|
2022-10-18 06:51:13 +00:00
|
|
|
|
var add = new AddProgramSource(selectedProgramSource, _settings);
|
|
|
|
|
|
if (add.ShowDialog() ?? false)
|
|
|
|
|
|
{
|
|
|
|
|
|
ReIndexing();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-18 11:28:12 +00:00
|
|
|
|
|
|
|
|
|
|
private bool IsAllItemsUserAdded(List<ProgramSource> items)
|
|
|
|
|
|
{
|
2022-10-18 12:07:43 +00:00
|
|
|
|
return items.All(x => _settings.ProgramSources.Any(y => y.UniqueIdentifier == x.UniqueIdentifier));
|
2022-10-18 11:28:12 +00:00
|
|
|
|
}
|
2014-03-29 06:42:43 +00:00
|
|
|
|
}
|
2022-10-20 08:15:56 +00:00
|
|
|
|
}
|