Exemplo n.º 1
0
        private void OpenQueryDesigner(object model)
        {
            Request request = model as Request;

            if (request == null)
            {
                return;
            }

            Z.ClearRightRegion(this.regionManager);
            IRegion rightRegion = this.regionManager.Regions[RegionNames.RightRegion];

            if (rightRegion == null)
            {
                return;
            }

            QueryExpression          query;
            QueryExpressionViewModel queryVM;

            if (string.IsNullOrEmpty(request.ParseTree))
            {
                query             = new QueryExpression(null, request);
                query.Expressions = new List <HermesModel>();
                queryVM           = new QueryExpressionViewModel(null, query);

                SelectStatement statement = new SelectStatement(query, null);
                query.Expressions.Add(statement);
                SelectStatementViewModel select = new SelectStatementViewModel(queryVM, statement);
                queryVM.QueryExpressions.Add(select);
            }
            else
            {
                ISerializationService serializer = container.Resolve <ISerializationService>();
                query         = serializer.FromJson(request.ParseTree);
                query.Request = request;
                queryVM       = new QueryExpressionViewModel(null, query);
            }

            QueryExpressionView queryView = new QueryExpressionView(queryVM);

            rightRegion.Add(queryView);
        }