private void CleanCurrentUserChatsList() { for (int i = CurrentUserChatsList.Count - 1; i >= 0; i--) { if (CurrentUserChatsList[i].ChatParticipants.Contains(UserLogged.UserName)) { int index; string cleanPath; index = CurrentUserChatsList[i].ChatParticipants.IndexOf(UserLogged.UserName); cleanPath = (index < 0) ? CurrentUserChatsList[i].ChatParticipants : CurrentUserChatsList[i].ChatParticipants.Remove(index, UserLogged.UserName.Length); if (cleanPath.Contains("_")) { cleanPath = cleanPath.TrimStart('_'); cleanPath = cleanPath.TrimEnd('_'); } CurrentUserChatsList[i].ChatParticipants = cleanPath; } else { CurrentUserChatsList.RemoveAt(i); } } }
private async void LoadCurrentChats() { config = new FirebaseConfig { //AuthSecret = "your_firebase_secret", BasePath = "https://realtimechat-b2228.firebaseio.com/" }; client = new FirebaseClient("https://realtimechat-b2228.firebaseio.com/"); FiresharpClient = new FireSharp.FirebaseClient(config); var collection = await client .Child("") //.Child("") .OnceAsync <UserModel>(); foreach (var col in collection) { //ChatName = col.Key; var obj = new CurrentUserChatModel(col.Key); CurrentUserChatsList.Add(obj); //Console.WriteLine($"{dino.Key} is {dino.Object.Height}m high."); } CleanCurrentUserChatsList(); }