This commit is contained in:
@@ -98,25 +98,10 @@ public static partial class WechatChatClient
|
||||
var selected = await OpenLocalSearchSessionAsync(window, name, cancellationToken, query).ConfigureAwait(false);
|
||||
return new WechatSessionSnapshot(name, selected.AutomationId, true);
|
||||
}
|
||||
if (SafeName(FindByAutomationId(window, WechatLocators.CurrentChatName)) == name)
|
||||
{
|
||||
return new WechatSessionSnapshot(name, SafeAutomationId(FindByAutomationId(window, WechatLocators.CurrentChatName)!), true);
|
||||
}
|
||||
|
||||
var target = FindByAutomationId(window, "session_item_" + name);
|
||||
if (target is null)
|
||||
{
|
||||
var selected = await OpenLocalSearchSessionAsync(window, name, cancellationToken).ConfigureAwait(false);
|
||||
return new WechatSessionSnapshot(name, selected.AutomationId, true);
|
||||
}
|
||||
|
||||
ClickCenter(target);
|
||||
if (!await WaitForSessionAsync(window, name, TimeSpan.FromSeconds(10), cancellationToken))
|
||||
{
|
||||
throw new WxAgentException(WxAgentErrorCode.ResultUnconfirmed, "The requested session did not become active.");
|
||||
}
|
||||
|
||||
return new WechatSessionSnapshot(name, SafeAutomationId(target), true);
|
||||
await OpenNamedSessionAsync(window, name, cancellationToken).ConfigureAwait(false);
|
||||
var current = FindByAutomationId(window, WechatLocators.CurrentChatName);
|
||||
var currentAutomationId = current is null ? null : SafeAutomationId(current);
|
||||
return new WechatSessionSnapshot(name, currentAutomationId ?? "session_item_" + name, true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user