Example #1
0
        public async Task LoadTemplates()
        {
            Templates = new List <Template>
            {
                // async ?

                //TemplateTest.GetTemplate_1(),
                //TemplateTest.GetTemplate_2(),
                TemplateTest.GetTemplate_3(),
                    TemplateTest.GetTemplate_4()
            };

            //chargement des templates stockés dans les fichiers
            var storagelist = await FileManagement.GetTemplateFoldersList();

            foreach (var stlist in storagelist)
            {
                var files = await stlist.GetFilesAsync();

                foreach (var file in files)
                {
                    if (Path.GetExtension(file.Name) == ".cv")
                    {
                        Resume.Template temp = await FileManagement.Read_template(Path.GetFileNameWithoutExtension(file.Name), stlist);

                        Templates.Add(temp);
                    }
                }
            }

            // Fill templates with defaults informations
            foreach (Template e in Templates)
            {
                e.UpdateFromIndex();
                if (e.Fonts == null)
                {
                    e.Fonts = Fonts.GetDefault();
                }
            }
        }