Skip to content

Commit

Permalink
修复在重构Core请求逻辑后导致的扫码二维码一直转圈的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Jan 22, 2025
1 parent f68129f commit dd8a0d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Core/RuntimeObject/Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static async Task<string> get_login_urlAsync()
{
string URL = string.Empty;
int waitTime = 0;
while (waitTime <= 3000)
while (string.IsNullOrEmpty(URL) && waitTime <= 3000)
{
if (System.IO.File.Exists(Core.Config.Core_RunConfig._QrUrl))
{
Expand All @@ -22,6 +22,7 @@ public static async Task<string> get_login_urlAsync()
{
URL = fs.ReadAllText(Encoding.UTF8);
}

}
else
{
Expand Down
19 changes: 11 additions & 8 deletions Desktop/Views/Windows/AddRoom.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ private void AddRoomSave_Click(object sender, RoutedEventArgs e)
}
else
{
State = Core.RuntimeObject._Room.AddRoom(_IsAutoRec, _IsRemind, _IsDanmu, 0, long.Parse(RoomId_TextBox.Text), false).State;
Dispatcher.Invoke(() =>
{
State = Core.RuntimeObject._Room.AddRoom(_IsAutoRec, _IsRemind, _IsDanmu, 0, long.Parse(RoomId_TextBox.Text), false).State;
});
}


Expand Down Expand Up @@ -167,19 +170,19 @@ private void AddRoomSave_Click(object sender, RoutedEventArgs e)
Task.Run(() =>
{

long[] _uidl = new long[UidList.Count];
for (int i = 0; i < UidList.Count; i++)
{
_uidl[i] = UidList[i];
}
Dictionary<string, string> dic = new Dictionary<string, string>
long[] _uidl = new long[UidList.Count];
for (int i = 0; i < UidList.Count; i++)
{
_uidl[i] = UidList[i];
}
Dictionary<string, string> dic = new Dictionary<string, string>
{
{ "uids", string.Join(",", _uidl) },
{ "auto_rec", _IsAutoRec.ToString() },
{ "remind", _IsRemind.ToString() },
{ "rec_danmu", _IsDanmu.ToString() },
};
List<(long key, int State, string Message)> State = NetWork.Post.PostBody<List<(long key, int State, string Message)>>($"{Config.Core_RunConfig._DesktopIP}:{Config.Core_RunConfig._DesktopPort}/api/set_rooms/batch_add_room", dic).Result;
List<(long key, int State, string Message)> State = NetWork.Post.PostBody<List<(long key, int State, string Message)>>($"{Config.Core_RunConfig._DesktopIP}:{Config.Core_RunConfig._DesktopPort}/api/set_rooms/batch_add_room", dic).Result;

if (Core.Config.Core_RunConfig._DesktopRemoteServer || Core.Config.Core_RunConfig._LocalHTTPMode)
{
Expand Down

0 comments on commit dd8a0d3

Please sign in to comment.