本文整理汇总了C#中ServerState类的典型用法代码示例。如果您正苦于以下问题:C# ServerState类的具体用法?C# ServerState怎么用?C# ServerState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerState类属于命名空间,在下文中一共展示了ServerState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleMenuStartServer
private void HandleMenuStartServer(object sender, RoutedEventArgs e)
{
serverState = ServerState.RUNNING;
serverMiniCheckers.UpdateMenuState(serverState);
updateRequestResponse("Server started");
Debug.WriteLine("Server Starting");
}
开发者ID:bdr27,项目名称:c-,代码行数:7,代码来源:App.xaml.cs
示例2: GetServerState
public HttpResponseMessage GetServerState(ServerState serverState)
{
var httpResponseMessage = new HttpResponseMessage();
httpResponseMessage.StatusCode = HttpStatusCode.OK;
httpResponseMessage.Content = new StringContent((string)serverState["Hello"], System.Text.Encoding.UTF8, "text/plain");
return httpResponseMessage;
}
开发者ID:ChrisMissal,项目名称:WcfWebApiContrib,代码行数:7,代码来源:FooService.cs
示例3: Main
static void Main(string[] args)
{
var serviceLocator = new ServiceLocator(CreateDIContainer());
var baseurl = new Uri("http://localhost:1000/");
var serverState = new ServerState();
serverState["Hello"] = "World";
var config = new HttpConfiguration();
config.CreateInstance = (type, context, request) => serviceLocator.GetInstance(type);
config.RequestHandlers = (handlers, se, od) => handlers.Add(new ServerStateOperationHandler(serverState));
config.ResponseHandlers = (handlers, se, od) => {
handlers.Add(new LoggingOperationHandler(new Logger()));
handlers.Add(new CompressionHandler());
};
config.Formatters.Insert(0, new JsonMediaTypeFormatter());
HttpServiceHost host = new HttpServiceHost(typeof(FooService), config, baseurl);
host.Open();
Console.WriteLine("Host open. Hit enter to exit...");
Console.WriteLine("Use a web browser and go to " + baseurl + " or do it right and get fiddler!");
Console.Read();
host.Close();
}
开发者ID:ChrisMissal,项目名称:WcfWebApiContrib,代码行数:29,代码来源:Program.cs
示例4: Initialize
public void Initialize()
{
_state = ServerState.LOADING;
CreateRemotingObjects();
_residentOpenSAGEReadyMutex = new Mutex(true, OpenSAGERemoteSettings.ResidentOpenSAGEReadyMutexName);
_state = ServerState.READY;
}
开发者ID:Qibbi,项目名称:OpenSAGE,代码行数:7,代码来源:ResidentInstance.cs
示例5: RaisePacketHandled
private void RaisePacketHandled(int id, IPacket packet, ServerState? state)
{
if (DebugPackets)
PacketsReceived.Add(packet);
if (OnPacketHandled != null)
OnPacketHandled(id, packet, state);
}
开发者ID:beppe9000,项目名称:MineLib.Network,代码行数:8,代码来源:NetworkHandler.Events.cs
示例6: WebSocketServiceHostManager
internal WebSocketServiceHostManager(Logger logger)
{
_logger = logger;
_keepClean = true;
_serviceHosts = new Dictionary<string, WebSocketServiceHost> ();
_state = ServerState.READY;
_sync = new object ();
}
开发者ID:uken,项目名称:websocket-sharp,代码行数:8,代码来源:WebSocketServiceHostManager.cs
示例7: ListenForConnections
public void ListenForConnections()
{
state = ServerState.RUNNING;
connectionListenerThread = new Thread(new ThreadStart(ConnectionListenerHandler));
connectionListenerThread.Start();
//eventCheckerThread = new Thread(new ThreadStart(CheckForEvents));
//eventCheckerThread.Start();
}
开发者ID:wshanshan,项目名称:DDD,代码行数:8,代码来源:NetworkServer.cs
示例8: HandleMenuStopServer
private void HandleMenuStopServer(object sender, RoutedEventArgs e)
{
serverState = ServerState.STOPPED;
serverMiniCheckers.UpdateMenuState(serverState);
updateRequestResponse("Server stopped");
Debug.WriteLine("Server Stopping");
}
开发者ID:bdr27,项目名称:c-,代码行数:8,代码来源:App.xaml.cs
示例9: ServerOld
public ServerOld(int id, string dataDir)
{
_id = id;
_dataDir = dataDir;
_peers = new List<Peer>();
_random = new Random(id ^ (int)DateTime.Now.Ticks);
_state = ServerState.Stopped;
}
开发者ID:cphillips83,项目名称:Raft.NET,代码行数:9,代码来源:ServerOld.cs
示例10: stepDown
protected void stepDown(IConsensus model, int term)
{
if (_state == ServerState.Leader || _state == ServerState.Candidate)
_state = ServerState.Follower;
_persistedState.UpdateState(term, null);
if (isElectionTimeout(model))
updateElectionAlarm(model);
}
开发者ID:cphillips83,项目名称:Raft.NET,代码行数:9,代码来源:ServerOld.cs
示例11: HandleServerStatusChange
private void HandleServerStatusChange(ServerState currentState)
{
//suport for calls from other threads
if (InvokeRequired)
{
Invoke((MethodInvoker) (() => HandleServerStatusChange(currentState)));
}
else
{
switch (currentState)
{
case ServerState.Starting:
btnStartStop.Enabled = false;
btnRestart.Enabled = false;
btnStartStop.Text = Locale.Tr("Starting...");
break;
case ServerState.Running:
if (ProcessHandler.Server.IsLocal)
{
btnStartStop.Text = Locale.Tr("Stop");
metroToolTip.SetToolTip(btnStartStop, "Stop the server");
}
else
{
metroToolTip.SetToolTip(btnStartStop, "Disconnect from the server");
btnStartStop.Text = Locale.Tr("Disconnect");
}
btnStartStop.Enabled = true;
btnRestart.Enabled = true;
btnStartStop.Text = Locale.Tr("Stop");
break;
case ServerState.Stopping:
btnStartStop.Enabled = false;
btnRestart.Enabled = false;
btnStartStop.Text = Locale.Tr("Stopping...");
break;
case ServerState.Stopped:
btnStartStop.Enabled = true;
btnRestart.Enabled = false;
if (ProcessHandler.Server.IsLocal)
{
btnStartStop.Text = Locale.Tr("Start");
metroToolTip.SetToolTip(btnStartStop, "Start the server");
}
else
{
btnStartStop.Text = Locale.Tr("Connect");
metroToolTip.SetToolTip(btnStartStop, "Connect to the server");
}
break;
}
}
}
开发者ID:CaptainTF,项目名称:bukkitgui2,代码行数:57,代码来源:QuickButtons.cs
示例12: HandleAsync
protected override void HandleAsync(Packet packet)
{
_state = _state ?? (ServerState) State;
foreach (var endPoint in _state.Users.GetAllExcept(packet.Address))
{
LogManager.Debug("Packet from {0} redirected to {1}", packet.UserName, endPoint);
_state.Client.Send(packet, endPoint);
}
}
开发者ID:AlexNav73,项目名称:Tanks2DOnline,代码行数:10,代码来源:DataPacketAction.cs
示例13: ChangeState
void ChangeState(ServerState newState)
{
Debug.Log("Change State: " + serverState + " >> " + newState);
if (serverState == newState) {
return;
}
ExitState();
serverState = newState;
EnterState();
}
开发者ID:MedeirosMarcelo,项目名称:TowerFall,代码行数:10,代码来源:ServerManager.cs
示例14: ServerEnteredErrorStateException
/// <summary>
/// Initializes a new instance of the <see cref="ServerEnteredErrorStateException"/> class
/// with the specified error state.
/// </summary>
/// <param name="status">The error state entered by the server.</param>
/// <exception cref="ArgumentNullException">If <paramref name="status"/> is <see langword="null"/>.</exception>
public ServerEnteredErrorStateException(ServerState status)
: base(string.Format("The server entered an error state: '{0}'", status))
{
if (status == null)
throw new ArgumentNullException("status");
_state.Status = status.Name;
#if !NET35
SerializeObjectState += (ex, args) => args.AddSerializedState(_state);
#endif
}
开发者ID:crowdy,项目名称:OpenStack-ConoHa,代码行数:17,代码来源:ServerEnteredErrorStateException.cs
示例15: UpdateServerState
public void UpdateServerState(FeedbackLevel workload, int peerCount, ServerState state)
{
if (!this.IsRegistered)
{
return;
}
var contract = new UpdateServerEvent { LoadIndex = (byte)workload, PeerCount = peerCount, State = (int)state };
var eventData = new EventData((byte)ServerEventCode.UpdateServer, contract);
this.SendEvent(eventData, new SendParameters());
}
开发者ID:JerryBian,项目名称:PhotonSample,代码行数:11,代码来源:OutgoingMasterServerPeer.cs
示例16: WebSocketSessionManager
internal WebSocketSessionManager(Logger logger)
{
_logger = logger;
_forSweep = new object ();
_keepClean = true;
_sessions = new Dictionary<string, IWebSocketSession> ();
_state = ServerState.Ready;
_sync = new object ();
setSweepTimer (60000);
}
开发者ID:hdczsf,项目名称:websocket-sharp,代码行数:11,代码来源:WebSocketSessionManager.cs
示例17: Server
public Server(int genSeed)
{
this.genSeed = genSeed;
serverName = "Test server";
maxPlayers = 4;
players = new Dictionary<IPAddress, ServerPlayer>();
port = 19283;
state = ServerState.Lobby;
Start();
}
开发者ID:MintL,项目名称:datx02-rally,代码行数:11,代码来源:Server.cs
示例18: NetworkServer
/// <summary>
/// The NetworkServer will be instantiated once in the DDD Server.
/// External applications such as agents and custom GUIs should ignore this class.
/// </summary>
/// <param name="port"></param>
/// <param name="dist"></param>
public NetworkServer(int port, ref SimulationEventDistributor dist)
{
server = null;
state = ServerState.STOPPING;
eventDist = dist;
m_serverIP = null;
this.port = port;
connectionListenerThread = null;
//eventCheckerThread = null;
clientHandlers = new List<NetworkServerConnectionHandler>();
clientHandlersLock = new object();
//clientCount = 0;
}
开发者ID:wshanshan,项目名称:DDD,代码行数:19,代码来源:NetworkServer.cs
示例19: Server
public Server()
{
Rooms = new Dictionary<MobMap, MapRoom>();
InsertAllRooms();
DisplayUp = zUpload = 0;
DisplayDown = Download = 0;
NextId = 1;
ClientMutex = new Mutex();
Socket = null;
State = ServerState.Stopped;
AcceptClientsThread = new Thread(new ThreadStart(AcceptClients));
AcceptClientsThread.IsBackground = true;
}
开发者ID:MaciejSzpakowski,项目名称:mu,代码行数:13,代码来源:Network.cs
示例20: WebSocketSessionManager
internal WebSocketSessionManager(Logger logger)
{
_logger = logger;
_clean = true;
_forSweep = new object ();
_sessions = new Dictionary<string, IWebSocketSession> ();
_state = ServerState.Ready;
_sync = ((ICollection) _sessions).SyncRoot;
_waitTime = TimeSpan.FromSeconds (1);
setSweepTimer (60000);
}
开发者ID:ppatel2,项目名称:websocket-sharp,代码行数:13,代码来源:WebSocketSessionManager.cs
注:本文中的ServerState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论