diff --git a/BeWo/ServiceProxy/ServiceFacade.cs b/BeWo/ServiceProxy/ServiceFacade.cs index d62d0918d..fc70f3866 100644 --- a/BeWo/ServiceProxy/ServiceFacade.cs +++ b/BeWo/ServiceProxy/ServiceFacade.cs @@ -884,38 +884,38 @@ namespace BeWo.ServiceProxy Monitor.Exit(_Lock); } - public static bool IsWaiting() - { - return _RunningAsyncs != 0; - } - public static void WaitUntilAsyncIsFinished(Action callback = null) - { - if (!IsWaiting()) - { - callback(true); - return; - } + //public static bool IsWaiting() + //{ + // return _RunningAsyncs != 0; + //} + //public static void WaitUntilAsyncIsFinished(Action callback = null) + //{ + // if (!IsWaiting()) + // { + // callback(true); + // return; + // } - try - { - Task.Run(() => WaitUntil(() => !IsWaiting(), callback)); - } - catch(Exception) - { - callback(false); - } - } - private static async Task WaitUntil(Func condition, Action 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 condition, Action 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(); + //} } } \ No newline at end of file diff --git a/BeWo/View/Master/AdministrationView.xaml.cs b/BeWo/View/Master/AdministrationView.xaml.cs index 8d249bbee..04bfe4fe3 100644 --- a/BeWo/View/Master/AdministrationView.xaml.cs +++ b/BeWo/View/Master/AdministrationView.xaml.cs @@ -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)