private void Flow() { try { isRunning = true; instance = (IExtension)Activator.CreateInstance(extensionType); SendSignal(Signals.ON_CREATED, new ExtensionArgs(this, Wrapper)); ExitCode = instance.Main(Data); } catch (ThreadAbortException) { ExitCode = (int)ExtensionExitCodes.Killed; } catch (Exception e) { ExitCode = (int)ExtensionExitCodes.Exception; SendSignal(Signals.ON_EXCEPTION, e); string fmt = App.GetPublicResouce <string>("OpenFxExceptionMsgTitleFmt"); fmt = string.Format(fmt, Wrapper.Info.Name); string sketch = App.GetPublicResouce <string>("OpenFxExceptionSketch"); Ux.RunOnUIThread(() => { BaseApi.ShowException(fmt, sketch, e.ToString()); }); } finally { SendSignal(Signals.COMMAND_DESTORY); isRunning = false; Finished?.Invoke(this, new ThreadFinishedEventArgs(this)); } }