Exemple #1
0
 public XamarinExpressionEvaluationCompleteEvent(XamarinExpression expression, XamarinProperty property)
 {
     _expression = expression;
     _property   = property;
 }
Exemple #2
0
        // Parses a text-based expression for evaluation.
        int IDebugExpressionContext2.ParseText(string pszCode,
                                               enum_PARSEFLAGS dwFlags,
                                               uint nRadix,
                                               out IDebugExpression2 ppExpr,
                                               out string pbstrError,
                                               out uint pichError)
        {
            pbstrError = "";
            pichError  = 0;
            ppExpr     = null;

            try
            {
                // Check if the expression belongs to the parameters
                foreach (var currVariable in _parameters)
                {
                    if (String.CompareOrdinal(currVariable.Name, pszCode) == 0)
                    {
                        ppExpr = new XamarinExpression(_engine, _thread, currVariable);
                        return(VisualStudioExtensionConstants.S_OK);
                    }
                }

                // Check if the expression belongs to the locals
                foreach (var currVariable in _locals)
                {
                    if (String.CompareOrdinal(currVariable.Name, pszCode) == 0)
                    {
                        ppExpr = new XamarinExpression(_engine, _thread, currVariable);
                        return(VisualStudioExtensionConstants.S_OK);
                    }
                }

                if (_thisObject != null)
                {
                    // Are we looking for "this"?
                    if (String.CompareOrdinal("this", pszCode) == 0)
                    {
                        ppExpr = new XamarinExpression(_engine, _thread, _thisObject);
                        return(VisualStudioExtensionConstants.S_OK);
                    }

                    // Lastly, check if it's a member of this
                    var parsedExpression = ParseThisInternals(_thisObject, pszCode);
                    if (parsedExpression != null)
                    {
                        ppExpr = parsedExpression;
                        return(VisualStudioExtensionConstants.S_OK);
                    }
                }

                pbstrError = "Invalid Expression";
                pichError  = (uint)pbstrError.Length;
                return(VisualStudioExtensionConstants.S_FALSE);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                NLogService.Logger.Error(e);
                return(VisualStudioExtensionConstants.S_FALSE);
            }
        }