public async Task <IActionResult> Reconnect([FromBody] ReconnectViewModel viewModel) { if (viewModel.Key.Equals(EncryptHelper.Encrypt(viewModel.Id + Keys.Salty))) { var query = new UserById { Id = viewModel.Id }; await DataHandler.Execute(query); if (query.Result != null && query.Result.IsActive && (query.ResultTenant == null || query.ResultTenant.IsActive)) { var logic = new SigninAuth { Login = query.Result, Config = query.ResultConfig, Tenant = query.ResultTenant, Settings = CloudHandler.Settings }; await LogicHandler.Execute(logic); return(Ok(logic.Result)); } } return(Ok(new FailViewModel { Message = "Reconnect failed" })); }
public ReconnectToGame(ReconnectViewModel context) { InitializeComponent(); DataContext = context; if (context.CloseAction == null) { context.CloseAction = new Action(this.Close); } }
public static void LoadOnLogin() { // load profile async on login //var profileTask = new Task(() => //{ // set profile (will set stats and achievements) Profile.Instance.CurrentProfile = ProfileAccess.Instance.GetUserProfile(); AchievementManager.AchieveLogin(); ProgressManager.InitializeRank(); StatsManager.UpdateAchievementsUnlocked(); // Set dayly Profile.Instance.Daily = DailyAccess.Instance.GetDaily(); //DailyManager.DailyInitialize(); //}); //profileTask.Start(); // Open websocket for chat WebsocketChatAccess.Instance.OpenSocket(); // Open socket for connexion ConnexionWebsocketAccess.Instance.OpenSocket(UserToken.Token); // create new general chat canal WebsocketChatAccess.Instance.CreateNewCanal(ChatMenu.DefaultCanal, UserToken.Token); // Synchronize the zones ZoneSynchronizer.SynchronizeZone(); // Open websocket for session event SessionEventWebsocketAccess.Instance.OpenSocket(); // Todo: change to init method OnlineEventSubscriber.Initiate(); ConnectionHelper.StartCheckConnectionThread(); GameModel possibleJoin; if (ReconnectHelper.CanJoinBackGame(out possibleJoin)) { var reconnectContext = new ReconnectViewModel(possibleJoin); var popup = new ReconnectToGame(reconnectContext); popup.ShowDialog(); } GeneralOnlineEventHandler.Initiate(); }