Example #1
0
 public TemplateService(ITemplateRepository templateRepository)
 {
     _templateRepository = templateRepository;
     AvailableTemplates  = _templateRepository.GetTemplateTypes();
     IssueTemplatePath   = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                        AvailableTemplates.First(t => t.TypeId == TemplateTypeId.InformationIssueTemplate).Name + ".docx");
 }
        private void AddColor(object param)
        {
            var newColor = new PredefinedColorViewModel(new PredefinedColor
            {
                Color          = Colors.Red,
                TargetTemplate = AvailableTemplates.First()
            });

            SelectedColorScheme.Colors.Add(newColor);
            AvailablePredefinedColors.Add(newColor);
        }
        /// <summary>
        ///     The btn add_ click.
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="e">
        ///     The e.
        /// </param>
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            Template selectedTemplate = AvailableTemplates.First(t => t.Name == ComboBoxSearch.Text);

            DataSource.Templates.Add(selectedTemplate);
            AvailableTemplates.Remove(selectedTemplate);
            UpdateDataSource();
            ComboBoxSearch.Text = string.Empty;

            if (SelectedPackage.Templates != null)
            {
                SelectedPackage.Templates = DataSource.Templates;
            }

            BtnAdd.Enabled = false;
        }