public ServiceMatrixDiagramViewModel(ServiceMatrixDiagramAdapter adapter) { this.Adapter = adapter; this.Diagram = adapter.ViewModel; IsServiceMatrixLicenseExpired = !GlobalSettings.Instance.IsLicenseValid; this.OnShowAddEndpoint = new RelayCommand(() => { var window = new AddEndpoint(); var result = window.ShowDialog(); if ((result.HasValue ? result.Value : false) && !String.IsNullOrEmpty(window.EndpointName.Text)) { try { this.Adapter.AddEndpoint(window.EndpointName.Text, window.EndpointHostType.SelectedValue.ToString()); } catch (OperationCanceledException) { } } }); this.OnShowAddService = new RelayCommand(() => { var window = new AddService(); var result = window.ShowDialog(); if ((result.HasValue ? result.Value : false) && !String.IsNullOrEmpty(window.ServiceName.Text)) { try { this.Adapter.AddService(window.ServiceName.Text); } catch (OperationCanceledException) { } } }); }
public ServiceMatrixDiagramViewModel(ServiceMatrixDiagramAdapter adapter) { this.Adapter = adapter; this.Diagram = adapter.ViewModel; IsServiceMatrixLicenseExpired = !GlobalSettings.Instance.IsLicenseValid ; this.OnShowAddEndpoint = new RelayCommand(() => { var window = new AddEndpoint(); var result = window.ShowDialog(); if ((result.HasValue ? result.Value : false) && !String.IsNullOrEmpty(window.EndpointName.Text)) { try { this.Adapter.AddEndpoint(window.EndpointName.Text, window.EndpointHostType.SelectedValue.ToString()); } catch (OperationCanceledException) { } } }); this.OnShowAddService = new RelayCommand(() => { var window = new AddService(); var result = window.ShowDialog(); if ((result.HasValue ? result.Value : false) && !String.IsNullOrEmpty(window.ServiceName.Text)) { try { this.Adapter.AddService(window.ServiceName.Text); } catch (OperationCanceledException) { } } }); }
public ServiceMatrixDiagramViewModel(ServiceMatrixDiagramAdapter adapter) { this.Adapter = adapter; this.Diagram = adapter.ViewModel; this.OnShowAddEndpoint = new RelayCommand(() => this.ShowAddEndpoint = true); this.OnShowAddService = new RelayCommand(() => this.ShowAddService = true); this.OnAddEndpoint = new RelayCommand(AddEndpoint, () => !string.IsNullOrEmpty (this.EndpointName)); this.OnAddService = new RelayCommand(AddService, () => !string.IsNullOrEmpty(this.ServiceName)); this.OnCancel = new RelayCommand(ClearValues); this.ClearValues(); }
public ServiceMatrixDiagramViewModel(ServiceMatrixDiagramAdapter adapter) { this.Adapter = adapter; this.Diagram = adapter.ViewModel; this.OnShowAddEndpoint = new RelayCommand(() => this.ShowAddEndpoint = true); this.OnShowAddService = new RelayCommand(() => this.ShowAddService = true); this.OnAddEndpoint = new RelayCommand(AddEndpoint, () => !string.IsNullOrEmpty(this.EndpointName)); this.OnAddService = new RelayCommand(AddService, () => !string.IsNullOrEmpty(this.ServiceName)); this.OnCancel = new RelayCommand(ClearValues); this.ClearValues(); }
public Diagram(ServiceMatrixDiagramAdapter adapter) { InitializeComponent(); this.Adapter = adapter; this.DataContext = new ServiceMatrixDiagramViewModel (this.Adapter); // Visible elements on DiagramSurface (only elements rendered by Virtualization) var diagramElementsCollection = ds.DiagramElements as INotifyCollectionChanged; 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) { } } }); }