Altes laden für Frau Schulten in AdministrationView
This commit is contained in:
@@ -884,38 +884,38 @@ namespace BeWo.ServiceProxy
|
||||
Monitor.Exit(_Lock);
|
||||
}
|
||||
|
||||
public static bool IsWaiting()
|
||||
{
|
||||
return _RunningAsyncs != 0;
|
||||
}
|
||||
public static void WaitUntilAsyncIsFinished(Action<bool> callback = null)
|
||||
{
|
||||
if (!IsWaiting())
|
||||
{
|
||||
callback(true);
|
||||
return;
|
||||
}
|
||||
//public static bool IsWaiting()
|
||||
//{
|
||||
// return _RunningAsyncs != 0;
|
||||
//}
|
||||
//public static void WaitUntilAsyncIsFinished(Action<bool> callback = null)
|
||||
//{
|
||||
// if (!IsWaiting())
|
||||
// {
|
||||
// callback(true);
|
||||
// return;
|
||||
// }
|
||||
|
||||
try
|
||||
{
|
||||
Task.Run(() => WaitUntil(() => !IsWaiting(), callback));
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
callback(false);
|
||||
}
|
||||
}
|
||||
private static async Task WaitUntil(Func<bool> condition, Action<bool> callback, int frequency = 25, int timeout = -1)
|
||||
{
|
||||
var waitTask = Task.Run(async () =>
|
||||
{
|
||||
while (!condition()) await Task.Delay(frequency);
|
||||
callback(true);
|
||||
});
|
||||
// try
|
||||
// {
|
||||
// Task.Run(() => WaitUntil(() => !IsWaiting(), callback));
|
||||
// }
|
||||
// catch(Exception)
|
||||
// {
|
||||
// callback(false);
|
||||
// }
|
||||
//}
|
||||
//private static async Task WaitUntil(Func<bool> condition, Action<bool> callback, int frequency = 25, int timeout = -1)
|
||||
//{
|
||||
// var waitTask = Task.Run(async () =>
|
||||
// {
|
||||
// while (!condition()) await Task.Delay(frequency);
|
||||
// callback(true);
|
||||
// });
|
||||
|
||||
if (waitTask != await Task.WhenAny(waitTask,
|
||||
Task.Delay(timeout)))
|
||||
throw new TimeoutException();
|
||||
}
|
||||
// if (waitTask != await Task.WhenAny(waitTask,
|
||||
// Task.Delay(timeout)))
|
||||
// throw new TimeoutException();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -243,10 +243,10 @@ namespace BeWo.View.Master
|
||||
return true;
|
||||
|
||||
// Asynchrones speichern
|
||||
if (ServiceFacade.IsWaiting())
|
||||
//if (ServiceFacade.IsWaiting())
|
||||
if(false)
|
||||
{
|
||||
Task.Run(() => ServiceFacade.WaitUntilAsyncIsFinished((s) => DoSaveCheckCallback(s, selected, header)));
|
||||
//ServiceFacade.WaitUntilAsyncIsFinished((s) => DoSaveCheckCallback(s, header)).Wait();
|
||||
//Task.Run(() => ServiceFacade.WaitUntilAsyncIsFinished((s) => DoSaveCheckCallback(s, selected, header)));
|
||||
}
|
||||
// Verwerfen
|
||||
else
|
||||
@@ -267,7 +267,7 @@ namespace BeWo.View.Master
|
||||
_OpenViews.Remove(TabitemMandator.Header.ToString());
|
||||
_OpenViews.Remove(TabitemSozioTherapie.Header.ToString());
|
||||
|
||||
MandatorVM = null;
|
||||
_MandatorVM = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -333,7 +333,8 @@ namespace BeWo.View.Master
|
||||
|
||||
if (ContentBorder.Child == null || DoSaveCheck())
|
||||
{
|
||||
ServiceFacade.WaitUntilAsyncIsFinished((s) => Dispatcher.Invoke(() => SelectedView = newView));
|
||||
SelectedView = newView;
|
||||
//ServiceFacade.WaitUntilAsyncIsFinished((s) => Dispatcher.Invoke(() => SelectedView = newView));
|
||||
}
|
||||
}
|
||||
private void GenerateNewView(AccordionItem accordionItem)
|
||||
|
||||
Reference in New Issue
Block a user