public static BlockEditorLogicBase GetGraphBlockEditorLogic(this ICoreObject block, IWorkingContext ViewWorkingContext = null, ISynchronizeInvoke synchronizer = null) { ISynchronizeInvoke UsingSynchronizer; if (synchronizer == null) { UsingSynchronizer = block.GetSynchronizer(); } else { UsingSynchronizer = synchronizer; } if (UsingSynchronizer.InvokeRequired) { return(UnifiedSynchronizerAccess.Invoke(UsingSynchronizer, new GetGraphBlockEditorLogicDelegate(GetGraphBlockEditorLogic), new object[3] { block, ViewWorkingContext, synchronizer }).InvokeResult as BlockEditorLogicBase); } GraphBlockEditorLogic pl = new GraphBlockEditorLogic(); if (ViewWorkingContext == null) { IWorkingContext iwc = block.GetWorkingContext(); pl.Attach(iwc); } else { pl.Attach(ViewWorkingContext); } pl.PostAttach(); try { pl.SetPayload(block); } catch (Exception ex) { Console.WriteLine(ex); } return(pl); }
public static BlockEditorLogicBase GetGraphBlockEditorLogic(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, () => { GraphBlockEditorLogic pl = new GraphBlockEditorLogic(); if (ViewWorkingContext == null) { IWorkingContext iwc = block.GetWorkingContext(); pl.Attach(iwc); } else { pl.Attach(ViewWorkingContext); } pl.PostAttach(); try { pl.SetPayload(block); } catch (Exception ex) { Console.WriteLine(ex); } return pl; }) as BlockEditorLogicBase); }