Code optimization, function asynchrony

This commit is contained in:
2dust
2024-10-21 13:46:13 +08:00
parent a866017b4c
commit 3dd54312e7
22 changed files with 258 additions and 266 deletions
+7 -3
View File
@@ -23,9 +23,6 @@ namespace ServiceLib.ViewModels
{
_config = AppHandler.Instance.Config;
_updateView = updateView;
MessageBus.Current.Listen<string>(EMsgCommand.SendMsgView.ToString()).Subscribe(async x => await AppendQueueMsg(x));
MsgFilter = _config.msgUIItem.mainMsgFilter ?? string.Empty;
AutoRefresh = _config.msgUIItem.autoRefresh ?? true;
@@ -37,6 +34,13 @@ namespace ServiceLib.ViewModels
x => x.AutoRefresh,
y => y == true)
.Subscribe(c => { _config.msgUIItem.autoRefresh = AutoRefresh; });
MessageBus.Current.Listen<string>(EMsgCommand.SendMsgView.ToString()).Subscribe(OnNext);
}
private async void OnNext(string x)
{
await AppendQueueMsg(x);
}
private async Task AppendQueueMsg(string msg)