From 1492bc9604961eb21770d9c19b4060219847ccdf Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 29 Apr 2020 14:03:58 +1000 Subject: [PATCH] Update plugin tab item base UI --- Flow.Launcher/SettingWindow.xaml | 40 +++++++++---------- Flow.Launcher/SettingWindow.xaml.cs | 1 - Flow.Launcher/ViewModel/PluginViewModel.cs | 8 ++++ .../ViewModel/SettingWindowViewModel.cs | 8 ++++ .../Languages/en.xaml | 2 +- .../plugin.json | 2 +- 6 files changed, 38 insertions(+), 23 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index b655a04c5..d6cf78a40 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -98,7 +98,7 @@ - + @@ -153,37 +153,37 @@ - - - - - + HorizontalAlignment="Left"> + + + + + + + + + - - - - + + + Margin="20 0 0 0" MaxWidth="100"/> - - + MouseUp="OnPluginActionKeywordsClick" MaxWidth="100" /> + + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index af8a148da..67245e1c2 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -270,7 +270,6 @@ namespace Flow.Launcher private void OnClosed(object sender, EventArgs e) { _viewModel.Save(); - PluginManager.Save(); } private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 7021b4b95..e79636771 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -13,6 +13,14 @@ namespace Flow.Launcher.ViewModel private readonly Internationalization _translator = InternationalizationManager.Instance; public ImageSource Image => ImageLoader.Load(PluginPair.Metadata.IcoPath); + public bool PluginState + { + get { return !PluginPair.Metadata.Disabled; } + set + { + PluginPair.Metadata.Disabled = !value; + } + } public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count > 1 ? Visibility.Collapsed : Visibility.Visible; public string InitilizaTime => string.Format(_translator.GetTranslation("plugin_init_time"), PluginPair.Metadata.InitTime); public string QueryTime => string.Format(_translator.GetTranslation("plugin_query_time"), PluginPair.Metadata.AvgQueryTime); diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index a41295810..34dc4b9e9 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -82,6 +82,14 @@ namespace Flow.Launcher.ViewModel public void Save() { + foreach (var vm in PluginViewModels) + { + var id = vm.PluginPair.Metadata.ID; + + Settings.PluginSettings.Plugins[id].Disabled = vm.PluginPair.Metadata.Disabled; + } + + PluginManager.Save(); _storage.Save(); } diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml index 032595f79..b49f33c76 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.PluginManagement/Languages/en.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Flow Launcher Plugin Management + Plugin Management Install, remove or update Flow Launcher plugins \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json index b36ca08b2..5a8259f8f 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.PluginManagement/plugin.json @@ -1,7 +1,7 @@ { "ID": "D2D2C23B084D422DB66FE0C79D6C2A6A", "ActionKeyword": "wpm", - "Name": "Flow Launcher Plugin Management", + "Name": "Plugin Management", "Description": "Install/Remove/Update Flow Launcher plugins", "Author": "qianlifeng", "Version": "1.0",