Esempio n. 1
0
        public void Tick()
        {
            // 连接事件
            if (m_ConnectEvent != null)
            {
                var isSucceed = m_ConnectEvent.isSucceed;
                onConnect.Invoke(isSucceed);
                m_ConnectEvent = null;
            }

            // 接收事件
            ByteArray data = m_ReadBuffer.GetData();

            while (data != null)
            {
                onReceive.Invoke(data.ToBytes());
                data = m_ReadBuffer.GetData();
            }

            // 远程强制关闭事件
            if (m_ForceCloseEvent != null)
            {
                onForceClose.Invoke();
                m_ForceCloseEvent = null;
            }
        }
        public void onConnectDone(ConnectEvent eventObj)
        {
            switch (eventObj.getResult())
            {
                case WarpResponseResultCode.SUCCESS:
                    Debug.WriteLine("\nConnection Success\n");
                     GlobalContext.IsConnectedToAppWarp = true;
                     _recoverCounts = 0;
                     Deployment.Current.Dispatcher.BeginInvoke(delegate()
                     {
                         if (GlobalContext.tableProperties["IsPrivateRoom"].Equals("false"))
                             WarpClient.GetInstance().JoinRoomWithProperties(GlobalContext.tableProperties);
                     });
                      break;
                case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
                     Deployment.Current.Dispatcher.BeginInvoke(delegate(){RecoverConnection();});
                      break;
                case WarpResponseResultCode.SUCCESS_RECOVERED:
                     break;
                default:
                     if(App.CurrentPage.Equals("HomePage"))
                      Deployment.Current.Dispatcher.BeginInvoke(delegate() { App.g_HomePageListener.ConnectionFailed(); });
                      GlobalContext.IsConnectedToAppWarp = false;
                      break;

            }
        }
Esempio n. 3
0
        // отображаем данные записи
        private void SetAll()
        {
            Size = new Size(760, 50);

            Status = new Panel() { Parent = this, Location = new Point(0, 0), Size = new Size(30, 50), BackColor = Color.IndianRed };
            RoomName = new Label() { Parent = this, Location = new Point(40, 10), Size = new Size(300, 30), Font = new Font(Font.FontFamily, 18), Text = Source.Name };
            PlayersCount = new Label() { Parent = this, Location = new Point(450, 10), Size = new Size(100, 30), Font = new Font(Font.FontFamily, 18), Text = Source.Players.Count + "/" + Source.MaxCount };
            Watch = new Button() { Parent = this, Location = new Point(550, 0), Size = new Size(100, 50), Font = new Font(Font.FontFamily, 9), Text = "Наблюдать" };
            Connect = new Button() { Parent = this, Location = new Point(660, 0), Size = new Size(100, 50), Font = new Font(Font.FontFamily, 9), Text = "Подключиться" };

            SetStatusColor(Source.Status);

            // вызываем собтие, если пользователь нажал на кнопку "Подключиться"
            Connect.Click += (object sender, EventArgs e) => {
                ConnectEvent?.Invoke(this);
            };

            // вызываем собтие, если пользователь нажал на кнопку "Наблюдать"
            Watch.Click += (object sender, EventArgs e) => {
                WatchEvent?.Invoke(this);
            };

            // если статус сервера изменился - обновляем данные
            Source.ChangeRoomStatusEvent += (status) => {
                SetStatusColor(status);
            };
        }
Esempio n. 4
0
    private void UpdateConnectionStatus(ConnectEvent connectEvent)
    {
        if (connectEvent.IsSuccess)
        {
            connectionStatusText.text = TranslationManager.GetTranslation(R.Messages.companionApp_connectedTo, "remote", connectEvent.ServerIpEndPoint.Address);
            onlyVisibleWhenConnected.ForEach(it => it.ShowByDisplay());
            onlyVisibleWhenNotConnected.ForEach(it => it.HideByDisplay());
            audioWaveForm.SetVisibleByDisplay(settings.ShowAudioWaveForm);
            connectionThroubleshootingText.HideByDisplay();
            serverErrorResponseText.HideByDisplay();
            toggleRecordingButton.Focus();
            connectionInfoText.text = $"Connected to {connectEvent.ServerIpEndPoint.Address}:{connectEvent.ServerIpEndPoint.Port}";
        }
        else
        {
            connectionInfoText.text   = "Not connected";
            connectionStatusText.text = connectEvent.ConnectRequestCount > 0
                ? TranslationManager.GetTranslation(R.Messages.companionApp_connectingWithFailedAttempts, "count", connectEvent.ConnectRequestCount)
                : TranslationManager.GetTranslation(R.Messages.companionApp_connecting);

            onlyVisibleWhenConnected.ForEach(it => it.HideByDisplay());
            onlyVisibleWhenNotConnected.ForEach(it => it.ShowByDisplay());
            if (connectEvent.ConnectRequestCount > ConnectRequestCountShowTroubleshootingHintThreshold)
            {
                connectionThroubleshootingText.ShowByDisplay();
                connectionThroubleshootingText.text = TranslationManager.GetTranslation(R.Messages.companionApp_troubleShootingHints);
            }

            if (!connectEvent.ErrorMessage.IsNullOrEmpty())
            {
                serverErrorResponseText.ShowByDisplay();
                serverErrorResponseText.text = connectEvent.ErrorMessage;
            }
        }
    }
Esempio n. 5
0
    //ConnectionRequestListener
    public void onConnectDone(ConnectEvent eventObj)
    {
        DebugLog.Log("onConnectDone >> " + eventObj.getResult());

        if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
        {
            isConnected = true;
//			Debug.Log ("=======================>> " + WarpClient.GetInstance ().in);
            FirePlayerConnected(true);
        }
        else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE)
        {
            UIManager.Instance.DisplayReconnectingPanel();
            StopCoroutine("TryToReconnect");
            StartCoroutine("TryToReconnect");
        }
        else if (eventObj.getResult() == WarpResponseResultCode.SUCCESS_RECOVERED)
        {
            StopCoroutine("TryToReconnect");
            UIManager.Instance.HideReconnectingPanel();
        }
        else
        {
            StopCoroutine("TryToReconnect");
            isConnected = false;
            UIManager.Instance.HideReconnectingPanel();
            FirePlayerConnected(false);
        }
    }
Esempio n. 6
0
        //ConnectionRequestListener
        public void onConnectDone(ConnectEvent eventObj)
        {
            Debug.Log("onConnectDone >> " + eventObj.getResult());
            DEBUG.Log("ConnectDone >> " + eventObj.getResult());
            //DEBUG.Log ("onConnectDone "+eventObj.getResult());
//			GameObject camera = GameObject.FindGameObjectWithTag ("LoginPanel");

            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                loginScript.onConnectedSuccessfully();
                m_apppwarp.isConnected = true;
            }
            else if (eventObj.getResult() == WarpResponseResultCode.SUCCESS_RECOVERED)
            {
                Debug.Log("onConnectDone >>  Recovered Done" + eventObj.getResult());
            }
            else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE)
            {
                Debug.Log("onConnectDone >> Connection Recoverable" + eventObj.getResult());
                StartCoroutine(ReconnectToServer());
            }
            else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERR)
            {
                loginScript.onConnectedFail("" + eventObj.getResult());
                m_apppwarp.isConnected = false;
            }
        }
Esempio n. 7
0
 private void Callback_OnConnect(IAsyncResult result)
 {
     try
     {
         bool isReconnect = false;
         if (null != _socket)
         {
             isReconnect = true;
         }
         _socket = (Socket)result.AsyncState;
         _socket.EndConnect(result);
         _socket.ReceiveBufferSize = Gamnet.Buffer.BUFFER_SIZE;
         _socket.SendBufferSize    = Gamnet.Buffer.BUFFER_SIZE;
         if (true == isReconnect)
         {
             ReconnectEvent evt = new ReconnectEvent();
             evt.session = this;
             eventQueue.Enqueue(evt);
         }
         else
         {
             ConnectEvent evt = new ConnectEvent();
             evt.session = this;
             eventQueue.Enqueue(evt);
         }
         Receive();
     }
     catch (System.Exception error)
     {
         Error(error);
         Close();
     }
 }
 public void Connect()
 {
     try
     {
         var vw = (Window)this.GetView();
         vw.Visibility = Visibility.Hidden;
         using (var c = new ADOTabularConnection(ConnectionString, AdomdType.AnalysisServices))
         {
             c.Open();
         }
         if (ServerModeSelected)
         {
             RegistryHelper.SaveServerMRUListToRegistry(DataSource, RecentServers);
         }
         var connEvent = new ConnectEvent(ConnectionString, PowerPivotModeSelected, WorkbookName, GetApplicationName(ConnectionType), "");
         if (PowerBIModeSelected)
         {
             connEvent.PowerBIFileName = SelectedPowerBIInstance.Name;
         }
         _eventAggregator.PublishOnUIThread(connEvent);
     }
     catch (Exception ex)
     {
         Log.Error("{class} {method} Error Connecting using: {connStr}", "ConnectionDialogViewModel", "Connect", ConnectionString);
         _activeDocument.OutputError(String.Format("Could not connect to '{0}': {1}", PowerPivotModeSelected?"Power Pivot model":DataSource, ex.Message));
         _eventAggregator.PublishOnUIThread(new CancelConnectEvent());
     }
     finally
     {
         _eventAggregator.Unsubscribe(this);
         SelectedServerSetFocus = false;
         TryClose(true);
     }
 }
 public void OnConnect(ConnectEvent ce)
 {
     if (!plugin.IsInitialized() && ce.Connection.IpAddress.Equals("localClient"))
     {
         plugin.Initialize();
     }
 }
Esempio n. 10
0
        private void MqttClient_Disconnected(object sender, MqttClientDisconnectedEventArgs e)
        {
            ConnectEvent?.Invoke(false, e.Exception);
            if (e.Exception.InnerException is SocketException error)
            {
                switch (error.SocketErrorCode)
                {
                case SocketError.HostUnreachable:
                case SocketError.ConnectionAborted:
                case SocketError.NetworkUnreachable:
                case SocketError.ConnectionRefused:
                    Thread.Sleep(3000);
                    break;

                default:
                    Thread.Sleep(1000);
                    break;
                }
            }
            else
            {
                Thread.Sleep(125);
            }
            if (e.Exception is MqttConnectingFailedException code && code.ReturnCode == MqttConnectReturnCode.ConnectionRefusedBadUsernameOrPassword)
            {
                this.userId = 0;
            }
Esempio n. 11
0
        private void MqttClient_Connected(object sender, MqttClientConnectedEventArgs e)
        {
            var topics = TopicEvent?.Invoke();

            SubscribeAsync(topics);
            ConnectEvent?.Invoke(true, null);
        }
Esempio n. 12
0
        public static void Update()
        {
            if (IsState(ConnectEvent.DownloadWaiting))
            {
                if (null == startTime)
                {
                    SetState(ConnectEvent.ErrorEnding);
                }

                TimeSpan ts = System.DateTime.Now - startTime;
                if (ts.Seconds > DefaultTimeout)
                {
                    DoOnTimeout(myHttpWebRequest, true);
                }
            }

            if (IsState(ConnectEvent.Finish))
            {
                myRequestState.response.Close();
                cntEvent = ConnectEvent.Idel;

                // 下载到东西后以回调方式通知
                if (myRequestState.RawData.Count != 0 && null != icb)
                {
                    icb.OnDownloadComplete(state);
                }
            }

            if (IsState(ConnectEvent.ErrorEnding) ||
                IsState(ConnectEvent.TimeOut))
            {
                SetState(ConnectEvent.Idel);
            }
        }
Esempio n. 13
0
		public void onConnectDone(ConnectEvent eventObj) {
			Log("connecting server result: " + (eventObj.getResult()== 0) + "(" + eventObj.getResult() + ")");

			if (eventObj.getResult() == 0) {
				WarpClient.GetInstance().SubscribeRoom(roomid);
			}
		}
Esempio n. 14
0
        private void Client_ConnectFinished(IPEndPoint sender, SocketAsyncEventArgs e)
        {
            if (e.SocketError == SocketError.Success)
            {
                ConnectEvent?.Invoke(true);
            }
            else
            {
                ConnectEvent?.Invoke(false);
                switch (e.SocketError)
                {
                case SocketError.HostUnreachable:
                case SocketError.ConnectionAborted:
                case SocketError.NetworkUnreachable:
                case SocketError.ConnectionRefused:
                    Thread.Sleep(3000);
                    break;

                default:
                    Thread.Sleep(1000);
                    break;
                }
                Connect();
            }
        }
Esempio n. 15
0
        public void onConnectDone(ConnectEvent eventObj)
        {
            switch (eventObj.getResult())
            {
            case WarpResponseResultCode.SUCCESS:
                Debug.WriteLine("\nConnection Success\n");
                GlobalContext.IsConnectedToAppWarp = true;
                _recoverCounts = 0;
                Deployment.Current.Dispatcher.BeginInvoke(delegate()
                {
                    if (GlobalContext.tableProperties["IsPrivateRoom"].Equals("false"))
                    {
                        WarpClient.GetInstance().JoinRoomWithProperties(GlobalContext.tableProperties);
                    }
                });
                break;

            case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
                Deployment.Current.Dispatcher.BeginInvoke(delegate(){ RecoverConnection(); });
                break;

            case WarpResponseResultCode.SUCCESS_RECOVERED:
                break;

            default:
                if (App.CurrentPage.Equals("HomePage"))
                {
                    Deployment.Current.Dispatcher.BeginInvoke(delegate() { App.g_HomePageListener.ConnectionFailed(); });
                }
                GlobalContext.IsConnectedToAppWarp = false;
                break;
            }
        }
Esempio n. 16
0
            public void onConnectDone(ConnectEvent eventObj)
            {
                Debug.WriteLine("onConnectDone");

                if (eventObj.getResult() == 0)
                {
                    string preGameUpdate = "{\"" + EVENT_TYPE + "\":" + PRE_GAME + ",\"" + PHASE + "\":" + FINDING_ROOM_TO_JOIN + "}";

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page.m_d3dInterop.onChatReceived(preGameUpdate);

                        WarpClient.GetInstance().JoinRoomInRange(0, 7, true);
                    });
                }
                else if (eventObj.getResult() == 2)
                {
                    string preGameUpdate = "{\"" + EVENT_TYPE + "\":" + PRE_GAME + ",\"" + PHASE + "\":" + BATTLE_BOMBS_BETA_CLOSED + "}";

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page.m_d3dInterop.onChatReceived(preGameUpdate);
                    });
                }
                else
                {
                    string preGameUpdate = "{\"" + EVENT_TYPE + "\":" + PRE_GAME + ",\"" + PHASE + "\":" + CONNECTION_ERROR + "}";

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page.m_d3dInterop.onChatReceived(preGameUpdate);
                    });
                }
            }
Esempio n. 17
0
 public void onConnectDone(ConnectEvent eventObj)
 {
     Debug.Log ("onConnectDone : " + eventObj.getResult());
     if (eventObj.getResult () == WarpResponseResultCode.SUCCESS) {
     //			WarpClient.GetInstance ().CreateRoom ("Testwww", "Himawwnshu", 5, null);
         appWarpResponse += "onConnected Successfully " + eventObj.getResult ()+"\n";
     } else if (eventObj.getResult () == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE) {
         //			WarpClient.GetInstance ().CreateRoom ("Testwww", "Himawwnshu", 5, null);
         theClient.RecoverConnection();
         appWarpResponse += "Coonection error Recoverable " + eventObj.getResult ()+"\n";
     } else if (eventObj.getResult () == WarpResponseResultCode.SUCCESS_RECOVERED) {
         //			WarpClient.GetInstance ().CreateRoom ("Testwww", "Himawwnshu", 5, null);
         appWarpResponse += "Coonection Recoverd "+ "\n";
     }
     else if (eventObj.getResult () == WarpResponseResultCode.AUTH_ERROR) {
         //			WarpClient.GetInstance ().CreateRoom ("Testwww", "Himawwnshu", 5, null);
         appWarpResponse += "Authentication Error" +"\n";
     }
     else
     {
         appWarpResponse+="onConnectDone Error "+eventObj.getResult()+"\n";
     }
     //JoinRoom ();
     //Log ("onConnectDone : " + eventObj.getResult());
 }
    private void UpdateConnectionStatus(ConnectEvent connectEvent)
    {
        if (connectEvent.IsSuccess)
        {
            connectionStatusText.text = TranslationManager.GetTranslation(R.Messages.connectedTo, "remote", connectEvent.ServerIpEndPoint.Address);
            uiDoc.rootVisualElement.Query(null, "onlyVisibleWhenConnected").ForEach(it => it.Show());
            audioWaveForm.SetVisible(settings.ShowAudioWaveForm);
            connectionThroubleshootingText.Hide();
            serverErrorResponseText.Hide();
            toggleRecordingButton.Focus();
            UpdateRecordingDeviceButtons();
        }
        else
        {
            connectionStatusText.text = connectEvent.ConnectRequestCount > 0
                ? TranslationManager.GetTranslation(R.Messages.connectingWithFailedAttempts, "count", connectEvent.ConnectRequestCount)
                : TranslationManager.GetTranslation(R.Messages.connecting);

            uiDoc.rootVisualElement.Query(null, "onlyVisibleWhenConnected").ForEach(it => it.Hide());
            if (connectEvent.ConnectRequestCount > ConnectRequestCountShowTroubleshootingHintThreshold)
            {
                connectionThroubleshootingText.Show();
                connectionThroubleshootingText.text = TranslationManager.GetTranslation(R.Messages.troubleShootingHints);
            }

            if (!connectEvent.ErrorMessage.IsNullOrEmpty())
            {
                serverErrorResponseText.Show();
                serverErrorResponseText.text = connectEvent.ErrorMessage;
            }
        }
    }
Esempio n. 19
0
        private void OnConnectCallback(IAsyncResult ar)
        {
            Socket sock = (Socket)ar.AsyncState;
            if (sock == null) return;

            IPEndPoint ep = null;
            try
            {
                sock.EndConnect(ar);
                ep = sock.RemoteEndPoint as IPEndPoint;

                _TCP = new ATCPConnector(sock, Uid64.CreateNewSync().Data, NetHelper.READ_BUFFER_BIG);
                _TCP.DisconnectEvent += OnDisconnectEventHandler;
                _TCP.ReceiveAction += OnReceveDataHandler;
                _TCP.ReceiveComAction += OnReceiveCommandHandler;
            }
            catch (SocketException ex){
                sock.Close();
                sock = null;
                NetLogger.Log(ex);
                return;
            }

            _isActive = true;
            if (ep != null) { NetLogger.Log("Connected to " + sock.RemoteEndPoint); }
            ConnectEvent?.Invoke(this, _TCP);
        }
Esempio n. 20
0
 public void OnConnect(ConnectEvent ev)
 {
     /// <summary>
     ///  This is the event handler for connection events, before players have been created, so names and what not are available. See PlayerJoin if you need that information
     /// </summary>
     plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onconnect"), plugin.MultiLanguage(12));
 }
Esempio n. 21
0
 /*
  * public void RecoverConnection()
  * {
  *  if (_recoverCounts == 0)
  *  {
  *      timer = new DispatcherTimer();
  *      timer.Tick += timer_Tick;
  *      timer.Interval = new TimeSpan(0, 0, 0, 10);
  *      timer.Start();
  *  }
  *
  * }
  * public void ConnectionRecovered()
  * {
  *  timer.Stop();
  *  _recoverCounts = 0;
  * }
  * private void timer_Tick(object sender, EventArgs e)
  * {
  *  _recoverCounts++;
  *  if (_recoverCounts <= 6)
  *  {
  *      WarpClient.GetInstance().RecoverConnection();
  *  }
  *  else
  *  {
  *      (sender as DispatcherTimer).Stop();
  *      _page.showResult("connection failed");
  *  }
  * }*/
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     Debug.WriteLine("Disconnect Done: " + eventObj.getResult());
     UIDispatcher.Execute(delegate()
     {
         try
         {
             if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
             {
                 if (tblmessage.Text.Length > 200)
                 {
                     tblmessage.Text = "";
                 }
                 tblmessage.Text = tblmessage.Text + "\ndisconnect done success";
                 //Task.Delay(1000);
                 WarpClient.GetInstance().Connect("kanak");
             }
             else
             {
                 tblmessage.Text = tblmessage.Text + "\ndisconnect done failed";
             }
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex.StackTrace);
         }
     });
 }
Esempio n. 22
0
        private void CycleMeasureCurrent(CancellationToken cancellationToken)
        {
            transport = new Transport(ip, Port);
            transport.Connect();
            commands = new SDM_Commands(transport);


            commands.SetCurrentRange(CurrentType, Range, Units);
            // commands.SetSamples(1);
            // commands.SetIntegration(10);
            // commands.CurrentFiltrOff();

            commands.InitCommand();

            StateConnect = true;
            ConnectEvent?.Invoke(this, new EventArgs());
            while (!cancellationToken.IsCancellationRequested)
            {
                // for(int i = 0; i < 4; i++)
                Current   = commands.ReadMeasValue(5) * multipler;
                Timestamp = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                UpdMeasureResult?.Invoke(this, new EventArgs());
                Thread.Sleep(300);
                //commands.InitCommand();
            }
        }
Esempio n. 23
0
        private void Client_ClientEvent(ServiceEventArgs e)
        {
            try
            {
                if (e.Type == ServiceType.DisConnect)
                {
                    ConnectEvent?.Invoke(false);
                    switch (e.SocketError)
                    {
                    case SocketError.NotConnected:
                        Thread.Sleep(1000);
                        break;

                    default:
                        Thread.Sleep(125);
                        break;
                    }
                    Connect();
                }
            }
            catch (Exception ex)
            {
                ex.Log();
            }
        }
Esempio n. 24
0
    public static void HandleConnectEvent(ConnectEvent cEvent)
    {
        int newMapId = cEvent.MapId;

        if (newMapId == currentMapId) //현재 맵에 새로운 유저 접속 시
        {
            int newPlayerNum = cEvent.ConnectInfos[0].PlayerNum;
            if (playerList.ContainsKey(newPlayerNum))
            {
                return;
            }

            GameObject player = Instantiate(Resources.Load("Prefabs/Player")) as GameObject;
            player.GetComponent <PlayerInfo>().playerNum = newPlayerNum;
            playerList.Add(newPlayerNum, player.GetComponent <PlayerInfo>());
        }
        else // 신규 맵에 접속 시
        {
            connectEvent = cEvent;
            currentMapId = newMapId;
            SceneManager.LoadScene(1);
        }
        //foreach (ConnectInfo f in cEvent.ConnectInfos)
        //{
        //    if (playerList.ContainsKey(f.PlayerNum)) break;
        //    GameObject player = Instantiate(Resources.Load("Prefabs/Player")) as GameObject;
        //    playerList.Add(f.PlayerNum, player.GetComponent<PlayerInfo>());
        //}
    }
Esempio n. 25
0
 public void onConnectDone(ConnectEvent eventObj)
 {
     Log("onConnectDone : ", eventObj.getResult());
     if (connectionStatusEvent != null)
     {
         connectionStatusEvent((ResultCode)eventObj.getResult());
     }
 }
Esempio n. 26
0
 public void onDisconnectDone(ConnectEvent evt)
 {
     if (evt.getResult () == WarpResponseResultCode.SUCCESS) {
         Console.WriteLine ("Disconnect Successful");
     } else {
         Console.WriteLine ("Disconnect Failed");
     }
 }
Esempio n. 27
0
 public void onConnectDone(ConnectEvent eventObj)
 {
     Log ("onConnectDone : " + eventObj.getResult());
     if(eventObj.getResult() == 0)
     {
         WarpClient.GetInstance().SubscribeRoom(appwarp.roomid);
     }
 }
Esempio n. 28
0
 //ConnectionRequestListener
 #region ConnectionRequestListener
 public void onConnectDone(ConnectEvent eventObj)
 {
     Log("onConnectDone : " + eventObj.getResult());
     if (eventObj.getResult() == 0)
     {
         WarpClient.GetInstance().SubscribeRoom(appwarp.roomid);
     }
 }
 public void onConnectDone(ConnectEvent eventObj)
 {
     status = "onConnectDone.."+eventObj.getResult ();
     if (eventObj.getResult () == WarpResponseResultCode.SUCCESS) {
         WarpClient.GetInstance ().initUDP ();
         WarpClient.GetInstance ().JoinRoomInRange (1, 1, true);
     }
 }
Esempio n. 30
0
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     appwarp.socketConnected = false;
     Debug.Log("disconnect " + eventObj.getResult());
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
     }
 }
Esempio n. 31
0
        public void Connect()
        {
            try
            {
                string serverType      = null;
                string powerBIFileName = "";
                var    vw = (Window)this.GetView();
                vw.Visibility = Visibility.Hidden;
                //using (var c = new ADOTabularConnection(ConnectionString, AdomdType.AnalysisServices))
                //{
                //    c.Open();
                //}

                if (ServerModeSelected)
                {
                    SettingProvider.SaveServerMRUList(DataSource, RecentServers);
                    serverType = "SSAS";
                }
                if (PowerPivotModeSelected)
                {
                    serverType = "PowerPivot";
                }
                if (PowerBIModeSelected)
                {
                    powerBIFileName = SelectedPowerBIInstance.Name;
                    switch (SelectedPowerBIInstance.Icon)
                    {
                    case EmbeddedSSASIcon.Devenv:
                        serverType = "SSDT";
                        break;

                    case EmbeddedSSASIcon.PowerBI:
                        serverType = "PBI Desktop";
                        break;

                    case EmbeddedSSASIcon.PowerBIReportServer:
                        serverType = "PBI Report Server";
                        break;
                    }
                }
                var connEvent = new ConnectEvent(ConnectionString, PowerPivotModeSelected, WorkbookName, GetApplicationName(ConnectionType), powerBIFileName, serverType);
                Log.Debug("{Class} {Method} {@ConnectEvent}", "ConnectionDialogViewModel", "Connect", connEvent);
                _eventAggregator.PublishOnUIThread(connEvent);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "{class} {method} Error Connecting using: {connStr}", "ConnectionDialogViewModel", "Connect", ConnectionString);
                _activeDocument.OutputError(String.Format("Could not connect to '{0}': {1}", PowerPivotModeSelected?"Power Pivot model":DataSource, ex.Message));
                _eventAggregator.PublishOnUIThread(new CancelConnectEvent());
            }
            finally
            {
                _eventAggregator.Unsubscribe(this);
                SelectedServerSetFocus = false;
                this.TryClose();
                //    TryClose(true);
            }
        }
Esempio n. 32
0
 public Client()
 {
     Port = 5403;
     //Ip = "176.228.52.160";
     Ip         = "127.0.0.1";
     Status     = "offline";
     connect    = ConnectFunc;
     disconnect = DisconnectFunc;
 }
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     Deployment.Current.Dispatcher.BeginInvoke(delegate()
     {
         GlobalContext.IsConnectedToAppWarp = false;
         if (App.CurrentPage.Equals("HomePage"))
             App.g_HomePageListener.DisconnectCallback();
     });
 }
        /// <summary>
        ///  This is the event handler for connection events, before players have been created, so names and what not are available. See PlayerJoin if you need that information
        /// </summary>
        public void OnConnect(ConnectEvent ev)
        {
            Dictionary <string, string> variables = new Dictionary <string, string>
            {
                { "ipaddress", ev.Connection.IpAddress }
            };

            this.plugin.SendMessage(Config.GetArray("channels.onconnect"), "round.onconnect", variables);
        }
 public void onConnectDone(ConnectEvent eventObj)
 {
     Console.WriteLine("onConnectDone as " + eventObj.getResult());
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Console.WriteLine("Joining Room " + Constants.CHAT_ROOM_ID);
         WarpClient.GetInstance().JoinRoom(Constants.CHAT_ROOM_ID);
     }
 }
Esempio n. 36
0
 public void onConnectDone(ConnectEvent evt)
 {
     if (evt.getResult () == WarpResponseResultCode.SUCCESS) {
         Console.WriteLine ("Connection Successful");
         WarpClient.GetInstance().JoinRoom(Constants.CHAT_ROOM_ID);
     } else {
         Console.WriteLine ("Connection Failed");
     }
 }
Esempio n. 37
0
        private static void SetState(ConnectEvent errcode)
        {
            cntEvent = errcode;

            if (errcode == ConnectEvent.DownloadWaiting)
            {
                startTime = System.DateTime.Now;
            }
        }
Esempio n. 38
0
 public void onConnectDone(ConnectEvent eventObj)
 {
     Console.WriteLine("onConnectDone as "+eventObj.getResult());
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Console.WriteLine("Joining Room "+Constants.CHAT_ROOM_ID);
         WarpClient.GetInstance().JoinRoom(Constants.CHAT_ROOM_ID);
     }
 }
 public void onConnectDone(ConnectEvent eventObj)
 {
     status = "onConnectDone.." + eventObj.getResult();
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         WarpClient.GetInstance().initUDP();
         WarpClient.GetInstance().JoinRoomInRange(1, 1, true);
     }
 }
        public void onConnectDone(ConnectEvent eventObj)
        {
            // instead of all the else statements
            Global.connectSuccess = false;
            /*-----------------------     SUCCESS IN CONNECTING     -----------------------*/
            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                Global.connectSuccess = true;
                attempts = 0;
                System.Diagnostics.Debug.WriteLine("conn successful");
                _page.timeout = 0;  
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Connection Successful :)");
                });
                Global.warpClient.JoinRoomWithProperties(new Dictionary<string, object>() { { "category", Global.itemName[(int)settings["trigger"]] }, { "availUsers", 1 } });
                System.Diagnostics.Debug.WriteLine("trying to join room");
            }
            /*-----------------------     RECOVERABLE CONNECTION ERROR     -----------------------*/
            else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE)
            {
                Global.warpClient.RecoverConnection();

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("recoverable connection error");

                });
                System.Diagnostics.Debug.WriteLine("fail scenes");
            }
            /*-----------------------     RECOVERY SUCCESS     -----------------------*/
            else if (eventObj.getResult() == WarpResponseResultCode.SUCCESS_RECOVERED)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("connection error recovered");

                });
                System.Diagnostics.Debug.WriteLine("fail scenes");
            }
            /*-----------------------     CONNECTION FAILED      -----------------------*/
            else if(eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERR)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("connection error");

                });
                System.Diagnostics.Debug.WriteLine("fail scenes");
                if(attempts<2)
                {
                    Global.warpClient.Connect(Global.localUsername);
                }
                attempts++;
                
            }
        }
        //ConnectionRequestListener
        public void onConnectDone(ConnectEvent eventObj)
        {
            if(eventObj.getResult() == 0)
            {
                //WarpClient.GetInstance().SubscribeRoom(m_apppwarp.roomid);
            }
            Log ("onConnectDone : " + eventObj.getResult());

            //gameObject.name = appwarp.username;
            //WarpClient.GetInstance().initUDP();
        }
Esempio n. 42
0
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     if(eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         Debug.Log("Disconnect Successful");
     }
     else {
         Debug.Log("Disconnect Failed");
     }
     Log("onDisconnectDone : " + eventObj.getResult());
 }
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         _page.showResult("disconnection success");
     }
     else
     {
         _page.showResult("diconnection failed");
     }
 }
 public void onConnectToAppWarp(ConnectEvent eventObj)
 {
     Debug.Log("onConnectToAppWarp " + eventObj.getResult());
     if (eventObj.getResult () == 0){
         isUserConnected = true;
         SC_AppWarpKit.GetRoomsInRange(1,2);
     }
     else {
         isUserConnected = false;
     }
 }
 public void onConnectDone(ConnectEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         // Successfully connected to the server. We can go ahead and join our app's zone.
         WarpClient.GetInstance().JoinZone(GlobalContext.localUsername);
     }
     else
     {
         _page.showResult("connection failed");
     }
 }
 public void onJoinZoneDone(ConnectEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         // We have successfully joined the zone. Lets go ahead and join the room.
         WarpClient.GetInstance().JoinRoom(GlobalContext.GameRoomId);
     }
     else
     {
         _page.showResult("Join zone failed");
     }
 }
 public void onConnectDone(ConnectEvent eventObj)
 {
     if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         // Successfully connected to the server. Lets go ahead and join the room.
         WarpClient.GetInstance().JoinRoom(GlobalContext.GameRoomId);
     }
     else
     {
         _page.showResult("connection failed");
     }
 }
Esempio n. 48
0
    public void onConnectToAppWarp(ConnectEvent eventObj)
    {
        if (eventObj.getResult() == 0)
        {
            Debug.Log("onConnectToAppWarp " + eventObj.getResult());
            ConnStater.Set__connection_status(true);

            myPlayerBoard_Ready = true;

            SC_AppWarpKit.GetRoomsInRange(1, 1);
        }
    }
Esempio n. 49
0
 public void onConnectDone(ConnectEvent eventObj)
 {
     if(eventObj.getResult() == WarpResponseResultCode.SUCCESS)
     {
         WarpClient.GetInstance().JoinRoom(AppWarp.roomid);
         Debug.Log("Connection Successful");
     }
     else {
         Debug.Log("Connection Failed");
     }
     Debug.Log ("onConnectDone : " + eventObj.getResult());
     Log ("onConnectDone : " + eventObj.getResult());
 }
 public void onConnectToAppWarp(ConnectEvent eventObj)
 {
     Debug.Log("onConnectToAppWarp " + eventObj.getResult());
     if (eventObj.getResult() == 0)
     {
         unityUIObjects["LoadingText"].GetComponent<Text>().text = "Finding a room...";
         isUserConnected = true;
         SC_AppWarpKit.GetRoomsInRange(1, 2);
     }
     else
     {
         isUserConnected = false;
     }
 }
Esempio n. 51
0
        public void onConnectDone(ConnectEvent eventObj)
        {
            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                _page.showResult("connection success");

                //перенаправлення на сторінку
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    _page.NavigationService.Navigate(new Uri("/Views/RoomsListPage.xaml", UriKind.Relative));
                });
                
            }
            else
            {
                _page.showResult("connection fail");
            }

        }
        public void onDisconnectDone(ConnectEvent eventObj)
        {
            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                Global.disconnectSuccess = true;

                System.Diagnostics.Debug.WriteLine("successfully disconnected");
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Disconnect Done :)");

                });
               // _page.showresult("disconnection success");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("not successfully disconnected");
                //Global.disconnectSuccess = true;
               // _page.showresult("diconnection failed");
            }
        }
        public void onConnectDone(ConnectEvent eventObj)
        {
            UIDispatcher.Execute(delegate() { tblmessage.Text = "Connect Done: " + eventObj.getResult(); });
            switch (eventObj.getResult())
            {
                case WarpResponseResultCode.SUCCESS:
                    // _page.showResult("connection success");
                    break;
                case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
                    // _page.showResult("connection recoverable " + eventObj.getResult());
                    // Deployment.Current.Dispatcher.BeginInvoke(delegate() {   RecoverConnection(); });
                    break;
                case WarpResponseResultCode.SUCCESS_RECOVERED:
                    //_page.showResult("connection success recovered " + eventObj.getResult());
                    // Deployment.Current.Dispatcher.BeginInvoke(delegate() { ConnectionRecovered(); });
                    break;
                default:

                    break;
            }
        }
        public void onConnectDone(ConnectEvent eventObj)
        {
            switch (eventObj.getResult())
            {
                case WarpResponseResultCode.SUCCESS:
                     GlobalContext.IsConnectedToAppWarp = true;
                     _recoverCounts = 0;
                     // Successfully connected to the server. Lets go ahead and init the udp.
                     //Init udp is essentional if we are using UDP communication in our Game
                     WarpClient.GetInstance().initUDP();
                     if (mOnConnectDoneCallback != null)
                     {   //Request Was From Main Screen
                         Deployment.Current.Dispatcher.BeginInvoke(new ConnectionCallback(mOnConnectDoneCallback));
                     }
                     else if ((mOnConnectDoneCallback == null) && mShowResultCallback != null)
                     {
                      //Request Was From Join Screen
                      Deployment.Current.Dispatcher.BeginInvoke(new ShowResultCallback(mShowResultCallback), "connected");
                     }
                      break;
                case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
                       Deployment.Current.Dispatcher.BeginInvoke(delegate(){RecoverConnection();});
                      if (mConnectionRecoverableError != null)
                          Deployment.Current.Dispatcher.BeginInvoke(new ConnectionCallback(mConnectionRecoverableError));
                      break;
                case WarpResponseResultCode.SUCCESS_RECOVERED:
                      Deployment.Current.Dispatcher.BeginInvoke(delegate() { ConnectionRecovered(); });
                    if(mConnectionRecoverd!=null)
                      Deployment.Current.Dispatcher.BeginInvoke(new ConnectionCallback(mConnectionRecoverd));
                     break;
                default:
                      GlobalContext.IsConnectedToAppWarp = false;
                      if (mShowResultCallback != null)
                      Deployment.Current.Dispatcher.BeginInvoke(new ShowResultCallback(mShowResultCallback), "connection failed");
                      break;

            }
        }
Esempio n. 55
0
		public void onDisconnectDone(ConnectEvent eventObj) {}
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     Log("onDisconnectDone : " + eventObj.getResult());
 }
 public void onDisconnectDone(ConnectEvent eventObj)
 {
     if (onDisconnectFromAppWarp != null)
         onDisconnectFromAppWarp(eventObj);
 }
 /////////////////////////////// ConnectionRequestListener \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 public void onConnectDone(ConnectEvent eventObj)
 {
     if (onConnectToAppWarp != null)
         onConnectToAppWarp(eventObj);//send event
 }
Esempio n. 59
0
        private static void SetState(ConnectEvent errcode)
        {
            cntEvent = errcode;

            if (errcode == ConnectEvent.DownloadWaiting)
            {
                startTime = System.DateTime.Now;
            }
        }
Esempio n. 60
0
 private static bool IsState(ConnectEvent Cnntevent)
 {
     return cntEvent == Cnntevent;
 }