コード例 #1
0
        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) { }
                }
            });
        }
コード例 #2
0
 private void InitializeCommands()
 {
     AcceptCommand = new RelayCommand<IDialogWindow>(dialog => CloseDialog(dialog), dialog => true);
 }
コード例 #3
0
 private void InitializeCommands()
 {
     AcceptCommand = new RelayCommand<dynamic>(dialog => CloseDialog(dialog), dialog => HasNewSelections());
 }