• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConnectionStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnConnectionStatus2

 static void OnConnectionStatus2(object sender, ConnectionStatus status, ref RspUserLoginField userLogin, int size1)
 {
     if (size1 > 0)
     {
         Console.WriteLine("222222" + userLogin.ToFormattedStringLong());
     }
     else
     {
         Console.WriteLine("222222" + status);
     }
 }
开发者ID:ReinhardHsu,项目名称:XAPI2,代码行数:11,代码来源:Program.cs


示例17: Connection

        internal Connection(CapiApplication application, Controller controller,
            uint plci, string calledPartyNumber, string callingPartyNumber) {

            _dtfmDuration = 40;
            _dtfmPause = 40;
            _application = application;
            _controller = controller;
            _plci = plci;
            _calledPartyNumber = calledPartyNumber;
            _callingPartyNumber = callingPartyNumber;
            _status = ConnectionStatus.Disconnected;
        }
开发者ID:modulexcite,项目名称:capi.net,代码行数:12,代码来源:Connection.cs


示例18: HttpResponse

        public HttpResponse(ConnectionStatus status, String Connection, String filePath)
        {
            cookies = new Dictionary<String, String>();
            headers = new Dictionary<String, String>();
            this.status = status;
            this.filePath = filePath;

            //headers.Add("Allow", "GET");
            headers.Add("Date", DateTime.Now.ToString("r"));
            headers.Add("Server", "MyMobiControllerServer");
            headers.Add("Connection", Connection);
        }
开发者ID:tyandjel94,项目名称:RowanParkingPassApp,代码行数:12,代码来源:HttpResponse.cs


示例19: Start

 public void Start(Socket socket)
 {
     lock (lockObject)
     {
         TcpSocket = socket;
         _tcpOffset = 0;
         Status = ConnectionStatus.Connected;
         _messageInQueue = new BlockingCollection<IMessage>();
         _messageOutQueue = new BlockingCollection<IMessage>();
         BeginReading();
         BeginSending();
     }
 }
开发者ID:628426,项目名称:Strive.NET,代码行数:13,代码来源:Connection.cs


示例20: Close

 public void Close()
 {
     Debug.Assert(Status == ConnectionStatus.Opend, "Connection.Close: Status must be Opened.");
     if (Status == ConnectionStatus.Opend)
     {
         try
         {
             while (_transactions.Count > 0)
                 _transactions[0].Dispose();
             Status = ConnectionStatus.Closed;
         }
         catch { }
     }
 }
开发者ID:burstinair,项目名称:burst.net,代码行数:14,代码来源:Connection.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConnectionString类代码示例发布时间:2022-05-24
下一篇:
C# ConnectionState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap