mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix QueryTime won't change by adding fody to Flow.Launcher.Plugin.csproj and add a delegate to trigger update once the avgquerytime is changed through querying
This commit is contained in:
parent
da12a0616f
commit
2c9646791e
4 changed files with 31 additions and 21 deletions
|
|
@ -60,8 +60,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fody" Version="6.5.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Flow.Launcher
|
|||
var oldActionKeyword = plugin.Metadata.ActionKeywords[0];
|
||||
var newActionKeyword = tbAction.Text.Trim();
|
||||
newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*";
|
||||
if (!pluginViewModel.IsActionKeywordRegistered(newActionKeyword))
|
||||
if (!PluginViewModel.IsActionKeywordRegistered(newActionKeyword))
|
||||
{
|
||||
pluginViewModel.ChangeActionKeyword(newActionKeyword, oldActionKeyword);
|
||||
Close();
|
||||
|
|
|
|||
|
|
@ -83,6 +83,10 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fody" Version="6.5.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="InputSimulator" Version="1.0.4" />
|
||||
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
|
||||
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
|
||||
|
|
|
|||
|
|
@ -9,31 +9,32 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
public class PluginViewModel : BaseModel
|
||||
{
|
||||
public PluginPair PluginPair { get; set; }
|
||||
private readonly PluginPair _pluginPair;
|
||||
public PluginPair PluginPair
|
||||
{
|
||||
get => _pluginPair;
|
||||
init
|
||||
{
|
||||
_pluginPair = value;
|
||||
value.Metadata.PropertyChanged += (_, args) =>
|
||||
{
|
||||
if (args.PropertyName == nameof(PluginPair.Metadata.AvgQueryTime))
|
||||
OnPropertyChanged(nameof(QueryTime));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public ImageSource Image => ImageLoader.Load(PluginPair.Metadata.IcoPath);
|
||||
public bool PluginState
|
||||
{
|
||||
get { return !PluginPair.Metadata.Disabled; }
|
||||
set
|
||||
{
|
||||
PluginPair.Metadata.Disabled = !value;
|
||||
}
|
||||
get => !PluginPair.Metadata.Disabled;
|
||||
set => PluginPair.Metadata.Disabled = !value;
|
||||
}
|
||||
|
||||
public Control SettingControl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PluginPair.Plugin is not ISettingProvider settingProvider)
|
||||
return new Control();
|
||||
|
||||
return settingProvider.CreateSettingPanel();
|
||||
}
|
||||
}
|
||||
public Control SettingControl => PluginPair.Plugin is not ISettingProvider settingProvider ? new Control() : settingProvider.CreateSettingPanel();
|
||||
|
||||
public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed;
|
||||
public string InitilizaTime => PluginPair.Metadata.InitTime.ToString() + "ms";
|
||||
public string InitilizaTime => PluginPair.Metadata.InitTime + "ms";
|
||||
public string QueryTime => PluginPair.Metadata.AvgQueryTime + "ms";
|
||||
public string ActionKeywordsText => string.Join(Query.ActionKeywordSeperater, PluginPair.Metadata.ActionKeywords);
|
||||
public int Priority => PluginPair.Metadata.Priority;
|
||||
|
|
@ -41,7 +42,6 @@ namespace Flow.Launcher.ViewModel
|
|||
public void ChangeActionKeyword(string newActionKeyword, string oldActionKeyword)
|
||||
{
|
||||
PluginManager.ReplaceActionKeyword(PluginPair.Metadata.ID, oldActionKeyword, newActionKeyword);
|
||||
|
||||
OnPropertyChanged(nameof(ActionKeywordsText));
|
||||
}
|
||||
|
||||
|
|
@ -51,6 +51,7 @@ namespace Flow.Launcher.ViewModel
|
|||
OnPropertyChanged(nameof(Priority));
|
||||
}
|
||||
|
||||
public bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
|
||||
public static bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue