コード例 #1
0
ファイル: UserViewModel.cs プロジェクト: xoreaxecx/MVVM_Users
        private async void GetUsers()
        {
            var temp = await FBClient
                       .Child("users")
                       .OrderByKey()
                       .OnceAsync <UserModel>();

            await App.Current.Dispatcher.BeginInvoke((Action) delegate() { DbUsers.Clear(); });

            foreach (var e in temp)
            {
                await App.Current.Dispatcher.BeginInvoke((Action) delegate()
                {
                    DbUsers.Add(new UserModel {
                        Key = e.Key, Name = e.Object.Name
                    });
                });
            }

            //await App.Current.Dispatcher.BeginInvoke((Action)delegate () { StrCollection.Clear(); });

            //foreach (var e in temp)
            //{
            //    await App.Current.Dispatcher.BeginInvoke((Action)delegate ()
            //     {
            //         StrCollection.Add(e.Object.Name);
            //     });
            //}
        }
コード例 #2
0
        public static bool RegistrationNewUser(string _login, string _password, string _email)
        {
            DbUsers Users = new DbUsers();

            if (!Users.Items.Exists(x => x.Login == _login))
            {
                WorkinhWithUserMethods m     = new WorkinhWithUserMethods();
                List <User>            users = Users.Items;
                Users.Add(new User {
                    Login = _login, Password = GetHash(_password), Email = _email, FavouriteStations = new List <FavouriteStation>()
                });

                return(true);
            }
            else
            {
                return(false);
            }
        }