示例#1
0
        public static void CheckAndPromptForSagaUpdate(IComponent handlerComponent, IMessageBoxService messageBoxService, IDialogWindowFactory windowFactory)
        {
            if (handlerComponent.ProcessesMultipleMessages)
            {
                var sagaRecommendationMessage =
                    handlerComponent.IsSaga
                        ? String.Format(Resources.Saga_UpdateQuery)
                        : String.Format(CultureInfo.CurrentCulture, Resources.Saga_ConvertQuery, handlerComponent.CodeIdentifier);

                var result = messageBoxService.Show(sagaRecommendationMessage, Resources.Saga_QueryTitle, MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    new ShowComponentSagaStarterPicker { WindowFactory = windowFactory, CurrentElement = handlerComponent }.Execute();
                }
            }
        }
示例#2
0
        public Diagram(ServiceMatrixDiagramAdapter adapter, IDialogWindowFactory windowFactory)
        {
            InitializeComponent();

            Adapter = adapter;
            DataContext = new ServiceMatrixDiagramViewModel(Adapter, windowFactory);

            // Visible elements on DiagramSurface (only elements rendered by Virtualization)
            var diagramElementsCollection = (INotifyCollectionChanged)ds.DiagramElements;
            diagramElementsCollection.CollectionChanged += diagramElementsCollection_CollectionChanged;

            // All nodes on Diagram Nodes
            var nodesCollection = adapter.ViewModel.Nodes as INotifyCollectionChanged;
            nodesCollection.CollectionChanged += nodesCollection_CollectionChanged;

            if (adapter.ViewModel.Nodes.Count > 0)
            {
                nodesCollection_CollectionChanged(null, null);
                ds.SizeToFit();
            }
        }
        public ServiceMatrixDiagramViewModel(ServiceMatrixDiagramAdapter adapter, IDialogWindowFactory windowFactory)
        {
            Adapter = adapter;
            Diagram = adapter.ViewModel;
            IsServiceMatrixLicenseExpired = !GlobalSettings.Instance.IsLicenseValid;
            IsReadOnly = IsReadOnly | IsServiceMatrixLicenseExpired;

            Adapter.DiagramModeChanged += AdapterOnDiagramModeChanged;
            OnShowAddEndpoint           = new RelayCommand(() =>
            {
                var viewModel = new AddEndpointViewModel();
                var dialog    = windowFactory.CreateDialog <AddEndpoint>(viewModel);
                var result    = dialog.ShowDialog();

                if (result.GetValueOrDefault() && !String.IsNullOrEmpty(viewModel.EndpointName))
                {
                    try
                    {
                        Adapter.AddEndpoint(viewModel.EndpointName, viewModel.EndpointType);
                    }
                    catch (OperationCanceledException) { }
                }
            });

            OnShowAddService = new RelayCommand(() =>
            {
                var viewModel = new AddServiceViewModel();
                var dialog    = windowFactory.CreateDialog <AddService>(viewModel);
                var result    = dialog.ShowDialog();

                if (result.GetValueOrDefault() && !String.IsNullOrEmpty(viewModel.ServiceName))
                {
                    try
                    {
                        Adapter.AddService(viewModel.ServiceName);
                    }
                    catch (OperationCanceledException) { }
                }
            });
        }
        public ServiceMatrixDiagramViewModel(ServiceMatrixDiagramAdapter adapter, IDialogWindowFactory windowFactory)
        {
            Adapter = adapter;
            Diagram = adapter.ViewModel;
            IsServiceMatrixLicenseExpired = !GlobalSettings.Instance.IsLicenseValid;
            IsReadOnly = IsReadOnly | IsServiceMatrixLicenseExpired;

            Adapter.DiagramModeChanged += AdapterOnDiagramModeChanged;
            OnShowAddEndpoint = new RelayCommand(() =>
            {
                var viewModel = new AddEndpointViewModel();
                var dialog = windowFactory.CreateDialog<AddEndpoint>(viewModel);
                var result = dialog.ShowDialog();

                if (result.GetValueOrDefault() && !String.IsNullOrEmpty(viewModel.EndpointName))
                {
                    try
                    {
                        Adapter.AddEndpoint(viewModel.EndpointName, viewModel.EndpointType);
                    }
                    catch (OperationCanceledException) { }
                }
            });

            OnShowAddService = new RelayCommand(() =>
            {
                var viewModel = new AddServiceViewModel();
                var dialog = windowFactory.CreateDialog<AddService>(viewModel);
                var result = dialog.ShowDialog();

                if (result.GetValueOrDefault() && !String.IsNullOrEmpty(viewModel.ServiceName))
                {
                    try
                    {
                        Adapter.AddService(viewModel.ServiceName);
                    }
                    catch (OperationCanceledException) { }
                }
            });
        }
示例#5
0
        public Diagram(ServiceMatrixDiagramAdapter adapter, IDialogWindowFactory windowFactory)
        {
            InitializeComponent();

            Adapter     = adapter;
            DataContext = new ServiceMatrixDiagramViewModel(Adapter, windowFactory);

            // Visible elements on DiagramSurface (only elements rendered by Virtualization)
            var diagramElementsCollection = (INotifyCollectionChanged)ds.DiagramElements;

            diagramElementsCollection.CollectionChanged += diagramElementsCollection_CollectionChanged;

            // All nodes on Diagram Nodes
            var nodesCollection = adapter.ViewModel.Nodes as INotifyCollectionChanged;

            nodesCollection.CollectionChanged += nodesCollection_CollectionChanged;

            if (adapter.ViewModel.Nodes.Count > 0)
            {
                nodesCollection_CollectionChanged(null, null);
                ds.SizeToFit();
            }
        }
示例#6
0
        public static void CheckAndPromptForSagaUpdate(IComponent handlerComponent, IMessageBoxService messageBoxService, IDialogWindowFactory windowFactory)
        {
            if (handlerComponent.ProcessesMultipleMessages)
            {
                var sagaRecommendationMessage =
                    handlerComponent.IsSaga
                        ? String.Format(Resources.Saga_UpdateQuery)
                        : String.Format(CultureInfo.CurrentCulture, Resources.Saga_ConvertQuery, handlerComponent.CodeIdentifier);

                var result = messageBoxService.Show(sagaRecommendationMessage, Resources.Saga_QueryTitle, MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    new ShowComponentSagaStarterPicker {
                        WindowFactory = windowFactory, CurrentElement = handlerComponent
                    }.Execute();
                }
            }
        }