public static Application Application_CreateApplication(string username, string password) { var thread = new AppComThread(); Application xapp = null; thread.Invoke(() => { var vms = CreateApplicationFunc(username, password); xapp = new Application(vms); }); var sac = new StandAloneContext(xapp, thread); XContext.Instance.CurrentContext = sac; XContext.Instance.CurrentContext.UIDispatcher = System.Windows.Application.Current?.Dispatcher; return(xapp); }
public ESAPIService(Func <VMS.TPS.Common.Model.API.Application> createAppFunc) { _thread = AppComThread.Instance; _thread.SetContext(createAppFunc); }