示例#1
0
        void IHandle <LoggedInMessage> .Handle(LoggedInMessage message)
        {
            var dashboard = _screenFactory.CreateScreen <DashboardViewModel>();

            dashboard.Init(message.User);
            ActiveItem = dashboard;
        }
示例#2
0
        public void Handle(LoggedInMessage message)
        {
            _messageBus.Send(new GetProfileDetailsMessage());
            IsConnected = true;

            SetIsBusy(false);
        }
 private void loggedIn(LoggedInMessage obj)
 {
     if (ViewModelLocator.Cloud.IsAuthenticated)
     {
         Frame.Navigate(typeof(MainPage));
         Frame.BackStack.Clear();
     }
 }
 private void loggedIn(LoggedInMessage obj)
 {
     if (ViewModelLocator.Cloud.IsAuthenticated)
     {
         Frame.Navigate(typeof(MainPage));
         Frame.BackStack.Clear();
     }
 }
示例#5
0
        private static void loggedIn(LoggedInMessage mes)
        {
            if (yourEvents != null)
            {
                loggedOut(new LoggedOutMessage());                 // loggedOut will clean up the previous instance
            }
            if (cloud.IsAuthenticated)
            {
                var        accessToken = cloud.AccessToken;
                UriBuilder builder     = new UriBuilder(cloud.YourEventUri);
                builder.Path       = $"{builder.Path}/spark";
                yourEvents         = new StreamEventManager(builder.Uri, accessToken);
                yourEvents.Events += YourEvents_Events;
#if DEBUG
                yourEvents.Error += (a) =>
                {
                    Debug.WriteLine($"Error: {a}");
                };
#endif
                Task.Run(() => yourEvents.Start());                 // With out the Task.Run the app freezes up not sure why
            }
        }
示例#6
0
    IEnumerator WebSocketCoroutine()
    {
        webSocket = new WebSocket(new Uri(serverAddress));
        yield return(StartCoroutine(webSocket.Connect()));

        while (true)
        {
            string reply = webSocket.RecvString();
            if (reply != null)
            {
                Debug.Log("Received msg:" + reply);
                Message msg = fastJSON.JSON.ToObject <Message>(reply);
                switch (msg.type)
                {
                case "logged_in":
                    LoggedInMessage lm = fastJSON.JSON.ToObject <LoggedInMessage>(reply);
                    Debug.Log("Logged in!, characters: " + lm.characters);
                    loginScript.AddCharacters(lm.characters);
                    break;

                case "joined":
                    JoinedMessage jm = fastJSON.JSON.ToObject <JoinedMessage>(reply);
                    playerScript.playerId = jm.id;
                    // todo: camera follow
                    Debug.Log("Joined!, playerId = " + jm.id);
                    loginPanel.SetActive(false);
                    break;

                case "update":
                    UpdateMessage umsg = (UpdateMessage)fastJSON.JSON.ToObject(reply, typeof(UpdateMessage));
                    Debug.Log("update type: " + umsg.type);
                    Debug.Log("updates: " + umsg.updates);
                    Debug.Log("List size: " + umsg.updates.Count);
                    foreach (var m in umsg.updates)
                    {
                        Dictionary <string, object> update = (Dictionary <string, object>)m;
                        var type = (string)update["type"];
                        Debug.Log("update.type = " + type);
                        switch (type)
                        {
                        case "appear":
                            Debug.Log("update.type = " + update["type"]);
                            Debug.Log("update.object_type = " + update["object_type"]);
                            Debug.Log("update.id = " + update["id"]);
                            Debug.Log("update.x = " + update["x"]);
                            Debug.Log("update.y = " + update["y"]);

                            objectManager.InstantiateObject((string)update["object_type"], (string)update["id"], (long)update["x"], (long)update["y"]);
                            break;

                        case "disappear":
                            Debug.Log("Removing object");
                            objectManager.DestroyObject((string)update["id"]);
                            break;

                        case "change":
                            Debug.Log("update.id = " + update["id"]);
                            Debug.Log("update.field = " + update["field"]);
                            Debug.Log("update.new_value = " + update["new_value"]);
                            objectManager.Change((string)update["id"], (string)update["field"], (string)update["new_value"]);
                            break;

                        case "movement":
                            Debug.Log("update.id = " + update["id"]);
                            Debug.Log("update.x = " + update["x"]);
                            Debug.Log("update.y = " + update["y"]);
                            objectManager.Move((string)update["id"], (long)update["x"], (long)update["y"]);
                            break;
                        }
                    }
                    break;
                }
                Debug.Log("Received type: " + msg.type);
            }
            if (webSocket.error != null)
            {
                Debug.Log(reply);
                break;
            }
            yield return(new WaitForSeconds(0.01f));
        }
    }
示例#7
0
 public void Handle(LoggedInMessage message)
 {
     _messageBus.Send(new TRequestType());
 }
示例#8
0
 private void OnLoggedIn(LoggedInMessage obj)
 {
     FetchPapers();
 }
示例#9
0
 private void OnLoggedIn(LoggedInMessage obj)
 {
     IsNotLoggedIn = false;
 }
示例#10
0
 /// <summary>
 /// Handles the message.
 /// </summary>
 /// <param name="message">The message.</param>
 public virtual void Handle(LoggedInMessage message)
 {
     Download();
 }
 private void HandleLoggedInMessage(LoggedInMessage lim)
 {
     this.IsLoggedInEmployeeVisible = lim.User.IsNotNullOrEmpty();
     this.StatusBarLoggedInEmployee = lim.User;
 }
示例#12
0
 public void Handle(LoggedInMessage message)
 {
     NotifyOfPropertyChange(() => IsLoggedIn);
 }
示例#13
0
 /// <summary>
 /// Handles the <see cref="LoggedInMessage"/>.
 /// </summary>
 /// <param name="message">The <see cref="LoggedInMessage"/>.</param>
 public void Handle(LoggedInMessage message)
 {
     this.CloseItem(StartScreen);
     ActivateItem(Items.First());
     IsAuthenticated = true;
 }
示例#14
0
 public virtual void Handle(LoggedInMessage message)
 {
     CurrentUser = message.CurrentUser;
 }
 private static void loggedIn(LoggedInMessage mes)
 {
     if(yourEvents != null)
     {
         loggedOut(new LoggedOutMessage()); // loggedOut will clean up the previous instance
     }
     if(cloud.IsAuthenticated)
     {
         var accessToken = cloud.AccessToken;
         UriBuilder builder = new UriBuilder(cloud.YourEventUri);
         builder.Path = $"{builder.Path}/spark";
         yourEvents = new StreamEventManager(builder.Uri, accessToken);
         yourEvents.Events += YourEvents_Events;
     #if DEBUG
         yourEvents.Error += (a) =>
         {
             Debug.WriteLine($"Error: {a}");
         };
     #endif
         Task.Run(() => yourEvents.Start()); // With out the Task.Run the app freezes up not sure why
     }
 }