void IExtensionApplication.OnEndExecution(IExecutionSession session) { if (null != HostFactory.CurrentInstance && HostFactory.ExtensionApplicationStarted) { foreach (IExtensionApplication app in HostFactory.ExtensionApplications) { if (null != app) { app.OnEndExecution(session); } } HostFactory.ExtensionApplicationStarted = false; } if (null != mSession && !Object.ReferenceEquals(mSession, session)) throw new System.InvalidOperationException("Session mismatch for begin and end execution call."); IDisposable[] disposables = null; lock (mToBeDisposedObjects) { disposables = mToBeDisposedObjects.ToArray(); mToBeDisposedObjects.Clear(); } foreach (var item in disposables) { item.Dispose(); } mSession = null; }
System.Drawing.Point GetExecutionCursor(bool start) { System.Drawing.Point cursor = new System.Drawing.Point(); IExecutionSession session = Solution.Current.ExecutionSession; if (null != session) { CodeRange codeRange = new CodeRange(); if (session.GetExecutionCursor(ref codeRange)) { if (false != start) { cursor.X = codeRange.StartInclusive.CharNo - 1; cursor.Y = codeRange.StartInclusive.LineNo - 1; } else { cursor.X = codeRange.EndExclusive.CharNo - 1; cursor.Y = codeRange.EndExclusive.LineNo - 1; } } } return(cursor); }
void IExtensionApplication.OnEndExecution(IExecutionSession session) { if (null != HostFactory.CurrentInstance && HostFactory.ExtensionApplicationStarted) { foreach (IExtensionApplication app in HostFactory.ExtensionApplications) { if (null != app) { app.OnEndExecution(session); } } HostFactory.ExtensionApplicationStarted = false; } if (null != mSession && !Object.ReferenceEquals(mSession, session)) { throw new System.InvalidOperationException("Session mismatch for begin and end execution call."); } IDisposable[] disposables = null; lock (mToBeDisposedObjects) { disposables = mToBeDisposedObjects.ToArray(); mToBeDisposedObjects.Clear(); } foreach (var item in disposables) { item.Dispose(); } mSession = null; }
void IExtensionApplication.OnBeginExecution(IExecutionSession session) { mSession = session; //Do not create HostFactory at this time if (null != HostFactory.CurrentInstance && !(HostFactory.ExtensionApplicationStarted)) { foreach (IExtensionApplication app in HostFactory.ExtensionApplications) { if (null != app) { app.OnBeginExecution(session); } } HostFactory.ExtensionApplicationStarted = true; } GeometrySettings.Reset(); GeometrySettings.RootModulePath = session.Configuration.RootModulePath; object temp = session.Configuration.GetConfigValue(ConfigurationKeys.GeometryXmlProperties); if (null != temp) { GeometrySettings.GeometryXmlProperties = (bool)temp; } }
/// <summary> /// Notify observers that the graph has evaluated /// </summary> internal static void OnGraphPostExecution(IExecutionSession session) { ActiveSession = null; if (GraphPostExecution != null) { GraphPostExecution(session); } }
bool IsDebuggingOrExecuting() { bool isExecuting = false; bool isInDebugMode = false; IExecutionSession session = Solution.Current.ExecutionSession; isExecuting = session.IsExecutionActive(ref isInDebugMode); return(isExecuting || isInDebugMode); }
private bool IsExecuting(ref bool isInDebugMode) { isInDebugMode = false; IExecutionSession session = Solution.Current.ExecutionSession; if (session != null) { return(session.IsExecutionActive(ref isInDebugMode)); } return(false); }
internal bool RunWithDebugger(RunMode runMode) { IExecutionSession session = this.ExecutionSession; if (session.RunWithDebugger(runMode) == false) { return(false); } // Returns 'true' if execution is not ended. return(false == session.ExecutionEnded); }
private static void PreSeen(IExecutionSession session) { Assert.IsNotNull(session); var filepath = "ExecutionEvents.dyn"; Assert.IsTrue(session.ResolveFilePath(ref filepath)); Assert.IsTrue(Path.IsPathRooted(filepath)); filepath = @"xyz\DoNotExist.file"; Assert.IsFalse(session.ResolveFilePath(ref filepath)); Assert.AreEqual(@"xyz\DoNotExist.file", filepath); preSeen = true; }
internal bool RunWithoutDebugger() { bool isInDebugMode = false; if (IsExecutionActive(ref isInDebugMode)) { return(true); // Already started running! } IExecutionSession session = this.ExecutionSession; session.RunWithoutDebugger(); return(true); }
internal void HandleScriptActivation() { //Check if its in playback mode, as it should be treated differently due to blocking if (player == null) { if (textCore.ChangeScript(ScriptTabControl.CurrentTab)) { CheckTabControlVisibility(false); } else { return; } } else { CheckTabControlVisibility(false); TextEditorCommand command = new TextEditorCommand(TextEditorCommand.Method.ChangeScript); command.AppendArgument(ScriptTabControl.CurrentTab); textCore.PlaybackCommand(command); } // Resize canvas to fit the next script. //if (numSlider != null) // numSlider.Visibility = Visibility.Collapsed; UpdateCanvasDimension(); IExecutionSession session = Solution.Current.ExecutionSession; UpdateScriptDisplay(Solution.Current.ActiveScript); UpdateCaretPosition(false); textCanvas.BreakpointsUpdated(); if (null != session) { CodeRange executionCursor = new CodeRange(); if (session.GetExecutionCursor(ref executionCursor)) { textCanvas.SetExecutionCursor(executionCursor); } } if (null != textEditorControl.textCore.CurrentTextBuffer) { textCanvas.ScrollOwner.ScrollToVerticalOffset( textEditorControl.textCore.VerticalScrollPosition); } }
/// <summary> /// Locates given file from pre-defined search path set to this system /// </summary> /// <param name="fileName">File name to locate.</param> /// <returns>Full path for the given file.</returns> public static string LocateFile(string fileName) { IExecutionSession session = Application.Instance.Session; if (null != session) { string filePath = session.SearchFile(fileName); if (null != filePath) { return(filePath); } } else { //In the case the session is null //But we still need to search the application directory. //Here, search the application directory. string fullPathName; System.Reflection.Assembly executingAssembly = System.Reflection.Assembly.GetExecutingAssembly(); Uri codeBaseUri = new Uri(executingAssembly.CodeBase); fullPathName = Path.Combine(Path.GetDirectoryName(codeBaseUri.LocalPath), fileName); if (null != fullPathName && File.Exists(fullPathName)) { return(fullPathName); } } //Finally also look at PATH environment variable. string[] paths = (Environment.GetEnvironmentVariable("PATH") ?? "").Split(';'); foreach (string test in paths) { string path = test.Trim(); if (!String.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, fileName))) { return(Path.GetFullPath(path)); } } return(fileName); }
void IExtensionApplication.OnBeginExecution(IExecutionSession session) { mSession = session; //Do not create HostFactory at this time if (null != HostFactory.CurrentInstance && !(HostFactory.ExtensionApplicationStarted)) { foreach (IExtensionApplication app in HostFactory.ExtensionApplications) { if (null != app) { app.OnBeginExecution(session); } } HostFactory.ExtensionApplicationStarted = true; } DSGeometrySettings.Reset(); DSGeometrySettings.RootModulePath = session.Configuration.RootModulePath; object temp = session.Configuration.GetConfigValue(ConfigurationKeys.GeometryXmlProperties); if (null != temp) DSGeometrySettings.GeometryXmlProperties = (bool)temp; }
private static void PostSeen(IExecutionSession session) { postSeen = true; }
private static void PreSeen(IExecutionSession session) { preSeen = true; }
/// <summary> /// Notify observers that the graph has evaluated /// </summary> internal static void OnGraphPostExecution(IExecutionSession session) { ActiveSession = null; if (GraphPostExecution != null) GraphPostExecution(session); }
public void OnEndExecution(IExecutionSession session) { m_events.Add(ExecutionEvent.OnEndExecution); }
public void OnResumeExecution(IExecutionSession session) { //Reset the flag. }
private static void PostSeen(IExecutionSession session) { Assert.IsNotNull(session); postSeen = true; }
private static void SetActiveSession(IExecutionSession value) { var type = typeof(ExecutionEvents); type.InvokeMember("ActiveSession", BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static, null, null, new[] { value }); }
public void OnSuspendExecution(IExecutionSession session) { //TODO: Run GC }