Exemple #1
0
        private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            //Collate students and add their photos
            List <Student> students = ExcelReader.CollateAwards(Globals.excelFiles.ToArray(), Globals.dataSettings).ToList(Globals.dataSettings.sortingMethod);

            PhotoCollector.CollectPhotos(students, Globals.photoFolders.ToArray(), Globals.pictureNameFormat);

            //Create the power point generator and callback function
            PowerPointGenerator           generator = new PowerPointGenerator();
            PowerPointGenerationCompleted callback  = GenerationCallback;

            //Create a thread with a callback
            Thread generationThread = new Thread(() => generator.Generate(Globals.slideshowSettings, students, generationProgress, callback));

            ThreadStart();
            generationThread.Start();
        }
Exemple #2
0
        public void Generate(SlideshowSettings settings, List <Student> students, PowerPointProgressBar progress, PowerPointGenerationCompleted callback)
        {
            string powerPointfile = "";

            if (settings.templateFilename != null && settings.templateFilename.Length > 0)
            {
                //If they are using the blank powerpoint use the resource one
                if (settings.templateFilename.ToLower() == "_blank.potx")
                {
                    powerPointfile = $@"{AppDomain.CurrentDomain.BaseDirectory}\{BLANK_POWERPOINT}";
                }
                else
                {
                    powerPointfile = settings.templateFilename;
                }

                //Create the powerpoint
                CreatePowerPoint(powerPointfile, settings, students, progress);

                callback(true);
            }
            else
            {
                callback(false);
            }
        }