Ejemplo n.º 1
0
        private void ExportEngineRun()
        {
            List <TaskActivity> appropriateActivities = new List <TaskActivity>();
            TimeSpan            totalDays             = _endDateAndTime - _startDateAndTime;

            for (int day = 0; day <= totalDays.Days; day++)
            {
                DateTime date = _startDateAndTime.AddDays(day);
                Collection <TaskActivity> allActivities =
                    AppContext.Current.TaskActivitiesProvider.LoadActivities(date);
                foreach (TaskActivity activity in allActivities)
                {
                    if (_selectedTaskDescriptions.Contains(activity.TaskDescription))
                    {
                        if ((activity.StartDate >= _startDateAndTime) && (activity.StartDate <= _endDateAndTime))
                        {
                            appropriateActivities.Add(activity);
                        }
                    }
                }
            }

            LoadableItem loadableItem = _selectedExporter;

            if (loadableItem != null)
            {
                if (loadableItem.CreateInstance() is PluginExporter exporter)
                {
                    exporter.AcceptData(_startDateAndTime, _endDateAndTime, appropriateActivities.ToArray(), null);
                    exporter.BeforeExecuteSummary();
                    exporter.Execute();
                }
            }
            Close();
        }