public void OnDataChange(DataSnapshot snapshot) { if (snapshot.Value != null) { var child = snapshot.Children.ToEnumerable <DataSnapshot>(); UsersList.Clear(); foreach (DataSnapshot UsersData in child) { UsersData users = new UsersData(); users.key = UsersData.Key; users.fullname = UsersData.Child("fullname").Value.ToString(); users.phone = UsersData.Child("phone").Value.ToString(); users.email = UsersData.Child("email").Value.ToString(); UsersList.Add(users); } UsersRetrieved.Invoke(this, new UsersDataEventArgs { Users = UsersList }); } }
private static async void CheckApiConnectionFlag(ApiObject data) { await Task.Delay(1000); switch (data.apiFlag) { case ApiFlag.Error: break; case ApiFlag.CheckHash: HashCheckingRetrieved?.Invoke((bool)data.data); break; case ApiFlag.GetId: IdRetrieved?.Invoke((int)data.data); break; case ApiFlag.PostUser: UserPostFeedback?.Invoke((ApiResponse)data.data); break; case ApiFlag.CheckNickAvailability: NickCheckingRetrieved?.Invoke((bool)data.data); break; case ApiFlag.CheckMailInUse: MailAvailabilityRetrieved?.Invoke((bool)data.data); break; case ApiFlag.FindUsers: UsersRetrieved?.Invoke((List <User>)data.data); break; case ApiFlag.GetRSSSubscriptions: RSSSubscriptionsRetrieved?.Invoke((List <RSSChannel>)data.data); break; case ApiFlag.UpdateProfilePicture: ProfileImageUpdateFeedback?.Invoke((ApiResponse)data.data); break; case ApiFlag.GetProfilePicture: GetProfilePicture?.Invoke((System.Drawing.Image)data.data); break; case ApiFlag.GetFriends: FriendsRetrieved?.Invoke((List <User>)data.data); break; case ApiFlag.GetGroups: GroupsRetrieved?.Invoke((List <Group>)data.data); break; case ApiFlag.GetPetitions: PetitionsRetrieved?.Invoke((List <User>)data.data); break; case ApiFlag.AcceptPetition: AcceptPetitionFeedback?.Invoke((ApiResponse)data.data); break; case ApiFlag.SendPetition: SendPetitionFeedback?.Invoke((ApiResponse)data.data); break; } }