private void ExportPeriod_Click(object sender, RoutedEventArgs e) { if (((Control)sender).DataContext is PeriodViewModel period) { PeriodModelsProgressBar.Visibility = Visibility.Visible; PeriodModelsProgressBar.Value = 0; ExportUtils.ExportPeriodModels(period, _updatePeriodModelsDispatch); PeriodModelsProgressBar.Visibility = Visibility.Collapsed; } }