Esempio n. 1
0
        protected override NavBarPack EndGetNavBarPack()
        {
            ShellInfo shellInfo = null;

            if (this.shellServiceTask != null)
            {
                if (this.shellServiceTask.Wait(ShellClient.shellServiceTimeout))
                {
                    if (!base.LogException())
                    {
                        shellInfo = this.shellInfo;
                    }
                }
                else
                {
                    this.stopwatch.Stop();
                    ExTraceGlobals.WebServiceTracer.TraceInformation(0, 0L, string.Format("Timeout when calling Shell Service after {0}ms", this.stopwatch.ElapsedMilliseconds));
                    EcpEventLogConstants.Tuple_Office365NavBarCallServiceTimeout.LogEvent(new object[0]);
                }
            }
            if (shellInfo != null)
            {
                NavBarPack navBarPackFromInfo = NavBarClientBase.GetNavBarPackFromInfo(shellInfo, this.cultureName);
                ExTraceGlobals.WebServiceTracer.TraceInformation(0, 0L, string.Format("NavBarData acquired. SessionId: {0}, CorrelationId: {1}", navBarPackFromInfo.NavBarData.SessionID, navBarPackFromInfo.NavBarData.CorrelationID));
                navBarPackFromInfo.IsGeminiShellEnabled = true;
                navBarPackFromInfo.IsFresh = true;
                return(navBarPackFromInfo);
            }
            return(null);
        }
Esempio n. 2
0
        protected override NavBarPack TryGetNavBarPackFromCache()
        {
            NavBarPack navBarPack = NavBarCache.Get(this.userPuid, this.userPrincipalName, this.cultureName);

            if (navBarPack != null)
            {
                navBarPack.IsFresh = false;
            }
            return(navBarPack);
        }
Esempio n. 3
0
 private void RenderO365TopNav()
 {
     if (this.navBarClient != null)
     {
         NavBarPack navBarPack = this.navBarClient.GetNavBarPack();
         if (navBarPack != null)
         {
             string str    = "NavBar.Create(" + navBarPack.ToJsonString(null) + ");";
             string script = "Sys.Application.add_init(function(){" + str + "});";
             base.ClientScript.RegisterStartupScript(base.GetType(), "NavBarInfo", script, true);
         }
     }
 }
Esempio n. 4
0
 public static void Set(string userPuid, string userPrincipalName, NavBarPack navBarPack)
 {
     if (!string.IsNullOrEmpty(userPuid))
     {
         ExTraceGlobals.WebServiceTracer.TraceInformation <string>(0, 0L, "NavBarCache::Set() Add {0} to NavBarCache.", userPuid);
         Dictionary <string, NavBarPack> cache = NavBarCache.Cache;
         lock (cache)
         {
             cache[userPuid] = navBarPack;
         }
     }
     NavBarCache.CleanUpIfNeeded();
 }
Esempio n. 5
0
 protected override NavBarPack EndGetNavBarPack()
 {
     if (!base.LogException() && this.navbarInfo != null)
     {
         NavBarPack navBarPackFromInfo = NavBarClientBase.GetNavBarPackFromInfo(this.navbarInfo, this.cultureName);
         ExTraceGlobals.WebServiceTracer.TraceInformation(0, 0L, string.Format("NavBarData acquired. SessionId: {0}, CorrelationId: {1}", navBarPackFromInfo.NavBarData.SessionID, navBarPackFromInfo.NavBarData.CorrelationID));
         navBarPackFromInfo.IsGeminiShellEnabled = false;
         navBarPackFromInfo.IsFresh = true;
         NavBarCache.Set(this.userPuid, this.userPrincipalName, navBarPackFromInfo);
         return(navBarPackFromInfo);
     }
     return(null);
 }
Esempio n. 6
0
        public PowerShellResults <NavBarPack> GetObject(Identity identity)
        {
            identity.FaultIfNull();
            bool             showAdminFeature = identity.RawIdentity == "myorg";
            NavBarClientBase navBarClientBase = NavBarClientBase.Create(showAdminFeature, false, true);
            PowerShellResults <NavBarPack> powerShellResults = new PowerShellResults <NavBarPack>();

            if (navBarClientBase != null)
            {
                navBarClientBase.PrepareNavBarPack();
                NavBarPack navBarPack = navBarClientBase.GetNavBarPack();
                if (navBarPack != null)
                {
                    powerShellResults.Output = new NavBarPack[]
                    {
                        navBarPack
                    };
                }
            }
            return(powerShellResults);
        }
Esempio n. 7
0
        public static NavBarPack Get(string userPuid, string userPrincipalName, string cultureName)
        {
            NavBarPack navBarPack = null;
            Dictionary <string, NavBarPack> cache = NavBarCache.Cache;

            lock (cache)
            {
                cache.TryGetValue(userPuid, out navBarPack);
            }
            if (navBarPack != null && navBarPack.Culture != cultureName)
            {
                ExTraceGlobals.WebServiceTracer.TraceInformation(0, 0L, "NavPack exist but with different culture so can't use. Requested for user: {0} {1}, culure: {2}, cache created: {3} with culture: {4}.", new object[]
                {
                    userPuid,
                    userPrincipalName,
                    cultureName,
                    navBarPack.CreateTime,
                    navBarPack.Culture
                });
                navBarPack = null;
            }
            return(navBarPack);
        }