private void ExecuteOnDeleteContact() { try { UserServiceClient.RemoveUserToUserContact(GlobalBase.CurrentUser.Id, Profile.Id); GlobalBase.UpdateContactList(); ManageControls(); } catch (Exception) { } }
private void UpdateContacts() { try { var uiInfos = UserServiceClient.GetAllContactsUiInfo(GlobalBase.CurrentUser.Id); GlobalBase.loadPictures(UserServiceClient, uiInfos); ContactsList = uiInfos; ManageControls(); GlobalBase.UpdateContactList(); } catch (System.Exception) { } }
private void ExecuteOnLeaveGroup() { try { if (CustomMessageBox.Show(Translations.GetTranslation()["LeaveGroupAsk"].ToString(), MessageBoxType.ConfirmationWithYesNo) == MessageBoxResult.Yes) { UserServiceClient.RemoveUserToChatGroupContactAsync(_group.Id, GlobalBase.CurrentUser.Id).ContinueWith(task => { Application.Current.Dispatcher.Invoke(new Action(() => { _view.CloseWindow(); })); GlobalBase.UpdateContactList(); }); } } catch (Exception) { } }
public override void OnEntityChanged(UiInfo changedEntity) { try { if (changedEntity.UniqueName == GlobalBase.CurrentUser.Login) { GlobalBase.UpdateProfileUi.Invoke(); } else { foreach (var uiInfo in ContactsList) { if (uiInfo.UniqueName == changedEntity.UniqueName) { GlobalBase.UpdateContactList(); break; } } } } catch (Exception) { } }
private void ExecuteOnApplyChanges() { try { if (Validate()) { IsSavingProgress = true; var res = string.Empty; Task.Run(() => { _group.Name = GroupName; var chatFile = GlobalBase.FileServiceClient.getChatFileById(_group.ImageId); if (_newAvatar != null) { if (chatFile == null) { _group.ImageId = GlobalBase.FileServiceClient.UploadFile(new FileService.ChatFile() { Source = CompressionHelper.CompressImage(_newAvatar) }); } else { GlobalBase.FileServiceClient.UpdateFileSource(chatFile.Id, CompressionHelper.CompressImage(_newAvatar)); } } if (_membersToAdd?.Count != 0) { foreach (var uiInfo in _membersToAdd) { UserServiceClient.AddUserToChatGroupContact(_group.Id, (uiInfo as UserUiInfo).UserId); } } res = UserServiceClient.AddOrUpdateChatGroup(_group); SetAvatarForUI(); if (res == string.Empty) { Application.Current.Dispatcher.Invoke(new Action((() => { CustomMessageBox.Show(Translations.GetTranslation()["ChangesSaved"].ToString()); }))); } }).ContinueWith(task => { IsSavingProgress = false; IsNewChanges = false; GlobalBase.UpdateContactList(); }); } } catch (Exception) { } }