Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
 /// <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);
 }
Ejemplo n.º 3
0
 /// <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)
 {
 }
Ejemplo n.º 4
0
 /// <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));
 }
Ejemplo n.º 5
0
 /// <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)
 {
 }
Ejemplo n.º 6
0
 /// <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;
 }
Ejemplo n.º 7
0
 /// <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;
 }
Ejemplo n.º 8
0
 /// <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;
     }
 }
Ejemplo n.º 9
0
 /// <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;
 }
Ejemplo n.º 11
0
 /// <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;
 }
Ejemplo n.º 12
0
        /// <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);
        }
Ejemplo n.º 13
0
 /// <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;
 }