当前位置: 首页>>代码示例>>C#>>正文


C# SessionState类代码示例

本文整理汇总了C#中SessionState的典型用法代码示例。如果您正苦于以下问题:C# SessionState类的具体用法?C# SessionState怎么用?C# SessionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SessionState类属于命名空间,在下文中一共展示了SessionState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Session

 public Session(SessionState suggested, int minimumNumberOfPlayers)
 {
     _registeredUsers = new List<User>();
     _games = new List<Game>();
     _sessionState = suggested;
     _minmumNumberOfPlayers = minimumNumberOfPlayers;
 }
开发者ID:subskipper,项目名称:GameNights,代码行数:7,代码来源:Session.cs

示例2: Execute

        public ScriptResult Execute(string code, string[] scriptArgs, AssemblyReferences references, IEnumerable<string> namespaces,
            ScriptPackSession scriptPackSession)
        {
            Guard.AgainstNullArgument("references", references);
            Guard.AgainstNullArgument("scriptPackSession", scriptPackSession);

            references.PathReferences.UnionWith(scriptPackSession.References);

            SessionState<Evaluator> sessionState;
            if (!scriptPackSession.State.ContainsKey(SessionKey))
            {
                Logger.Debug("Creating session");
                var context = new CompilerContext(new CompilerSettings
                {
                    AssemblyReferences = references.PathReferences.ToList()
                }, new ConsoleReportPrinter());

                var evaluator = new Evaluator(context);
                var allNamespaces = namespaces.Union(scriptPackSession.Namespaces).Distinct();

                var host = _scriptHostFactory.CreateScriptHost(new ScriptPackManager(scriptPackSession.Contexts), scriptArgs);
                MonoHost.SetHost((ScriptHost)host);

                evaluator.ReferenceAssembly(typeof(MonoHost).Assembly);
                evaluator.InteractiveBaseClass = typeof(MonoHost);

                sessionState = new SessionState<Evaluator>
                {
                    References = new AssemblyReferences(references.PathReferences, references.Assemblies),
                    Namespaces = new HashSet<string>(),
                    Session = evaluator
                };

                ImportNamespaces(allNamespaces, sessionState);

                scriptPackSession.State[SessionKey] = sessionState;
            }
            else
            {
                Logger.Debug("Reusing existing session");
                sessionState = (SessionState<Evaluator>)scriptPackSession.State[SessionKey];

                var newReferences = sessionState.References == null ? references : references.Except(sessionState.References);
                foreach (var reference in newReferences.PathReferences)
                {
                    Logger.DebugFormat("Adding reference to {0}", reference);
                    sessionState.Session.LoadAssembly(reference);
                }

                sessionState.References = new AssemblyReferences(references.PathReferences, references.Assemblies);

                var newNamespaces = sessionState.Namespaces == null ? namespaces : namespaces.Except(sessionState.Namespaces);
                ImportNamespaces(newNamespaces, sessionState);
            }

            Logger.Debug("Starting execution");
            var result = Execute(code, sessionState.Session);
            Logger.Debug("Finished execution");
            return result;
        }
开发者ID:selony,项目名称:scriptcs,代码行数:60,代码来源:MonoScriptEngine.cs

示例3: HttpContext

 public HttpContext(string metabasePath, string sessionId, IDictionary<string, object> sessionState)
 {
     ServerVariables = new ServerVariables(metabasePath);
     RequestCookies = new Cookies(sessionId);
     ResponseCookies = new Cookies();
     SessionState = new SessionState(sessionState);
 }
开发者ID:mikeobrien,项目名称:ClassicAspRemoteSession,代码行数:7,代码来源:HttpContext.cs

示例4: Session

        public Session(Server server, int id, CreateSessionData sessionData)
        {
            admin = new SessionAdmin(this);
            this.server = server;
            this.id = id;
            data = sessionData;
            if(data.MinPlayers > data.MaxPlayers)
                throw new MinPlayersOutOfRangeException();
            if(data.MinPlayers < 2)
                throw new MinPlayersOutOfRangeException();
            if(data.MinPlayers > 8)
                throw new MinPlayersOutOfRangeException();
            if(data.MaxPlayers < 2)
                throw new MaxPlayersOutOfRangeException();
            if(data.MaxPlayers > 8)
                throw new MaxPlayersOutOfRangeException();
            if(data.MaxSpectators < 0)
                throw new MaxSpectatorsOutOfRangeException();

            state = SessionState.WaitingForPlayers;
            eventMgr = new SessionEventManager(this);
            players = new Dictionary<int, SessionPlayer>(data.MaxPlayers);
            playerList = new List<SessionPlayer>(data.MaxPlayers);
            spectators = new Dictionary<int, SessionSpectator>(data.MaxSpectators);
            spectatorList = new List<SessionSpectator>(data.MaxSpectators);
            creatorId = 0;
            gamesPlayed = 0;
            remainingCharacters = Utils.GetCharacterTypes(this);
            eventMgr.StartPolling();
        }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:30,代码来源:Session.cs

示例5: Init

        public void Init()
        {
            try
            {
                state = SessionState.Initialized;
                context = new XnMOpenNIContext();
                context.Init();

                session = new XnMSessionManager(context, "Click,Wave", "RaiseHand");
                session.SessionStarted += new EventHandler<PointEventArgs>(session_SessionStarted);
                session.FocusStartDetected += new EventHandler<FocusStartEventArgs>(session_FocusStartDetected);

                slider = new XnMSelectableSlider2D(bounds.Width, bounds.Height);
                slider.Deactivate += new EventHandler(slider_Deactivate);
                slider.ItemHovered += new EventHandler<SelectableSlider2DHoverEventArgs>(slider_ItemHovered);

                pointDenoiser = new XnMPointDenoiser();
                pointDenoiser.AddListener(slider);

                flowRouter = new XnMFlowRouter();
                flowRouter.SetActiveControl(pointDenoiser);

                session.AddListener(flowRouter);
            }
            catch (XnMException)
            {
                state = SessionState.Starting;
            }
        }
开发者ID:debreuil,项目名称:KinectXNA,代码行数:29,代码来源:KinectDevice.cs

示例6: SaveSessionState

        public void SaveSessionState(IManosContext ctx, SessionState state)
        {
            if (!state.Modified)
                return;

            // Just store it
            m_ActiveSessions[state.SessionID] = state;
        }
开发者ID:toptensoftware,项目名称:manos,代码行数:8,代码来源:InMemorySessionStateProvider.cs

示例7: Dispose

 public override void Dispose()
 {
     if (state.connection != null) {
         Disconnect();
         state.connection.Dispose();
     }
     state = new SessionState();
 }
开发者ID:Connorcpu,项目名称:XamarinFayeClient,代码行数:8,代码来源:PollingHandler.cs

示例8: POSSession

 public POSSession(Guid id, string userName, DateTime openDate, DateTime closeDate, SessionState state)
 {
     this.Id = id;
     this.UserName = userName;
     this.OpenDate = openDate;
     this.CloseDate = closeDate;
     this.SessionState = state;
 }
开发者ID:njmube,项目名称:SIQPOS,代码行数:8,代码来源:POSSession.cs

示例9: Session

        public Session(
            IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID)
        {
            this.Application = app;
            this.SessionID = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_ = sessionSchedule;
            this.msgFactory_ = msgFactory;

            this.SenderDefaultApplVerID = senderDefaultApplVerID;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            else
                this.ApplicationDataDictionary = this.SessionDataDictionary;

            ILog log;
            if (null != logFactory)
                log = logFactory.Create(sessID);
            else
                log = new NullLog();

            state_ = new SessionState(log, heartBtInt)
            {
                MessageStore = storeFactory.Create(sessID)
            };

            // Configuration defaults.
            // Will be overridden by the SessionFactory with values in the user's configuration.
            this.PersistMessages = true;
            this.ResetOnDisconnect = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum = true;
            this.CheckCompID = true;
            this.MillisecondsInTimeStamp = true;
            this.EnableLastMsgSeqNumProcessed = false;
            this.MaxMessagesInResendRequest = 0;
            this.SendLogoutBeforeTimeoutDisconnect = false;
            this.IgnorePossDupResendRequests = false;
            this.RequiresOrigSendingTime = true;
            this.CheckLatency = true;
            this.MaxLatency = 120;

            if (!IsSessionTime)
                Reset("Out of SessionTime (Session construction)");
            else if (IsNewSession)
                Reset("New session");

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
开发者ID:javagg,项目名称:kingstar_csharp_sdk,代码行数:58,代码来源:Session.cs

示例10: OnStateChanged

        protected override void OnStateChanged (SessionState state)
        {
            if (state == SessionState.Authenticating)
                loadingIndicator.StartAnimating ();
            else
                loadingIndicator.StopAnimating ();

            statusLabel.Text = state.ToString ();
        }
开发者ID:juancampa,项目名称:Stampsy.Social,代码行数:9,代码来源:GoogleViewController.cs

示例11: NotifySessionStateChanged

 private void NotifySessionStateChanged(SessionState state)
 {
     Debug.Log("Event: NotifySessionStateChanged Fired");
     sessionMStateLabel.text = "SessionM State: " + state.ToString();
     if (state == SessionState.StartedOnline) {
         gui.OnPopulateTiers(sessionM.GetTiers());
         sessionM.UpdateOffers();
         sessionM.FetchContent("Furious7_OneLastRide_BD_30_DM_HD_UPRX3032AH-DM_1080_800-mp4", true);
     }
 }
开发者ID:sessionm,项目名称:sessionm-enterprise-unity,代码行数:10,代码来源:SessionMSample.cs

示例12: ShouldReturnOnlyLastValueOfVariablesDeclaredManyTimes

            public void ShouldReturnOnlyLastValueOfVariablesDeclaredManyTimes([NoAutoProperties]RoslynReplEngine engine, ScriptPackSession scriptPackSession)
            {
                var session = new SessionState<Session> { Session = new ScriptEngine().CreateSession() };
                scriptPackSession.State[RoslynScriptEngine.SessionKey] = session;

                engine.Execute("int x = 1;", new string[0], new AssemblyReferences(), Enumerable.Empty<string>(), scriptPackSession);
                engine.Execute("int x = 2;", new string[0], new AssemblyReferences(), Enumerable.Empty<string>(), scriptPackSession);

                engine.GetLocalVariables(scriptPackSession).ShouldEqual(new Collection<string> { "System.Int32 x = 2" });
            }
开发者ID:jrusbatch,项目名称:scriptcs,代码行数:10,代码来源:RoslynReplEngineTests.cs

示例13: ShouldReturnOnlyLastValueOfVariablesDeclaredManyTimes

            public void ShouldReturnOnlyLastValueOfVariablesDeclaredManyTimes([NoAutoProperties]MonoScriptEngine engine, ScriptPackSession scriptPackSession)
            {
                var session = new SessionState<Evaluator> { Session = new Evaluator(new CompilerContext(new CompilerSettings(), new ConsoleReportPrinter())) };
                scriptPackSession.State[MonoScriptEngine.SessionKey] = session;

                engine.Execute("int x = 1;", new string[0], new AssemblyReferences(), Enumerable.Empty<string>(), scriptPackSession);
                engine.Execute("int x = 2;", new string[0], new AssemblyReferences(), Enumerable.Empty<string>(), scriptPackSession);

                engine.GetLocalVariables(scriptPackSession).ShouldEqual(new Collection<string> { "int x = 2" });
            }
开发者ID:jrusbatch,项目名称:scriptcs,代码行数:10,代码来源:MonoScriptEngineTests.cs

示例14: SetSessionState

        public void SetSessionState(Session session, SessionState state, string data = null)
        {
            SessionRepository.Change(session, delegate(ref Session s)
            {
                s.State = state;

                if (data != null)
                    s.StateJson = data;
            });
        }
开发者ID:kfwls,项目名称:RS2013-Refugees-United-USSD,代码行数:10,代码来源:SessionService.cs

示例15: SessionStateStoreTest

        public void SessionStateStoreTest()
        {
            SessionState session = new SessionState("12345", 100);
            db.Store(session);

            IList<SessionState> list = db.Load<SessionState>(delegate(SessionState ss){
                return ss.SessionId == "12345";
            });
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("12345", list[0].SessionId);
        }
开发者ID:wuyingyou,项目名称:uniframework,代码行数:11,代码来源:SessionStateTest.cs


注:本文中的SessionState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。