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


C# ConnectionStatus类代码示例

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


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

示例1: SetResult

 public void SetResult(ConnectionStatus status)
 {
     if (!_enabled)
         return;
     this._result = status;
     this._stopwatch.Stop();
 }
开发者ID:Rustemt,项目名称:NEST,代码行数:7,代码来源:ConnectionStatusTracer.cs

示例2: ClientStream

 /// <summary>
 /// Public constructor for createing a Client object
 /// </summary>
 /// <param name="iSocket">Socket associated with the Client object</param>
 /// <param name="iClientStreamIndex">Index number of the associated Client object</param>
 public ClientStream(Socket iSocket, int iClientStreamIndex)
 {
     Socket = iSocket;
     Index = iClientStreamIndex;
     ConnectionStatus = ConnectionStatus.Pending;
     OnClientConnect();
 }
开发者ID:SpectralCoding,项目名称:boobox-server,代码行数:12,代码来源:ClientStream.cs

示例3: lokunclientform

        public lokunclientform()
        {
            InitializeComponent();
            lokun = Lokun.instance;
            connected = ConnectionStatus.NotRunning;
            chkAutostart.Checked = lokun.Autostart;
            btnDownload.Enabled = false;

            switch(lokun.UserRoutingSetting)
            {
                case RoutingSetting.Everything:
                    rdTunnelEverything.Checked = true;
                    break;
                case RoutingSetting.ExcludeISNets:
                    rdExcludeIcelandic.Checked = true;
                    break;
                case RoutingSetting.OnlyISNets:
                    rdOnlyIcelandic.Checked = true;
                    break;
            }

            StartStopSetUI(lokun.OpenVPNServiceIsRunning);

            var username = lokun.GetCurrentUsername();
            if (username != null)
            {
                txtUsername.Text = username;
                txtPassword.Text = "hunter2";
                //ststrpLabel.Text = "Current account: " + username;
            }
        }
开发者ID:benediktkr,项目名称:lokun-client,代码行数:31,代码来源:Form1.cs

示例4: NetworkConnection

        /// <summary>
        /// Initializes a new instance of the <see cref="ProScanMobile.NetworkConnection"/> class.
        /// </summary>
        /// <description>
        /// Creates a new _tcpSocket and tries to connect to Host/Port 
        /// </description>
        /// <param name="host">Host</param>
        /// <param name="port">Port</param>
        public NetworkConnection(string host, int port)
        {
            _connectDone.Reset ();

            try
            {
                IPHostEntry ipHostInfo = Dns.GetHostEntry (host);
                IPAddress ipAddress = ipHostInfo.AddressList [0];
                IPEndPoint remoteEP = new IPEndPoint (ipAddress, port);

                _tcpSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                _tcpSocket.Blocking = true;

                var result = _tcpSocket.BeginConnect (remoteEP, null, null);

                bool success = result.AsyncWaitHandle.WaitOne (5000, true);
                if (success) {
                    _tcpSocket.EndConnect (result);
                    _connectionStatus = ConnectionStatus.Connected;
                    _connectionStatusMessage = "Connected.";
                } else {
                    _tcpSocket.Close ();
                    _connectionStatus = ConnectionStatus.Error;
                    _connectionStatusMessage = "Connection timed out.";
                }
            } catch {
                _connectionStatus = ConnectionStatus.Error;
                _connectionStatusMessage = string.Format("An error occured connecting to {0} on port {1}.", host, port);
                _connectDone.Set();
                return;
            } finally {
                _connectDone.Set ();
            }
        }
开发者ID:jeanfrancoisdrapeau,项目名称:ProScanAlert,代码行数:42,代码来源:NetworkConnection.cs

示例5: Update

        public void Update()
        {
            if (_connectStarted.Elapsed.TotalSeconds > 120)
            {
                if (_bot != null)
                    _bot.Disconnect();
                Status = ConnectionStatus.Disconnected;
            }

            if (Status != ConnectionStatus.Disconnected)
                return;

            _hasConnected = false;
            _connectStarted.Restart();
            Program.Logger.Info("Connecting");

            _bot = new SteamBot(Program.Settings.Username, Program.Settings.Password, Program.Settings.AuthCode);
            _bot.OnConnected += sender =>
            {
                _hasConnected = true;
                _connectStarted.Stop();

                _bot.DisplayName = Program.Settings.PersonaName;
                _bot.PersonaState = EPersonaState.Online;
                Status = ConnectionStatus.Connected;

                Program.Logger.Info("Connected");
            };

            _bot.OnDisconnected += (sender, reason) =>
            {
                if (reason == SteamBotDisconnectReason.SteamGuard)
                    Thread.Sleep(TimeSpan.FromMinutes(2)); // TODO: need a better way of entering steamguard auth

                if (_hasConnected)
                {
                    Program.Logger.InfoFormat("Disconnected {0}", reason);
                    _hasConnected = false;
                }

                Status = ConnectionStatus.Disconnected;
            };

            _bot.OnFriendRequest += (sender, user) => _bot.AddFriend(user.Id);

            _bot.OnPrivateEnter += (sender, chat) =>
            {
                chat.OnMessage += (chatSender, messageSender, message) =>
                    Command.Handle(new CommandTarget(chatSender, messageSender), message, "");
            };

            _bot.OnChatInvite += (sender, chat, @by) =>
            {
                if (chat.Id.IsIndividualAccount)
                    _bot.Join(chat.Id);
            };

            _bot.Connect();
            Status = ConnectionStatus.Connecting;
        }
开发者ID:killowatt,项目名称:RohBot,代码行数:60,代码来源:Steam.cs

示例6: btnCheckConnection_Click

 private async void btnCheckConnection_Click(object sender, EventArgs e)
 {
     lblCheckConnection.Text = "Checking...";
     lblCheckConnection.Refresh();
     connected = await lokun.FullyCheckConnectionStatusAsync();
     if (connected == ConnectionStatus.EverythingTunneled)
     {
         lblCheckConnection.Text = "Tunnel active";
     }
     else if (connected == ConnectionStatus.ConnectedWithoutDGW)
     {
         lblCheckConnection.Text = "Tunnel idle";
     }
     else if (connected == ConnectionStatus.RunningNotConnected)
     {
         lblCheckConnection.Text = "Tunnel not in use";
     }
     else if (connected == ConnectionStatus.OpenVPNNotInstalled)
     {
         lblCheckConnection.Text = "Error: OpenVPN missing";
     }
     else
     {
         lblCheckConnection.Text = "Tunnel down";
     }
     lblCheckConnection.Refresh();
 }
开发者ID:benediktkr,项目名称:lokun-client,代码行数:27,代码来源:Form1.cs

示例7: Connect

        public void Connect(HTransportOptions options)
        {
            this.connStatus = ConnectionStatus.CONNECTING;
            this.options = options;

            //TODO init the connection timeout value!!
            connTimeout = new TimeSpan(0, 0, 0, 0, options.Timeout);

            string endpointHost = options.EndpointHost;
            int endpointPort = options.EndpointPort;
            string endpointPath = options.EndpointPath;

            string endpointAdress = ToEndpointAdress(endpointHost, endpointPort, endpointPath);

            connTimeoutTimer = ThreadPoolTimer.CreateTimer(timeout_Elapsed, connTimeout);

            socketIO = new Client(endpointAdress);

            socketIO.Message += socketIO_Message;
            socketIO.SocketConnectionClosed += socketIO_SocketConnectionClosed;
            socketIO.Error += socketIO_Error;
            socketIO.On("connect", (message) =>
                {
                    if (this.options.AuthCb != null)
                        this.options.AuthCb(options.Login, Login);
                    else
                        Login(options.Login, options.Password);
                });
            socketIO.ConnectAsync();
        }
开发者ID:ThierryTournier,项目名称:hubiquitus4dotnet,代码行数:30,代码来源:HTransportSocketIO.cs

示例8: OnConnectionStatus_callback

 private void OnConnectionStatus_callback(object sender, ConnectionStatus status, ref RspUserLoginField userLogin, int size1)
 {
     if (null != OnConnectionStatus)
     {
         OnConnectionStatus(this, new OnConnectionStatusEventArgs(status, ref userLogin, size1));
     }
 }
开发者ID:Strongc,项目名称:xapi_python,代码行数:7,代码来源:XApiWrapper.cs

示例9: DisplayStatus

        public void DisplayStatus(ConnectionStatus status)
        {
            _notificator.Visibility = Visibility.Visible;
            _notificator.Source = new BitmapImage(new Uri("ms-appx:///Assets/"+status+".png"));

             _timer.Start();
        }
开发者ID:nghia2080,项目名称:CProject,代码行数:7,代码来源:Navigator.cs

示例10: NetworkStatus

 public NetworkStatus(ConnectionStatus connectionStatus, ConnectionProtocolType protocolType, TCPRole tcpRole, int clientCount, string classroomName)
 {
     this.ConnectionStatus = connectionStatus;
     this.ProtocolType = protocolType;
     this.TCPRole = tcpRole;
     this.ClientCount = clientCount;
     this.ClassroomName = classroomName;
 }
开发者ID:ClassroomPresenter,项目名称:CP3,代码行数:8,代码来源:NetworkStatus.cs

示例11: AbortedAuthentication

 protected internal AuthenticationResult AbortedAuthentication(string message, ConnectionStatus status = ConnectionStatus.Faulted)
 {
     return new AuthenticationResult
     {
         Status = status,
         Message = message,
     };
 }
开发者ID:bevacqua,项目名称:bruttissimo,代码行数:8,代码来源:AuthenticationPortal.cs

示例12: ServerInfo

 /// <summary>
 /// Public constructor for createing a Server object
 /// </summary>
 /// <param name="iSocket">Socket associated with Server object</param>
 /// <param name="iServerInfoIndex">Index number of the associated Server object</param>
 public ServerInfo(Socket iSocket, int iServerInfoIndex, ConnectionInfo iConnectionInfo, ConnectionMode iConnectionMode)
 {
     Socket = iSocket;
     Index = iServerInfoIndex;
     ConnectionInfo = iConnectionInfo;
     ConnectionMode = iConnectionMode;
     ConnectionStatus = ConnectionStatus.Pending;
     OnServerConnect();
 }
开发者ID:SpectralCoding,项目名称:boobox-client,代码行数:14,代码来源:ServerInfo.cs

示例13: Update

        public void Update()
        {
            if (_connectStarted.Elapsed.TotalSeconds > 120)
            {
                if (_bot != null)
                    _bot.Disconnect();
                Status = ConnectionStatus.Disconnected;
            }

            if (Status != ConnectionStatus.Disconnected)
                return;

            _hasConnected = false;
            _connectStarted.Restart();
            Program.Logger.Info("Connecting");

            _bot = new Bot(Program.Settings.Username, Program.Settings.Password);
            _bot.OnConnected += sender =>
            {
                _hasConnected = true;
                _connectStarted.Stop();

                _bot.PersonaName = Program.Settings.PersonaName;
                _bot.PersonaState = EPersonaState.Online;
                Status = ConnectionStatus.Connected;

                Program.Logger.Info("Connected");
            };

            _bot.OnDisconnected += (sender, reason) =>
            {
                if (_hasConnected)
                {
                    Program.Logger.Info("Disconnected");
                    _hasConnected = false;
                }

                Status = ConnectionStatus.Disconnected;
            };

            _bot.OnFriendRequest += (sender, user) => _bot.AddFriend(user.Id);

            _bot.OnPrivateEnter += (sender, chat) =>
            {
                chat.OnMessage += (chatSender, messageSender, message) =>
                    Command.Handle(new CommandTarget(chatSender, messageSender.Id), message, "");
            };

            _bot.OnChatInvite += (sender, chat, @by) =>
            {
                if (chat.Id.IsIndividualAccount)
                    _bot.Join(chat.Id);
            };

            _bot.Connect();
            Status = ConnectionStatus.Connecting;
        }
开发者ID:ToXIcGaming,项目名称:SteamMobile,代码行数:57,代码来源:Steam.cs

示例14: OnConnect_3

        //public fnOnRtnForQuoteRsp OnRtnForQuoteRsp
        //{
        //    set
        //    {
        //        OnRtnForQuoteRsp_1 = value;
        //        OnRtnForQuoteRsp_2 = OnRtnForQuoteRsp_3;
        //        MdApi.CTP_RegOnRtnForQuoteRsp(_MsgQueue.Queue, OnRtnForQuoteRsp_2);
        //    }
        //}

        //private void OnRtnForQuoteRsp_3(IntPtr pMdUserApi, ref CThostFtdcForQuoteRspField pForQuoteRsp)
        //{
        //    OnRtnForQuoteRsp_1(this, pMdUserApi, ref pForQuoteRsp);
        //}

        protected override void OnConnect_3(IntPtr pApi, ref CThostFtdcRspUserLoginField pRspUserLogin, ConnectionStatus result)
        {
            IsConnected = false;
            if (result == ConnectionStatus.Logined)
            {
                IsConnected = true;
            }
            OnConnect_1(this, pApi, ref pRspUserLogin, result);
        }
开发者ID:kandsy,项目名称:CTPZQ,代码行数:24,代码来源:MarketDataApi.cs

示例15: ClientStatusUpdate

 public void ClientStatusUpdate(ConnectionStatus cs, string msg)
 {
     if (cs == ConnectionStatus.Connected)
     {
         RunOnUiThread(() => Toast.MakeText(this, "Connected to Server", ToastLength.Short).Show());
     }
     else
     {
         RunOnUiThread(() => Toast.MakeText(this, "Could not connect to server", ToastLength.Short).Show());
     }
 }
开发者ID:josephkiran,项目名称:Projects,代码行数:11,代码来源:MainActivity.cs


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