Example #1
0
        public void Execute(Point center, Size controlSize)
        {
            var viewExtent = _queryBus.Execute(new GetViewExtentQuery());

            var scaledCenter = _scaler.ScalePoint(center, controlSize, viewExtent);

            _queryBus.Execute(new ZoomOutCommand(scaledCenter));
        }
Example #2
0
        public void Execute(Vector vector, Size controlSize)
        {
            var viewExtent = _messageBus.Execute(new GetViewExtentQuery());

            var scaledVector = _scaler.ScaleVector(vector, controlSize, viewExtent);

            _messageBus.Execute(new PanCommand(scaledVector));
        }
Example #3
0
        public void Execute(Size controlSize)
        {
            var viewExtent = _messageBus.Execute(new GetViewExtentQuery());

            var newViewExtent = _resizer.ResizeView(controlSize, viewExtent);

            _messageBus.Execute(new SetViewExtentCommand(newViewExtent));
        }
Example #4
0
        public void Execute(List <CanvasItem> items)
        {
            var rows = _commandBus.Execute(new GetAllRowsQuery());

            var selectedRows = items
                               .Select(p => rows.First(q => q.Id == p.Id))
                               .ToList();

            _commandBus.Execute(new SetSelectedRowsCommand(selectedRows));
        }
Example #5
0
        public EditMenuViewModel(IMessageBus messageBus)
        {
            _messageBus = messageBus;

            _copyCommand = new DelegateCommand(
                p => _messageBus.Execute(new CopyDataToClipboardCommand()),
                p => _messageBus.Execute(new CanCopyDataToClipboardQuery()));

            _copyImageCommand = new DelegateCommand(
                p => _messageBus.Execute(new CopyImageToClipboardCommand()));
        }
Example #6
0
        private List <LayoutItemViewModel> GetColumnViewModels()
        {
            var columns = _messageBus.Execute(new GetAllLinkColumnsQuery());

            var viewModels = columns
                             .Select(p => new LayoutItemViewModel(p))
                             .ToList();

            viewModels.Insert(0, new LayoutItemViewModel(null));

            return(viewModels);
        }
Example #7
0
        public ScatterPlotContextMenuViewModel(IMessageBus messageBus)
        {
            _messageBus = messageBus;

            _copyCommand = new DelegateCommand(
                p => _messageBus.Execute(new CopyDataToClipboardCommand()),
                p => _messageBus.Execute(new CanCopyDataToClipboardQuery()));

            _copyImageCommand = new DelegateCommand(
                p => _messageBus.Execute(new CopyImageToClipboardCommand()));

            _zoomToFullExtentCommand = new DelegateCommand(
                p => _messageBus.Execute(new ZoomToFullExtentCommand()));

            _clearLayoutCommand = new DelegateCommand(
                p => _messageBus.Execute(new ClearLayoutCommand()));
        }
Example #8
0
        private void RefreshViewModels()
        {
            var filterTreeNodes = _messageBus.Execute(new GetRootFilterTreeNodesQuery());

            _treeNodeViewModels = filterTreeNodes
                                  .Select(p => new TreeNodeViewModel(p, _messageBus))
                                  .ToList();

            OnPropertyChanged(() => TreeNodeViewModels);
        }
Example #9
0
        public async Task Run()
        {
            try
            {
                var res = await _messageBus.Execute("{ 'FeatureXSampleQuery': { 'Value': 5 } }");

                Console.WriteLine(res);

                await _messageBus.Execute("{ 'FeatureXSampleCommand': { 'Value': 7 } }");

                await _messageBus.Execute("{ 'NotExistingMessage': { 'Foo': 'Bar' } }");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadKey();
        }
        private void SetIsSelected(bool value)
        {
            _isSelected = value;

            OnPropertyChanged(() => IsSelected);

            if (_isSelected)
            {
                _messageBus.Execute(new SelectFilterTreeNodeCommand(_filterTreeNode));
            }
        }
Example #11
0
        private async Task ProcessMessageWithStream(HttpContext context, IMessageBus messageBus)
        {
            Stream stream  = context.Request.Body;
            string message = context.Request.Headers[CqrsBusMiddlewareOptions.Default.MessageHeader];

            var messageExecutionResult = await messageBus.Execute(message, stream);

            if (messageExecutionResult is Stream responseStream)
            {
                await responseStream.CopyToAsync(context.Response.Body);

                await responseStream.DisposeAsync(); // Dispołsować powinien ten kto stworzył ale nie wiem jak to inaczej rozwiązać, może wsadzić messageBus.Execute w usinga?
            }
            else
            {
                await context.Response.Json(messageExecutionResult);
            }
        }
Example #12
0
        private async Task ProcessMessage(HttpContext context, IMessageBus messageBus)
        {
            string message = await context.Request.Body.ReadAsString();

            var messageExecutionResult = await messageBus.Execute(message);

            if (messageExecutionResult is Stream responseStream)
            {
                responseStream.Position = 0; // Łatwo zapomnieć o resecie strumienia, ta operacja zwalnia nas z tego obowiązku ale nie pozwala na przesyłanie strumienia np od połowy...
                await responseStream.CopyToAsync(context.Response.Body);

                await responseStream.DisposeAsync(); // Dispołsować powinien ten kto stworzył ale nie wiem jak to inaczej rozwiązać, może wsadzić messageBus.Execute w usinga?
            }
            else
            {
                await context.Response.Json(messageExecutionResult);
            }
        }
Example #13
0
        private string GetFilePath()
        {
            var source = _messageBus.Execute(new GetCsvFileSourceQuery());

            return(source.FilePath);
        }
 private bool CanImport(object parameter)
 {
     return(_messageBus.Execute(new CanImportQuery()));
 }