Files
BeWoPlaner/BeWo/ServiceProxy/ServiceFacadeExtension.cs
2025-05-12 12:22:28 +02:00

49 lines
1.2 KiB
C#

using DevExpress.Export.Xl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Threading;
namespace BeWo.ServiceProxy
{
internal static class ServiceFacadeExtension
{
public static void DoGkvAccountingServiceAsync<T>(this UserControl uc, Func<IGkvAccountingService, T> pFunc, Action<T> pCallBack = null, bool showWaitDialog = true)
{
Action<T> lCallBack = null;
if (pCallBack != null)
{
lCallBack = (t) => uc.Dispatcher.BeginInvoke(
DispatcherPriority.Normal,
(Action)delegate
{
pCallBack(t);
});
}
ServiceFacade.DoGkvAccountingServiceAsync<T>(pFunc, lCallBack);
}
public static void DoGkvAccountingServiceAsync(this UserControl uc, Action<IGkvAccountingService> pAction, Action pCallBack = null, bool showWaitDialog = true)
{
Action lCallBack = null;
if (pCallBack != null)
{
lCallBack = () => uc.Dispatcher.BeginInvoke(
DispatcherPriority.Normal,
(Action)delegate
{
pCallBack();
});
}
ServiceFacade.DoGkvAccountingServiceAsync(pAction, lCallBack);
}
}
}