Example #1
0
        /// <summary>
        /// Gets all navigation nodes based on the navigation query parameters.
        /// </summary>
        /// <param name="queryParameters">The query parameters.</param>
        /// <returns>A hierarchy of navigation nodes.</returns>
        public IEnumerable <NavigationNode> GetAllNavigationNodes(NavigationQueryParameters queryParameters)
        {
            INavigationService navigationService;
            SPWeb currentWeb = SPContext.Current.Web;

            using (var scope = DynamiteWspContainerProxy.BeginLifetimeScope(currentWeb))
            {
                navigationService = scope.Resolve <INavigationService>();
            }

            return(navigationService.GetAllNavigationNodes(currentWeb, queryParameters));
        }
Example #2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            SPWeb rootWeb = SPContext.Current.Site.RootWeb;

            using (var scope = DynamiteWspContainerProxy.BeginLifetimeScope(rootWeb))
            {
                var configuration = scope.Resolve <IConfiguration>();

                this.GoogleAnalyticsID = configuration.GetGoogleAnalyticsIdByMostNestedScope(rootWeb);
                this.IsInDisplayMode   = SPContext.Current.FormContext.FormMode == SPControlMode.Display;
            }
        }
Example #3
0
 /// <summary>
 /// The feature deactivating.
 /// </summary>
 /// <param name="properties">
 /// The properties.
 /// </param>
 public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
 {
     using (var scope = DynamiteWspContainerProxy.BeginLifetimeScope(properties.Feature))
     {
         var webConfigModificationHelper = scope.Resolve <IWebConfigModificationHelper>();
         var parent = properties.Feature.Parent as SPWebApplication;
         if (parent != null)
         {
             // Remove any changes by owner
             webConfigModificationHelper.RemoveExistingModificationsFromOwner(
                 parent,
                 RequestLifetimeWebConfigModificationOwner);
         }
     }
 }
Example #4
0
 /// <summary>
 /// The feature activated.
 /// </summary>
 /// <param name="properties">
 /// The properties.
 /// </param>
 public override void FeatureActivated(SPFeatureReceiverProperties properties)
 {
     using (var scope = DynamiteWspContainerProxy.BeginLifetimeScope(properties.Feature))
     {
         var webConfigModificationHelper = scope.Resolve <IWebConfigModificationHelper>();
         var parent = properties.Feature.Parent as SPWebApplication;
         if (parent != null)
         {
             // Apply Web.config modifications
             webConfigModificationHelper.AddAndCleanWebConfigModification(
                 parent,
                 new Collection <SPWebConfigModification>()
             {
                 AutofacRequestHttpModuleWebConfigModification
             });
         }
     }
 }