Mehrere Async Aufrufe synchron nacheinander -> Manuelles Waiting
This commit is contained in:
@@ -1028,6 +1028,7 @@ namespace BeWo.ServiceProxy
|
||||
private static void StartWaiting()
|
||||
{
|
||||
Monitor.Enter(_Lock);
|
||||
|
||||
if ((++_RunningAsyncs) == 1 && BeWoApp.MainControl != null)
|
||||
{
|
||||
if (BeWoApp.MainControl.CurrentAnimatedBeWoWindow is null)
|
||||
@@ -1042,6 +1043,7 @@ namespace BeWo.ServiceProxy
|
||||
private static void EndWaiting()
|
||||
{
|
||||
Monitor.Enter(_Lock);
|
||||
|
||||
if ((--_RunningAsyncs) == 0 && BeWoApp.MainControl != null)
|
||||
{
|
||||
BeWoApp.MainControl.CurrentAnimatedBeWoWindow?.EndWaiting();
|
||||
@@ -1056,6 +1058,22 @@ namespace BeWo.ServiceProxy
|
||||
return _RunningAsyncs != 0;
|
||||
}
|
||||
|
||||
public static void StartManuelWaiting()
|
||||
{
|
||||
if (_RunningAsyncs != 0)
|
||||
throw new InvalidOperationException("_RunningAsyncs != 0");
|
||||
|
||||
_RunningAsyncs++;
|
||||
}
|
||||
|
||||
public static void EndManuelWaiting()
|
||||
{
|
||||
if (_RunningAsyncs != 1)
|
||||
throw new InvalidOperationException("_RunningAsyncs != 1");
|
||||
|
||||
_RunningAsyncs--;
|
||||
}
|
||||
|
||||
//public static void WaitUntilAsyncIsFinished(Action<bool> callback = null)
|
||||
//{
|
||||
// if (!IsWaiting())
|
||||
|
||||
@@ -213,18 +213,30 @@ namespace BeWo.ViewModel.View.AI
|
||||
{
|
||||
EndSending();
|
||||
ListVM.VMList.Remove(vm);
|
||||
ServiceFacade.EndManuelWaiting();
|
||||
};
|
||||
|
||||
if (RoutineInput != null)
|
||||
{
|
||||
ServiceFacade.StartManuelWaiting();
|
||||
|
||||
ServiceFacade.DoAiEnhancedServiceAsnyc(
|
||||
x => x.CreateAiConversationWithPromptbaustein(conv, ViewContext, RoutineInput.Steps.VMList[0].PromptReference.Oid.Value),
|
||||
dc =>
|
||||
{
|
||||
vm.UpdateByDataContract(dc);
|
||||
ExecuteChain(dc.Oid.Value, 1, error);
|
||||
|
||||
if(RoutineInput.Steps.Count == 1)
|
||||
{
|
||||
ServiceFacade.EndManuelWaiting();
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecuteChain(dc.Oid.Value, 1, error);
|
||||
}
|
||||
},
|
||||
error
|
||||
error,
|
||||
false
|
||||
);
|
||||
}
|
||||
else if (PromptInput != null)
|
||||
@@ -259,6 +271,8 @@ namespace BeWo.ViewModel.View.AI
|
||||
{
|
||||
FinishSending();
|
||||
|
||||
ServiceFacade.EndManuelWaiting();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -289,7 +303,8 @@ namespace BeWo.ViewModel.View.AI
|
||||
|
||||
ExecuteChain(oid, c + 1, error);
|
||||
},
|
||||
error);
|
||||
error,
|
||||
false);
|
||||
}
|
||||
private void OpenNewConversation()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user