private bool ExecuteStep2Identifying() { m_Server.Start(); var isOk = m_Server.Identify(m_PlayerName); var retry = true; while (!isOk && retry) { var form2 = new NameUsedForm(m_PlayerName); form2.ShowDialog(); retry = form2.OK; m_PlayerName = form2.PlayerName; isOk = m_Server.Identify(m_PlayerName); } return(isOk); }
protected override void ObtainData(object sender, DoWorkEventArgs e) { Success = null; if (!m_Identified) { LoadingDataVm.SmallLoadingMessage = "Reaching the server ..."; Thread.Sleep(1000); if (!m_Server.Connect()) { Success = false; MessageBox.Show("Unreachable"); return; } m_Server.ServerLost += m_Server_ServerLost; m_Server.Start(); LoadingDataVm.SmallLoadingMessage = "Checking Compatibility ..."; Thread.Sleep(1000); var compat = m_Server.CheckServerCompatibility(typeof(App).Assembly.FullName); if (!compat.Success) { Success = false; MessageBox.Show($"{compat.MessageId}: {compat.Message}{Environment.NewLine}Server: {compat.ServerIdentification}{Environment.NewLine}Server protocol: {compat.ImplementedProtocolVersion}", "Server and client are not compatible"); return; } m_Game = compat.AvailableGames.FirstOrDefault(); LoadingDataVm.SmallLoadingMessage = "Identifying the Player ..."; Thread.Sleep(1000); if (!m_Server.Identify(m_Name)) { Success = false; MessageBox.Show("Can't identify as " + m_Name); return; } m_Identified = true; } LoadingDataVm.SmallLoadingMessage = "Getting List of tables ..."; Thread.Sleep(1000); var tables = m_Server.ListTables(LobbyTypeEnum.QuickMode); if (tables == null) { Success = false; MessageBox.Show("Can't list tables!"); return; } Tables.Clear(); Tables.AddItems(tables); Success = true; }