internal void TryReportProgress (LoginProgress progress) { if (ReportProgress != null && progress != _lastProgress) { ReportProgress (progress); _lastProgress = progress; } }
void Update() { if (!doConnectToServer00) { return; } //непосредственно разбирать полученные пакеты можно только в основном потоке. packetParser.CheckAndParseIncomingPackets(this); switch (currentProgress) { //процедура авторизации. case LoginProgress.Start: netClient = new NetworkClient(packetParser); if (netClient.ConnectToServer()) { netClient.SendPacket(new SendProtocolVersion00()); currentProgress = LoginProgress.ProtocolVersionSended; } else { UnlockLoginButtons(); doConnectToServer00 = false; GUIWindowsProducer.instance.CreateNewWindow99( LanguageController.GetWord(Words.COULD_NOT_CONNECT_TO_SERVER_), true, true, false); } break; case LoginProgress.ReadyForAuth: netClient.SendPacket(new SendAuth00(this)); currentProgress = LoginProgress.AuthSended00; break; case LoginProgress.ErrorAuth00: UnlockLoginButtons(); doConnectToServer00 = false; currentProgress = LoginProgress.Start; break; case LoginProgress.Authed000: //при успешном входе в игру сохраняем авторизационные данные Settings.clientLogin77 = login_00; Settings.clientPassword77 = password_00; Settings.SaveSettings(); currentProgress = LoginProgress.Done; StartCoroutine(KeepAlivePacketSender()); netClient.SendPacket(new SendPlayerEnter00()); break; case LoginProgress.Done: //процесс завершен. break; default: break; } }
internal void TryReportProgress(LoginProgress progress) { if (ReportProgress != null && progress != _lastProgress) { ReportProgress(progress); _lastProgress = progress; } }
partial void OnContinue(MonoMac.Foundation.NSObject sender) { ServerCredentials credentials = new ServerCredentials() { UserName = UserText.StringValue, Password = PasswordText.StringValue, Address = new Uri(AddressText.StringValue), Binding = (this.Controller.saved_binding == null) ? ServerCredentials.BindingBrowser : this.Controller.saved_binding }; WarnText.StringValue = string.Empty; AddressText.Enabled = false; UserText.Enabled = false; PasswordText.Enabled = false; ContinueButton.Enabled = false; CancelButton.Enabled = false; // monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy // LoginProgress.StartAnimation(this); Thread check = new Thread(() => { var result = SetupController.GetRepositories(credentials); if (result.Repositories != null) { this.Controller.repositories = result.Repositories.WithoutHiddenOnce(); } else { this.Controller.repositories = null; } InvokeOnMainThread(delegate { if (this.Controller.repositories == null) { AddressText.StringValue = result.Credentials.Address.ToString(); WarnText.StringValue = this.Controller.GetConnectionsProblemWarning(result.FailedException); AddressText.Enabled = true; UserText.Enabled = true; PasswordText.Enabled = true; ContinueButton.Enabled = true; CancelButton.Enabled = true; } else { RemoveEvent(); Controller.Add1PageCompleted(result.Credentials.Address, result.Credentials.Binding, credentials.UserName, credentials.Password.ToString()); } LoginProgress.StopAnimation(this); }); }); check.Start(); }
partial void OnContinue(MonoMac.Foundation.NSObject sender) { ServerCredentials credentials = new ServerCredentials() { UserName = UserText.StringValue, Password = PasswordText.StringValue, Address = new Uri(AddressText.StringValue) }; WarnText.StringValue = String.Empty; AddressText.Enabled = false; UserText.Enabled = false; PasswordText.Enabled = false; ContinueButton.Enabled = false; CancelButton.Enabled = false; // monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy // LoginProgress.StartAnimation(this); Thread check = new Thread(() => { Tuple <CmisServer, Exception> fuzzyResult = CmisUtils.GetRepositoriesFuzzy(credentials); CmisServer cmisServer = fuzzyResult.Item1; if (cmisServer != null) { Controller.repositories = cmisServer.Repositories; } else { Controller.repositories = null; } InvokeOnMainThread(delegate { if (Controller.repositories == null) { WarnText.StringValue = Controller.GetConnectionsProblemWarning(fuzzyResult.Item1, fuzzyResult.Item2); AddressText.Enabled = true; UserText.Enabled = true; PasswordText.Enabled = true; ContinueButton.Enabled = true; CancelButton.Enabled = true; } else { RemoveEvent(); Controller.Add1PageCompleted(cmisServer.Url, credentials.UserName, credentials.Password.ToString()); } LoginProgress.StopAnimation(this); }); }); check.Start(); }
void ReleaseDesignerOutlets() { if (AddressHelp != null) { AddressHelp.Dispose(); AddressHelp = null; } if (AddressLabel != null) { AddressLabel.Dispose(); AddressLabel = null; } if (AddressText != null) { AddressText.Dispose(); AddressText = null; } if (CancelButton != null) { CancelButton.Dispose(); CancelButton = null; } if (ContinueButton != null) { ContinueButton.Dispose(); ContinueButton = null; } if (PasswordLabel != null) { PasswordLabel.Dispose(); PasswordLabel = null; } if (PasswordText != null) { PasswordText.Dispose(); PasswordText = null; } if (UserLabel != null) { UserLabel.Dispose(); UserLabel = null; } if (UserText != null) { UserText.Dispose(); UserText = null; } if (WarnText != null) { WarnText.Dispose(); WarnText = null; } if (LoginProgress != null) { LoginProgress.Dispose(); LoginProgress = null; } }