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


C# StatusCode类代码示例

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


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

示例1: OnStatusChanged

        public void OnStatusChanged(StatusCode statusCode)
        {
            DebugReturn("OnStatusChanged():" + (StatusCode) statusCode);

            //handle returnCodes for connect, disconnect and errors (non-operations)
            switch ((StatusCode) statusCode)
            {
                case StatusCode.Connect:
                    this.DebugReturn("Connect(ed)");
                    this.peer.OpJoin(this.lobbyName); // The LobbyHandler simply joins the lobby to get updates from it
                    break;
                case StatusCode.Disconnect:
                    this.DebugReturn("Disconnect(ed) Peer.state: " + peer.PeerState);
                    break;
                case StatusCode.ExceptionOnConnect:
                    this.DebugReturn("ExceptionOnConnect(ed) Peer.state: " + peer.PeerState);
                    break;
                case StatusCode.Exception:
                    this.DebugReturn("Exception(ed) Peer.state: " + peer.PeerState);
                    break;
                default:
                    this.DebugReturn("OnStatusChanged: " + statusCode);
                    break;
            }
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:25,代码来源:LobbyHandler.cs

示例2: FormMain

        /// <summary>Initializes a new instance of the FormMain class.</summary>
        public FormMain(bool startLogging)
        {
            // This call is required by the designer
            InitializeComponent();

            // Initialize private variables
            p_CurrentIP = "-";
            p_CurrentStatus = StatusCode.None;
            p_ElapsedSeconds = 0;
            p_StartLogging = startLogging;
            p_StartupTime = DateTime.Now;
            p_TimerLog = null;

            // Initialize FormMain properties
            this.ClientSize = new Size(660, 480);
            this.Font = SystemFonts.MenuFont;

            // Initialize tray icon
            IconMain.ContextMenu = MenuMain;

            // Initialize Menu/ToolBar
            MenuShowSuccessful.Checked = Settings.Default.ShowSuccessful;
            MenuShowStatusChanges.Checked = Settings.Default.ShowStatusChanges;
            MenuShowErrors.Checked = Settings.Default.ShowErrors;
            ToolBarShowSuccessful.Pushed = MenuShowSuccessful.Checked;
            ToolBarShowStatusChanges.Pushed = MenuShowStatusChanges.Checked;
            ToolBarShowErrors.Pushed = MenuShowErrors.Checked;
        }
开发者ID:AdamWarnock,项目名称:Speed-Test-Loggger,代码行数:29,代码来源:FormMain.cs

示例3: Response

        public Response(StatusCode code, string contentType, string content, string redirectoinPath)
        {
          //  throw new NotImplementedException();
            // TODO: Add headlines (Content-Type, Content-Length,Date, [location if there is redirection])
            int content_length = content.Length;
            string content_length_string = content_length.ToString();
            DateTime date = DateTime.Now;
            string date_string = date.ToString();

            headerLines.Add("Content-Type"+ contentType);
            headerLines.Add("Content-Length"+ content_length_string);
            headerLines.Add("Date" + date_string);
            if (redirectoinPath!="")
            {
                headerLines.Add("Redirection Path" + redirectoinPath);
            }
            // TODO: Create the request string
            string status_line=GetStatusLine(code);
            string header_line = "";
            for (int i = 0; i < headerLines.Count; i++)
            {
                header_line += headerLines[i]+ " ";
            }
            //header_line += "\r\n";
            responseString = status_line + header_line + "\r\n" + content;

        }
开发者ID:bavly,项目名称:Network-project-,代码行数:27,代码来源:Response.cs

示例4: SendError

 /// <summary>
 /// Sends error page to the client
 /// </summary>
 /// <param name="statusCode">Status code</param>
 /// <param name="message">Error message</param>
 public void SendError(StatusCode statusCode, string message)
 {
     string page = GetErrorPage(statusCode, message);
     SendHeader("text/html", page.Length, statusCode);
     SendToClient(page);
     End();
 }
开发者ID:guigra,项目名称:WinCeWebServer,代码行数:12,代码来源:HttpResponse.cs

示例5: OnStatusChanged

 public void OnStatusChanged(StatusCode statusCode)
 {
     switch (statusCode)
     {
         case StatusCode.Connect:
             {
                 Peer.EstablishEncryption();
                 break;
             }
         case StatusCode.Disconnect:
         case StatusCode.DisconnectByServer:
         case StatusCode.DisconnectByServerLogic:
         case StatusCode.DisconnectByServerUserLimit:
         case StatusCode.TimeoutDisconnect:
         case StatusCode.Exception:
         case StatusCode.ExceptionOnConnect:
             {
                 Controller.OnDisconnected("" + statusCode);
                 State = new Disconnected(this);
                 break;
             }
         case StatusCode.EncryptionEstablished:
             {
                 State = new Connected(this);
                 break;
             }
         default:
             {
                 Controller.OnUnexpectedStatusCode(statusCode);
                 break;
             }
     }
 }
开发者ID:Antaresgames,项目名称:AegisBornPhoton,代码行数:33,代码来源:PhotonEngine.cs

示例6: OnStatusChanged

 public void OnStatusChanged(StatusCode statusCode)
 {
     Debug.Log("OnStatusChanged:" + statusCode.ToString());
     switch (statusCode)
     {
         case StatusCode.Connect:
             stopwatch.Stop();
             Debug.Log(string.Format("连线成功,耗时:{0}秒",stopwatch.Elapsed.TotalSeconds.ToString()));
             stopwatch.Reset();
             break;
         case StatusCode.Disconnect:
             Debug.Log("断线");
             break;
         case StatusCode.DisconnectByServerUserLimit:
             Debug.Log("人数达上线");
             break;
         case StatusCode.ExceptionOnConnect:
             Debug.Log("连线时意外错误");
             break;
         case StatusCode.DisconnectByServer:
             Debug.Log("被Server强制断线");
             break;
         case StatusCode.TimeoutDisconnect:
             Debug.Log("超时断线");
             break;
         case StatusCode.Exception:
         case StatusCode.ExceptionOnReceive:
             Debug.Log("其他例外");
             break;
     }
 }
开发者ID:roget,项目名称:UnityPhotonCloudDemo,代码行数:31,代码来源:LRCloudClient.cs

示例7: OnStatusChanged

 public void OnStatusChanged(StatusCode statusCode)
 {
     Debug.Log (statusCode.ToString ());
     switch (statusCode)
     {
     case StatusCode.Connect: 					// connect success
         Debug.Log("connect success");
         break;
     case StatusCode.Disconnect: 				// disconnected
         Debug.Log("disconnect from server");
         break;
     case StatusCode.DisconnectByServerUserLimit: //  limit on connected user
         Debug.Log ("room full");
         break;
     case StatusCode.ExceptionOnConnect:			//	error on connection
         Debug.Log("connection error");
         break;
     case StatusCode.DisconnectByServer:			// disconnected by server
         Debug.Log("disconnect by server");
         break;
     case StatusCode.TimeoutDisconnect:			// disconnected while timeout
         Debug.Log("time out");
         break;
     case StatusCode.Exception:					// other exception
     case StatusCode.ExceptionOnReceive:
         Debug.Log("unexpect error");
         break;
     }
 }
开发者ID:lagane100,项目名称:APPgame,代码行数:29,代码来源:EZCloudClient.cs

示例8: OnPeerStatusCallback

    public void OnPeerStatusCallback(Game game, StatusCode returnCode)
    {
        switch (returnCode)
        {
            case StatusCode.Connect:
                {
                    break;
                }

            case StatusCode.Disconnect:
            case StatusCode.DisconnectByServer:
            case StatusCode.DisconnectByServerLogic:
            case StatusCode.DisconnectByServerUserLimit:
            case StatusCode.TimeoutDisconnect:
                {
                    game.SetDisconnected(returnCode);
                    break;
                }

            default:
                {
                    game.DebugReturn(DebugLevel.ERROR, returnCode.ToString());
                    break;
                }
        }
    }
开发者ID:valentin-bas,项目名称:PhotonGame,代码行数:26,代码来源:WaitingForConnect.cs

示例9: Patrolling

    private void Patrolling()
    {
        if (statusCode != StatusCode.Patrol)
        {
            statusCode = StatusCode.Patrol;
            nav.ResetPath();
        }
        nav.speed = patrolSpeed;

        if (nav.destination == lastPlayerSighting.resetPosition || nav.remainingDistance < nav.stoppingDistance)
        {
            patrolTimer += Time.deltaTime;

            if (patrolTimer > patrolWaitTime)
            {
                if (wayPointIndex == patrolWayPoints.Length - 1)
                {
                    wayPointIndex = 0;
                }
                else
                {
                    wayPointIndex++;
                }

                patrolTimer = 0f;
            }
        }
        else
        {
            patrolTimer = 0f;
        }

        nav.destination = patrolWayPoints[wayPointIndex].position;
    }
开发者ID:HitomiFlower,项目名称:Stealth-VR,代码行数:34,代码来源:EnemyAI.cs

示例10: OnPeerStatusCallback

        /// <summary>
        /// The on peer status callback.
        /// </summary>
        /// <param name="game">
        /// The mmo game.
        /// </param>
        /// <param name="returnCode">
        /// The return code.
        /// </param>
        public void OnPeerStatusCallback(Game game, StatusCode returnCode)
        {
            switch (returnCode)
            {
                case StatusCode.Connect:
                    {
                        InterestArea camera;
                        game.TryGetCamera(0, out camera);
                        camera.ResetViewDistance();
                        game.Avatar.SetInterestAreaAttached(true);
                        game.SetConnected();

                        //Operations.Authenticate(game, game.Avatar.Token);
                        break;
                    }

                case StatusCode.Disconnect:
                case StatusCode.DisconnectByServer:
                case StatusCode.DisconnectByServerLogic:
                case StatusCode.DisconnectByServerUserLimit:
                case StatusCode.TimeoutDisconnect:
                    {
                        game.SetDisconnected(returnCode);
                        break;
                    }

                default:
                    {
                        game.DebugReturn(DebugLevel.ERROR, returnCode.ToString());
                        break;
                    }
            }
        }
开发者ID:azanium,项目名称:Klumbi-Unity,代码行数:42,代码来源:WaitingForConnect.cs

示例11: Chasing

    private void Chasing()
    {
        if (statusCode != StatusCode.Chasing)
        {
            statusCode = StatusCode.Chasing;
            nav.Resume();
        }
        Vector3 sightingPosDelta = enemySight.personalLastSighting - transform.position;
        if (sightingPosDelta.sqrMagnitude > 4f)
        {
            nav.destination = enemySight.personalLastSighting;
        }

        nav.speed = chaseSpeed;

        if (nav.remainingDistance < nav.stoppingDistance)
        {
            chaseTimer += Time.deltaTime;

            if (chaseTimer >= chaseWaitTime)
            {
                lastPlayerSighting.position = lastPlayerSighting.resetPosition;
                enemySight.personalLastSighting = lastPlayerSighting.resetPosition;
                chaseTimer = 0f;
            }
        }
        else
        {
            chaseTimer = 0f;
        }
    }
开发者ID:HitomiFlower,项目名称:Stealth-VR,代码行数:31,代码来源:EnemyAI.cs

示例12: Receipt

 /// <summary>
 /// ctor for product purchases
 /// </summary>
 public Receipt(Product product, StatusCode status, string storeReceipt)
 {
     PurchaseType = PurchaseType.Product;
     Product = product;
     Status = status;
     StoreReceipt = storeReceipt;
 }
开发者ID:khaerul10056,项目名称:MarkerMetro.Unity.WinIntegration,代码行数:10,代码来源:Receipt.cs

示例13: Execute

        private void Execute()
        {
            if (Interlocked.Exchange(ref flag, 1) == 0)
            {
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                 {
                     try
                     {

                         Status = StatusCode.Running;
                         Message = "Running";
                         if (initialize != null)
                             initialize();
                         Status = StatusCode.Success;
                         Message = "Success";

                     }
                     catch (Exception ex)
                     {
                         Thread.VolatileWrite(ref flag, 0);
                         Message = ex.ToString();
                         Status = StatusCode.Failure;
                     }
                 });
            }
        }
开发者ID:felix-tien,项目名称:TechLab,代码行数:26,代码来源:Initialization.cs

示例14: OnPeerStatusCallback

        public override void OnPeerStatusCallback(ClientConnection client, StatusCode returnCode)
        {
            switch (returnCode)
            {
                case StatusCode.DisconnectByServerUserLimit:
                case StatusCode.Disconnect:
                case StatusCode.DisconnectByServer:
                case StatusCode.DisconnectByServerLogic:
                case StatusCode.TimeoutDisconnect:
                    {
                        if (log.IsInfoEnabled)
                        {
                            log.InfoFormat("{0}", returnCode);
                        }

                        Counters.ConnectedClients.Decrement();
                        WindowsCounters.ConnectedClients.Decrement();

                        client.State = Disconnected.Instance;
                        client.OnDisconnected();
                        break;
                    }

                default:
                    {
                        log.WarnFormat("Connected: OnPeerStatusCallback: unexpected return code {0}", returnCode);
                        break;
                    }
            }
        }
开发者ID:JerryBian,项目名称:PhotonSample,代码行数:30,代码来源:Connected.cs

示例15: CreateResponse

 /// <summary>
 /// Creates a response to the specified request with the specified response code.
 /// The destination endpoint of the response is the source endpoint of the request.
 /// The response has the same token as the request.
 /// Type and ID are usually set automatically by the <see cref="CoAP.Stack.ReliabilityLayer"/>.
 /// </summary>
 public static Response CreateResponse(Request request, StatusCode code)
 {
     Response response = new Response(code);
     response.Destination = request.Source;
     response.Token = request.Token;
     return response;
 }
开发者ID:vjine,项目名称:CoAP.NET,代码行数:13,代码来源:Response.cs


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