/// <summary> /// Initializes a new instance of the <see cref="ResultVisualizer"/> class. /// </summary> /// <param name="result">Resulting object that should be visualized.</param> /// <param name="resultType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="image">Image that represents icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public ResultVisualizer(object result, Type resultType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) { this.result = result; this.resultType = resultType; this.interactiveResultVisualizer = interactiveResultVisualizer; Name = name; Image = image; value = SimpleCache.Create(GetValue); typeString = SimpleCache.Create(GetTypeString); valueString = SimpleCache.Create(GetValueString); }
/// <summary> /// Initializes a new instance of the <see cref="ResultVisualizer"/> class. /// </summary> /// <param name="result">Resulting object that should be visualized.</param> /// <param name="resultType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public ResultVisualizer(object result, Type resultType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer) { this.result = result; this.resultType = resultType; this.interactiveResultVisualizer = interactiveResultVisualizer; Name = name; DataType = dataType; value = SimpleCache.Create(GetValue); typeString = SimpleCache.Create(GetTypeString); valueString = SimpleCache.Create(GetValueString); }
/// <summary> /// Initializes a new instance of the <see cref="ObjectResultVisualizer"/> class. /// </summary> /// <param name="result">Resulting object that should be visualized.</param> /// <param name="resultType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public ObjectResultVisualizer(object result, Type resultType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer) : base(result, resultType, name, dataType, interactiveResultVisualizer) { }
/// <summary> /// Creates <see cref="IResultVisualizer"/> for resulting object. /// </summary> /// <param name="result">Resulting object that should be visualized.</param> /// <param name="resultType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="image">Image that represents icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> /// <returns>Instance of <see cref="IResultVisualizer"/> interface that can be used to visualize resulting object.</returns> public static IResultVisualizer Create(object result, Type resultType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) { if (result != null) { if (result.GetType().IsArray) { return(new ArrayResultVisualizer((Array)result, resultType, name, image, interactiveResultVisualizer)); } else if (typeof(IDictionary).IsAssignableFrom(result.GetType())) { return(new DictionaryResultVisualizer((IDictionary)result, resultType, name, image, interactiveResultVisualizer)); } else if (result.GetType() == typeof(Variable)) { return(new VariableResultVisualizer(((Variable)result).DowncastInterface(), resultType, name, image, interactiveResultVisualizer)); } else if (result.GetType() == typeof(VariableCollection)) { return(new VariableCollectionResultVisualizer((VariableCollection)result, resultType, name, image, interactiveResultVisualizer)); } } return(new ObjectResultVisualizer(result, resultType, name, image, interactiveResultVisualizer)); }
/// <summary> /// Initializes a new instance of the <see cref="CustomObjectResultVisualizer"/> class. /// </summary> /// <param name="result">Resulting object that should be visualized.</param> /// <param name="resultType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="image">Image that represents icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public CustomObjectResultVisualizer(object result, Type resultType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) : base(result, resultType, name, image, interactiveResultVisualizer) { }
/// <summary> /// Initializes a new instance of the <see cref="VariableCollectionResultVisualizer"/> class. /// </summary> /// <param name="variableCollection">Variable collection to be visualized.</param> /// <param name="variableCollectionType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public VariableCollectionResultVisualizer(VariableCollection variableCollection, Type variableCollectionType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer) : base(variableCollection, variableCollectionType, name, dataType, interactiveResultVisualizer) { this.variableCollection = variableCollection; }
/// <summary> /// Initializes a new instance of the <see cref="ArrayResultVisualizer"/> class. /// </summary> /// <param name="array">Array to be visualized.</param> /// <param name="arrayType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public ArrayResultVisualizer(Array array, Type arrayType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer) : base(array, arrayType, name, dataType, interactiveResultVisualizer) { this.array = array; }
/// <summary> /// Initializes a new instance of the <see cref="VariableResultVisualizer"/> class. /// </summary> /// <param name="variable">Variable to be visualized.</param> /// <param name="variableType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public VariableResultVisualizer(Variable variable, Type variableType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer) : base(variable, variableType, name, dataType, interactiveResultVisualizer) { this.variable = variable; try { extractUsingClasses = variable.GetCodeType().ClassFieldNames != null; } catch { extractUsingClasses = false; } }
/// <summary> /// Initializes a new instance of the <see cref="DictionaryResultVisualizer"/> class. /// </summary> /// <param name="dictionary">Dictionary to be visualized.</param> /// <param name="dictionaryType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public DictionaryResultVisualizer(IDictionary dictionary, Type dictionaryType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer) : base(dictionary, dictionaryType, name, dataType, interactiveResultVisualizer) { this.dictionary = dictionary; }
/// <summary> /// Initializes a new instance of the <see cref="VariableCollectionResultVisualizer"/> class. /// </summary> /// <param name="variableCollection">Variable collection to be visualized.</param> /// <param name="variableCollectionType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="image">Image that represents icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public VariableCollectionResultVisualizer(VariableCollection variableCollection, Type variableCollectionType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) : base(variableCollection, variableCollectionType, name, image, interactiveResultVisualizer) { this.variableCollection = variableCollection; }
/// <summary> /// Initializes a new instance of the <see cref="DictionaryResultVisualizer"/> class. /// </summary> /// <param name="dictionary">Dictionary to be visualized.</param> /// <param name="dictionaryType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="image">Image that represents icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public DictionaryResultVisualizer(IDictionary dictionary, Type dictionaryType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) : base(dictionary, dictionaryType, name, image, interactiveResultVisualizer) { this.dictionary = dictionary; }
/// <summary> /// Creates <see cref="IResultVisualizer"/> for resulting object. /// </summary> /// <param name="result">Resulting object that should be visualized.</param> /// <param name="resultType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="dataType">Data type that will be used to generate icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> /// <param name="shouldForceDefaultVisualizer">Should we stop using our visualizers and try to force default visualizers? (<see cref="ForceDefaultVisualizerAtttribute"/>)</param> /// <returns>Instance of <see cref="IResultVisualizer"/> interface that can be used to visualize resulting object.</returns> public static IResultVisualizer Create(object result, Type resultType, string name, CompletionDataType dataType, InteractiveResultVisualizer interactiveResultVisualizer, bool shouldForceDefaultVisualizer = false) { ResultVisualizer resultVisualizer = null; if (result != null) { if (result.GetType().IsArray) { resultVisualizer = new ArrayResultVisualizer((Array)result, resultType, name, dataType, interactiveResultVisualizer); } else if (typeof(IDictionary).IsAssignableFrom(result.GetType())) { resultVisualizer = new DictionaryResultVisualizer((IDictionary)result, resultType, name, dataType, interactiveResultVisualizer); } else if (result.GetType() == typeof(Variable)) { resultVisualizer = new VariableResultVisualizer(((Variable)result).DowncastInterface(), resultType, name, dataType, interactiveResultVisualizer); } else if (result.GetType() == typeof(VariableCollection)) { resultVisualizer = new VariableCollectionResultVisualizer((VariableCollection)result, resultType, name, dataType, interactiveResultVisualizer); } } if (resultVisualizer == null) { resultVisualizer = new ObjectResultVisualizer(result, resultType, name, dataType, interactiveResultVisualizer); } resultVisualizer.ShouldForceDefaultVisualizer = shouldForceDefaultVisualizer; return(resultVisualizer); }
/// <summary> /// Initializes a new instance of the <see cref="ArrayResultVisualizer"/> class. /// </summary> /// <param name="array">Array to be visualized.</param> /// <param name="arrayType">Type of the resulting object that should be visualized.</param> /// <param name="name">Name of the variable / property.</param> /// <param name="image">Image that represents icon of the variable / property</param> /// <param name="interactiveResultVisualizer">Interactive result visualizer that can be used for creating UI elements.</param> public ArrayResultVisualizer(Array array, Type arrayType, string name, ImageSource image, InteractiveResultVisualizer interactiveResultVisualizer) : base(array, arrayType, name, image, interactiveResultVisualizer) { this.array = array; }