Skip to content

Commit

Permalink
修正配置项的一些错误
Browse files Browse the repository at this point in the history
  • Loading branch information
aiqinxuancai committed Mar 5, 2024
1 parent d180c14 commit 08d539f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Aria2Fast/Service/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ public class AppConfigData : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

Check warning on line 21 in Aria2Fast/Service/AppConfig.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build

Nullability of reference types in type of 'event PropertyChangedEventHandler AppConfigData.PropertyChanged' doesn't match implicitly implemented member 'event PropertyChangedEventHandler? INotifyPropertyChanged.PropertyChanged'.

Check warning on line 21 in Aria2Fast/Service/AppConfig.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build

Nullability of reference types in type of 'event PropertyChangedEventHandler AppConfigData.PropertyChanged' doesn't match implicitly implemented member 'event PropertyChangedEventHandler? INotifyPropertyChanged.PropertyChanged'.

private Dictionary<string, Action> _propertyChangedActions;

public AppConfigData()
{

}

public void Init()
{
_propertyChangedActions = new Dictionary<string, Action>
{
{ nameof(Aria2Rpc), () => Aria2ApiManager.Instance.UpdateRpc() },
{ nameof(Aria2Rpc), async () => await Aria2ApiManager.Instance.UpdateRpc() },

{ nameof(Aria2Token), () => Aria2ApiManager.Instance.UpdateRpc() },
{ nameof(Aria2Token), async () => await Aria2ApiManager.Instance.UpdateRpc() },

{ nameof(Aria2UseLocal), () => {

Expand Down Expand Up @@ -183,7 +190,6 @@ public string Aria2RpcHost
/// </summary>
public bool Aria2UseLocal { get; set; } = true;

private readonly Dictionary<string, Action> _propertyChangedActions;


}
Expand All @@ -193,9 +199,9 @@ public string Aria2RpcHost
/// </summary>
public class AppConfig
{
private static readonly Lazy<AppConfig> lazy = new Lazy<AppConfig>(() => new AppConfig());
public static AppConfig Instance => lazy.Value;
private static readonly AppConfig instance = new AppConfig();

public static AppConfig Instance => instance;

public AppConfigData ConfigData { set; get; } = new AppConfigData();

Expand Down Expand Up @@ -246,7 +252,7 @@ public bool Init()
ConfigData.ClientId = Guid.NewGuid().ToString();
Save();
}

Debug.WriteLine($"初始化配置完毕");
return true;
}
catch (Exception ex)
Expand All @@ -265,6 +271,8 @@ public bool Init()
ConfigData.AddSubscriptionFilterList.Add(new SubscriptionFilterModel() { Filter = "简繁" });
ConfigData.AddSubscriptionFilterList.Add(new SubscriptionFilterModel() { Filter = "简日" });
}

ConfigData.Init();
}
}

Expand Down

0 comments on commit 08d539f

Please sign in to comment.