Example #1
0
 private void AddPersonToPersonList(Person person)
 {
     if (person != null && !AllPersons.Contains(person))
     {
         AllPersons.Add(person);
     }
 }
Example #2
0
        private void AddPerson()
        {
            Person p = DefaultManager.Instance.DefaultPerson;

            AllPersons.Add(p);
            CurrentPerson = p;

            OpenPerson();
        }
Example #3
0
        /// <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;
            }
        }