public static BlockEditorControlBase GetPLView(this ICoreObject block, BlockEditorLogicBase logic, 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 GetPLViewDelegate(GetPLView), new object[4] { block, ViewWorkingContext, serviceContainer, synchronizer }).InvokeResult as BlockEditorControlBase); } PLBlockEditorControlElement pl = new PLBlockEditorControlElement(); if (ViewWorkingContext == null) { IWorkingContext iwc = block.GetWorkingContext(); pl.Attach(iwc); } else { pl.Attach(ViewWorkingContext); } EditorPayload ep = new EditorPayload(block, ViewWorkingContext, serviceContainer); pl.SetPayload(ep); pl.SetDomainLogic(logic); logic.SetView(pl); logic.InitializationFinished(); return(pl); }
public static BlockEditorControlBase GetPLView(this ICoreObject block, BlockEditorLogicBase logic, IWorkingContext ViewWorkingContext = null, LanguageServiceContainer serviceContainer = null, ISynchronizeInvoke synchronizer = null) { ISynchronizeInvoke UsingSynchronizer; if (synchronizer == null) { UsingSynchronizer = block.GetSynchronizer(); } else { UsingSynchronizer = synchronizer; } return(TiaStarter.RunInSynchronizer(UsingSynchronizer, () => { PLBlockEditorControlElement pl = new PLBlockEditorControlElement(); if (ViewWorkingContext == null) { IWorkingContext iwc = block.GetWorkingContext(); pl.Attach(iwc); } else { pl.Attach(ViewWorkingContext); } EditorPayload ep = new EditorPayload(block, ViewWorkingContext, serviceContainer); pl.SetPayload(ep); pl.SetDomainLogic(logic); logic.SetView(pl); logic.InitializationFinished(); return pl; }) as BlockEditorControlBase); }