private void OnLogin(JHSNetworkMessage netMsg) { LoginResponse packet = netMsg.ReadMessage <LoginResponse>(); if (packet != null) { switch (packet.Code) { case ErrorCodes.SUCCESS: MainCache.Credit = packet.Credits; SitesManager.Init(packet.sites); MainCache.MemberType = packet.MemberType; MainCache.SurfedSites = packet.SurfedSites; MainCache.LoggedIn = true; MainComponent.Core.SendNotification(ProgramConst.SHOW_MAIN); MainComponent.state = ProgramState.LOGGED_IN; break; case ErrorCodes.WRONG_PASSWORD: string msg = "Wrong username or password!"; MainComponent.Core.SendNotification(ProgramConst.SHOW_PROPMPT, msg); MainComponent.Core.SendNotification(ProgramConst.SHOW_BOX, msg); break; } } }
private void OnDataUpdatedSuccesfuly(JHSNetworkMessage netMsg) { SubmitDataForUpdate data = netMsg.ReadMessage <SubmitDataForUpdate>(); if (data != null && data.Code == ErrorCodes.JUST_DATA_UPDATE) { SitesManager.Init(data.Changed); } else { SitesManager.UpdateSuccess(); } }