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


C# ServerState类代码示例

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


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


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