public ObjectResultTreeItem(object obj, Type objType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) { this.obj = obj; this.objType = objType; this.interactiveResultVisualizer = interactiveResultVisualizer; Name = name; Image = image; valueString = SimpleCache.Create(() => Value.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="InteractiveCodeEditor" /> class. /// </summary> /// <param name="objectWriter">Interactive result visualizer object writer.</param> /// <param name="interactiveExecution">Interactive execution with delayed evaluation.</param> /// <param name="fontFamily">The font family.</param> /// <param name="fontSize">Size of the font.</param> /// <param name="indentationSize">Size of the indentation.</param> /// <param name="highlightingColors">The highlighting colors.</param> public InteractiveCodeEditor(InteractiveResultVisualizer objectWriter, SimpleCache <InteractiveExecution> interactiveExecution, string fontFamily, double fontSize, int indentationSize, params ICSharpCode.AvalonEdit.Highlighting.HighlightingColor[] highlightingColors) : base(fontFamily, fontSize, indentationSize, highlightingColors) { // Run initialization of the window in background STA thread IsEnabled = false; InteractiveExecutionCache = interactiveExecution; System.Threading.Thread thread = new System.Threading.Thread(() => { try { InteractiveExecution.scriptBase._InternalObjectWriter_ = new ObjectWriter() { InteractiveCodeEditor = this, }; InteractiveExecution.scriptBase.ObjectWriter = objectWriter; Dispatcher.InvokeAsync(() => { IsEnabled = true; Executing?.Invoke(false); }); Initialize(); Dispatcher.InvokeAsync(() => { InitializationFinished?.Invoke(); }); } catch (ExitRequestedException) { Dispatcher.InvokeAsync(() => { CloseRequested?.Invoke(); }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }); thread.SetApartmentState(System.Threading.ApartmentState.STA); thread.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="InteractiveCodeEditor" /> class. /// </summary> /// <param name="objectWriter">Interactive result visualizer object writer.</param> /// <param name="fontFamily">The font family.</param> /// <param name="fontSize">Size of the font.</param> /// <param name="indentationSize">Size of the indentation.</param> /// <param name="highlightingColors">The highlighting colors.</param> public InteractiveCodeEditor(InteractiveResultVisualizer objectWriter, string fontFamily, double fontSize, int indentationSize, params ICSharpCode.AvalonEdit.Highlighting.HighlightingColor[] highlightingColors) : base(fontFamily, fontSize, indentationSize, highlightingColors) { interactiveExecution = new InteractiveExecution(); interactiveExecution.scriptBase._InternalObjectWriter_ = new ObjectWriter() { InteractiveCodeEditor = this, }; interactiveExecution.scriptBase.ObjectWriter = objectWriter; // Run initialization of the window in background task IsEnabled = false; Task.Run(() => { try { Dispatcher.InvokeAsync(() => { IsEnabled = true; Executing?.Invoke(false); }); Initialize(); Dispatcher.InvokeAsync(() => { InitializationFinished?.Invoke(); }); } catch (ExitRequestedException) { Dispatcher.InvokeAsync(() => { CloseRequested?.Invoke(); }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }); }
public ArrayResultTreeItem(Array array, Type objType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) : base(array, objType, name, image, interactiveResultVisualizer) { this.array = array; }
public static IResultTreeItem Create(object obj, Type objType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) { if (obj != null && objType.IsArray) { return(new ArrayResultTreeItem((Array)obj, objType, name, image, interactiveResultVisualizer)); } return(new ObjectResultTreeItem(obj, objType, name, image, interactiveResultVisualizer)); }
public static IResultTreeItem Create(object obj, Type objType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) { if (obj != null && objType.IsArray) return new ArrayResultTreeItem((Array)obj, objType, name, image, interactiveResultVisualizer); return new ObjectResultTreeItem(obj, objType, name, image, interactiveResultVisualizer); }