public QueryViewModel(
            IApplicationInteraction applicationInteraction,
            IQueryViewsProvider queryViewsProvider,
            IQueryHistoryProvider queryHistoryProvider)
        {
            _applicationInteraction = applicationInteraction;
            _queryViewsProvider     = queryViewsProvider;
            _queryHistoryProvider   = queryHistoryProvider;

            DisplayName = "Query";

            RunQueryCommand = new AsyncCommand(RunAllRawQuery, () => CanRunQuery);

            RunSelectedQueryCommand = new AsyncCommand(RunSelectedQuery, () => CanRunSelectedQuery);

            OpenHelpCommand = new AsyncCommand(OpenHelp);

            QueryHistoryView = IoC.Get <QueryHistoryViewModel>();

            QueryHistoryView.Parent = this;

            QueryHistoryView.FilterActiveDatabase = true;

            QueryHandlersMetadata = _queryViewsProvider.ListMetadata();

            CurrentQueryHandlerName = QueryHandlersMetadata.Select(p => p.Name).FirstOrDefault();
        }
Beispiel #2
0
        public QueryViewModel(
            IApplicationInteraction applicationInteraction,
            IQueryViewsProvider queryViewsProvider,
            IQueryHistoryProvider queryHistoryProvider)
        {
            _applicationInteraction = applicationInteraction;
            _queryViewsProvider     = queryViewsProvider;
            _queryHistoryProvider   = queryHistoryProvider;

            DisplayName = "Query";

            IconContent = new PackIcon {
                Kind = PackIconKind.CodeGreaterThan
            };

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(CurrentDatabase))
                {
                    SetDisplay(CurrentDatabase);
                }
            };

            RunQueryCommand = new AsyncCommand(RunAllRawQuery, () => CanRunQuery);

            RunSelectedQueryCommand = new AsyncCommand(RunSelectedQuery, () => CanRunSelectedQuery);

            OpenHelpCommand = new AsyncCommand(OpenHelp);

            QueryHistoryView = IoC.Get <QueryHistoryViewModel>();

            QueryHistoryView.Parent = this;

            QueryHistoryView.FilterActiveDatabase = true;

            QueryHandlersMetadata = _queryViewsProvider.ListMetadata();

            CurrentQueryHandlerName = QueryHandlersMetadata.Select(p => p.Name).FirstOrDefault();
        }