本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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();
}
示例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;
}
}
示例6: SaveSessionState
public void SaveSessionState(IManosContext ctx, SessionState state)
{
if (!state.Modified)
return;
// Just store it
m_ActiveSessions[state.SessionID] = state;
}
示例7: Dispose
public override void Dispose()
{
if (state.connection != null) {
Disconnect();
state.connection.Dispose();
}
state = new SessionState();
}
示例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;
}
示例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");
}
示例10: OnStateChanged
protected override void OnStateChanged (SessionState state)
{
if (state == SessionState.Authenticating)
loadingIndicator.StartAnimating ();
else
loadingIndicator.StopAnimating ();
statusLabel.Text = state.ToString ();
}
示例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);
}
}
示例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" });
}
示例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" });
}
示例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;
});
}
示例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);
}