mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Plugins Manager scaffolding
This commit is contained in:
parent
9ae9d69a57
commit
cc1d049cad
9 changed files with 165 additions and 5 deletions
29
Plugins/Flow.Launcher.Plugin.PluginManager/ContextMenu.cs
Normal file
29
Plugins/Flow.Launcher.Plugin.PluginManager/ContextMenu.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
|
{
|
||||||
|
internal class ContextMenu : IContextMenu
|
||||||
|
{
|
||||||
|
private PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
|
private Settings Settings { get; set; }
|
||||||
|
|
||||||
|
public ContextMenu(PluginInitContext context, Settings settings)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
Settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> LoadContextMenus(Result selectedResult)
|
||||||
|
{
|
||||||
|
// Open website
|
||||||
|
// Go to source code
|
||||||
|
// Report an issue?
|
||||||
|
// Request a feature?
|
||||||
|
return new List<Result>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,4 +27,12 @@
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Images\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Languages\" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
15
Plugins/Flow.Launcher.Plugin.PluginManager/Languages/en.xaml
Normal file
15
Plugins/Flow.Launcher.Plugin.PluginManager/Languages/en.xaml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<!--Dialogues-->
|
||||||
|
|
||||||
|
<!--Controls-->
|
||||||
|
|
||||||
|
<!--Plugin Infos-->
|
||||||
|
<system:String x:Key="plugin_pluginsmanager_plugin_name">Plugins Manager</system:String>
|
||||||
|
<system:String x:Key="plugin_pluginsmanager_plugin_description">Management of installing, uninstalling or updating Flow Launcher plugins</system:String>
|
||||||
|
|
||||||
|
<!--Context menu items-->
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
@ -1,10 +1,58 @@
|
||||||
using System;
|
using Flow.Launcher.Infrastructure.Storage;
|
||||||
|
using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
using Flow.Launcher.Plugin.PluginsManager.ViewModels;
|
||||||
|
using Flow.Launcher.Plugin.PluginsManager.Views;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.PluginsManager
|
namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
{
|
{
|
||||||
class Main
|
public class Main : ISettingProvider, IPlugin, ISavable, IContextMenu, IPluginI18n
|
||||||
{
|
{
|
||||||
|
internal PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
|
internal Settings Settings;
|
||||||
|
|
||||||
|
private SettingsViewModel viewModel;
|
||||||
|
|
||||||
|
private IContextMenu contextMenu;
|
||||||
|
|
||||||
|
public Control CreateSettingPanel()
|
||||||
|
{
|
||||||
|
return new PluginsManagerSettings(viewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
viewModel = new SettingsViewModel(context);
|
||||||
|
Settings = viewModel.Settings;
|
||||||
|
contextMenu = new ContextMenu(Context, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> LoadContextMenus(Result selectedResult)
|
||||||
|
{
|
||||||
|
return contextMenu.LoadContextMenus(selectedResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Result> Query(Query query)
|
||||||
|
{
|
||||||
|
return new List<Result>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
viewModel.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginTitle()
|
||||||
|
{
|
||||||
|
return Context.API.GetTranslation("plugin_pluginsmanager_plugin_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginDescription()
|
||||||
|
{
|
||||||
|
return Context.API.GetTranslation("plugin_pluginsmanager_plugin_description");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.PluginsManager
|
namespace Flow.Launcher.Plugin.PluginsManager.Models
|
||||||
{
|
{
|
||||||
internal class Plugin
|
internal class Plugin
|
||||||
{
|
{
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.PluginsManager
|
namespace Flow.Launcher.Plugin.PluginsManager.Models
|
||||||
{
|
{
|
||||||
class PluginsManifest
|
class PluginsManifest
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
using Flow.Launcher.Infrastructure.Storage;
|
||||||
|
using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
|
||||||
|
namespace Flow.Launcher.Plugin.PluginsManager.ViewModels
|
||||||
|
{
|
||||||
|
public class SettingsViewModel
|
||||||
|
{
|
||||||
|
private readonly PluginJsonStorage<Settings> storage;
|
||||||
|
|
||||||
|
internal Settings Settings { get; set; }
|
||||||
|
|
||||||
|
internal PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
|
public SettingsViewModel(PluginInitContext context)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
storage = new PluginJsonStorage<Settings>();
|
||||||
|
Settings = storage.Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
storage.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Window x:Class="Flow.Launcher.Plugin.PluginsManager.Views.PluginsManagerSettings"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Flow.Launcher.Plugin.PluginsManager.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="PluginsManagerSettings" Height="450" Width="800">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
using Flow.Launcher.Plugin.PluginsManager.ViewModels;
|
||||||
|
|
||||||
|
namespace Flow.Launcher.Plugin.PluginsManager.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for PluginsManagerSettings.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PluginsManagerSettings
|
||||||
|
{
|
||||||
|
private readonly SettingsViewModel viewModel;
|
||||||
|
|
||||||
|
public PluginsManagerSettings(SettingsViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
|
||||||
|
//RefreshView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue