private void EnableControls(bool isLoading) { if (_reportsNavigationViewModel == null) { return; } if (_reportsNavigationViewControl.InvokeRequired) { _reportsNavigationViewControl.Invoke(new Action <bool>(EnableControls), isLoading); } else { if (_reportsNavigationViewControl != null) { if (isLoading) { _reportsNavigationViewModel.ClearReports(); } _reportsNavigationViewModel.IsLoading = isLoading; _reportsNavigationViewControl.Enabled = !isLoading; } if (_reportViewControl != null) { _reportViewControl.Enabled = !isLoading; } _openSettingsAction.UpdateEnabled(isLoading); _addReportAction.UpdateEnabled(isLoading); _editReportAction.UpdateEnabled(isLoading); _removeReportAction.UpdateEnabled(isLoading); _printReportAction.UpdateEnabled(isLoading); _pageSetupAction.UpdateEnabled(isLoading); _printPreviewReportAction.UpdateEnabled(isLoading); _saveAsReportAction.UpdateEnabled(isLoading); _refreshAction.UpdateEnabled(isLoading); } }
private void EnableControls(bool isLoading) { if (_reportsNavigationViewModel == null) { return; } var dispatcher = _reportsNavigationView.Dispatcher; if (_reportsNavigationView != null) { dispatcher.Invoke(delegate { if (isLoading) { _reportsNavigationViewModel.ClearReports(); } _reportsNavigationViewModel.IsLoading = isLoading; _reportsNavigationView.IsEnabled = !isLoading; if (_reportView != null) { _reportView.IsEnabled = !isLoading; } _openSettingsAction.UpdateEnabled(isLoading); _addReportAction.UpdateEnabled(isLoading); _editReportAction.UpdateEnabled(isLoading); _removeReportAction.UpdateEnabled(isLoading); _printReportAction.UpdateEnabled(isLoading); _saveAsReportAction.UpdateEnabled(isLoading); _refreshAction.UpdateEnabled(isLoading); }, DispatcherPriority.Normal); } }