예제 #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));
        }
예제 #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));
        }
예제 #3
0
        public void Execute(Size controlSize)
        {
            var viewExtent = _messageBus.Execute(new GetViewExtentQuery());

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

            _messageBus.Execute(new SetViewExtentCommand(newViewExtent));
        }
예제 #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));
        }
예제 #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()));
        }
예제 #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);
        }
예제 #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()));
        }
예제 #8
0
        private void RefreshViewModels()
        {
            var filterTreeNodes = _messageBus.Execute(new GetRootFilterTreeNodesQuery());

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

            OnPropertyChanged(() => TreeNodeViewModels);
        }
예제 #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();
        }
예제 #10
0
        private void SetIsSelected(bool value)
        {
            _isSelected = value;

            OnPropertyChanged(() => IsSelected);

            if (_isSelected)
            {
                _messageBus.Execute(new SelectFilterTreeNodeCommand(_filterTreeNode));
            }
        }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #13
0
        private string GetFilePath()
        {
            var source = _messageBus.Execute(new GetCsvFileSourceQuery());

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