Пример #1
0
        /// <summary>
        /// Remove section and clear tabs in dashboard.config before deleting package
        /// </summary>
        /// <param name="sender">InstalledPackage</param>
        /// <param name="e">EventArgs</param>
        private void InstalledPackage_BeforeDelete(InstalledPackage sender, EventArgs e)
        {
            if (string.Equals(sender.Data.Name, PackageConstants.SectionAlias, StringComparison.OrdinalIgnoreCase))
            {
                DashboardExtension.ClearTabs();
                var section = ApplicationContext.Current.Services.SectionService.GetByAlias(PackageConstants.SectionAlias);

                if (section != null)
                {
                    ApplicationContext.Current.Services.SectionService.DeleteSection(section);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Create a new section
        /// </summary>
        /// <param name="context">ApplicationContext</param>
        private void CreateTinifySection(ApplicationContext context)
        {
            var section = context.Services.SectionService.GetByAlias(PackageConstants.SectionAlias);

            if (section == null)
            {
                context.Services.SectionService.MakeNew(PackageConstants.SectionName,
                                                        PackageConstants.SectionAlias,
                                                        PackageConstants.SectionIcon);

                DashboardExtension.AddTabs();
            }

            _sectionRepo.AssignTinifierToAdministrators();
        }