private void AddPersonToPersonList(Person person) { if (person != null && !AllPersons.Contains(person)) { AllPersons.Add(person); } }
private void AddPerson() { Person p = DefaultManager.Instance.DefaultPerson; AllPersons.Add(p); CurrentPerson = p; OpenPerson(); }
/// <summary> /// Подключение к серверу /// </summary> private void Connect() { Person person = new Person { Name = UserName }; try { var callback = new ChatServiceCallback(); callback.ChatCallbackEvent += Callback_ChatCallbackEvent; var joinResult = _communicationManager.Connect(serverIP: ServerIP, serverPort: ServerPort, person: person, callback: callback); if (!joinResult.Success) { Disconnect(); LogError(joinResult); return; } //Задается основной пользователь клиента CurrentPerson = person; AllPersons.Clear(); foreach (var per in joinResult.Result.OrderBy(x => x.Name)) { AllPersons.Add(per); } IsConnected = true; } catch (Exception ex) { LogError("Не получилось подключиться к серверу: " + ex.Message); IsConnected = false; } }