public static BlockEditorLogicBase GetPLBlockEditorLogic(this ICoreObject block, IWorkingContext ViewWorkingContext = null, LanguageServiceContainer serviceContainer = null, ISynchronizeInvoke synchronizer = null) { ISynchronizeInvoke UsingSynchronizer; if (synchronizer == null) { UsingSynchronizer = block.GetSynchronizer(); } else { UsingSynchronizer = synchronizer; } return(TiaStarter.RunInSynchronizer(UsingSynchronizer, () => { PLBlockEditorLogic pl = new PLBlockEditorLogic(); IWorkingContext iwc = block.GetWorkingContext(); pl.Attach(iwc); pl.PostAttach(); EditorPayload ep = new EditorPayload(block, ViewWorkingContext, serviceContainer); pl.SetPayload(ep); OnlineManagerBase OnlineManager = pl.OnlineManager; return pl; }) as BlockEditorLogicBase); }
public static BlockEditorLogicBase GetPLBlockEditorLogic(this ICoreObject block, IWorkingContext ViewWorkingContext = null, LanguageServiceContainer serviceContainer = null, ISynchronizeInvoke synchronizer = null) { ISynchronizeInvoke UsingSynchronizer; if (synchronizer == null) { UsingSynchronizer = block.GetSynchronizer(); } else { UsingSynchronizer = synchronizer; } if (UsingSynchronizer.InvokeRequired) { return(UnifiedSynchronizerAccess.Invoke(UsingSynchronizer, new GetPLBlockEditorLogicDelegate(GetPLBlockEditorLogic), new object[4] { block, ViewWorkingContext, serviceContainer, synchronizer }).InvokeResult as BlockEditorLogicBase); } PLBlockEditorLogic pl = new PLBlockEditorLogic(EditorMode.Normal); IWorkingContext iwc = block.GetWorkingContext(); pl.Attach(iwc); //pl.Attach(ViewWorkingContext); pl.PostAttach(); EditorPayload ep = new EditorPayload(block, ViewWorkingContext, serviceContainer); pl.SetPayload(ep); //Reflector.RunInstanceMethodByName(pl, "CreateOnlineManager"); OnlineManagerBase OnlineManager = pl.OnlineManager; return(pl); }