protected override void OnActionCompleted(IAsyncResult asyncResult, MyMasterServiceClient client) { Debug.Assert((EndAction != null && EndActionWait == null) || (EndAction == null && EndActionWait != null), "Set only one of EndAction, EndActionWait"); if (EndActionWait != null) { var innerAction = EndActionWait(client, asyncResult); if (innerAction != null) { innerAction.ActionSuccess += RaiseActionSuccess; innerAction.ActionFailed += RaiseActionFailed; } else { RaiseActionSuccess(); } } else if (EndAction != null) { // When error occures, OnError is called EndAction(client, asyncResult); RaiseActionSuccess(); } CloseScreen(); }
public override void LoadContent() { m_phase = MyGuiScreenRegisterProgressPhases.WAITING_FOR_REGISTER_RESPONSE; MyMasterServiceClient.SetCredentials(MyMwcNetworkingConstants.WCF_MS_PUBLIC_USERNAME, MyMwcNetworkingConstants.WCF_MS_PUBLIC_PASSWORD); // This must be last, call progress start base.LoadContent(); }
protected override void ProgressStart() { if (String.IsNullOrEmpty(m_playerName) || String.IsNullOrEmpty(m_password)) { LoginResponse = MyMwcLoginResponseResultEnum.USERNAME_OR_PASSWORD_EMPTY; } else { MyMasterServiceClient.SetCredentials(m_playerName, PasswordHash); MySectorServiceClient.SetCredentials(m_playerName, PasswordHash); MyMwcLog.WriteLine("Login request: " + m_playerName); var client = MyMasterServiceClient.GetCheckedInstance(); AddAction(client.BeginCheckVersion(MyMwcFinalBuildConstants.SERVER_PROTOCOL_VERSION, null, client), OnCheckVersion); } }
void OnRegister(IAsyncResult result, MyMasterServiceClient client) { try { client.EndRegister(result); client.Close(); HandleRegister(); } catch (FaultException <MyRegistrationFault> fault) { HandleRegisterError(fault.Detail.ErrorCode); } catch (Exception exception) { client.Abort(); MyMwcLog.WriteLine(exception); HandleRegisterError(MyMwcRegisterResponseResultEnum.UNKNOWN_ERROR); } CloseScreen(); }
protected override void OnError(Exception exception, MyMasterServiceClient client) { MyMwcLog.WriteLine(exception); // log exception if (EnableRetry) { ShowRetryDialog(exception); } else { RaiseActionFailed(exception); if (ShowErrorMessage) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, ErrorMessageText, ErrorCaptionText, MyTextsWrapperEnum.Ok, null)); } CloseScreen(); if (OnErrorReturnToMainMenu) { MyGuiManager.BackToMainMenu(); } } }
protected override void ServiceProgressStart(MyMasterServiceClient client) { AddAction(client.BeginRegister(m_playerName, MyMwcUtils.GetHashedPassword(m_password), m_email, m_sendMeNewsletters, null, client), OnRegister); }
protected override void ServiceProgressStart(MyMasterServiceClient client) { AddAction(BeginAction(client)); }