mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use ConcurrentDictionary for JsonRPC Settings
This commit is contained in:
parent
57541b351a
commit
3ec27edf75
1 changed files with 5 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
@ -16,10 +17,10 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
public Dictionary<string, FrameworkElement> SettingControls { get; } = new();
|
public Dictionary<string, FrameworkElement> SettingControls { get; } = new();
|
||||||
|
|
||||||
public IReadOnlyDictionary<string, object> Inner => Settings;
|
public IReadOnlyDictionary<string, object> Inner => Settings;
|
||||||
protected Dictionary<string, object> Settings { get; set; }
|
protected ConcurrentDictionary<string, object> Settings { get; set; }
|
||||||
public required IPublicAPI API { get; init; }
|
public required IPublicAPI API { get; init; }
|
||||||
|
|
||||||
private JsonStorage<Dictionary<string, object>> _storage;
|
private JsonStorage<ConcurrentDictionary<string, object>> _storage;
|
||||||
|
|
||||||
// maybe move to resource?
|
// maybe move to resource?
|
||||||
private static readonly Thickness settingControlMargin = new(0, 9, 18, 9);
|
private static readonly Thickness settingControlMargin = new(0, 9, 18, 9);
|
||||||
|
|
@ -33,7 +34,7 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
|
|
||||||
public async Task InitializeAsync()
|
public async Task InitializeAsync()
|
||||||
{
|
{
|
||||||
_storage = new JsonStorage<Dictionary<string, object>>(SettingPath);
|
_storage = new JsonStorage<ConcurrentDictionary<string, object>>(SettingPath);
|
||||||
Settings = await _storage.LoadAsync();
|
Settings = await _storage.LoadAsync();
|
||||||
|
|
||||||
foreach (var (type, attributes) in Configuration.Body)
|
foreach (var (type, attributes) in Configuration.Body)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue