Esempio n. 1
0
        private async void AddNew()
        {
            var newUser = new NewUserDialog();

            newUser.AcceptCommand = new DelegateCommand(dd =>
            {
                IsDialogOpen     = false;
                var encoder      = new Models.Encoder();
                encoder.Username = newUser.Username;
                encoder.FullName = newUser.FullName;
                encoder.Save();
            }, dd => !string.IsNullOrWhiteSpace(newUser.Username) && !Models.Encoder.UsernameExists(newUser.Username));

            await DialogHost.Show(new Views.NewUserDialog()
            {
                DataContext = newUser
            }, "InnerDialog");

            OnPropertyChanged(nameof(HasEncoders));
        }
Esempio n. 2
0
        private async void AddNew()
        {
            var newUser = new NewUserDialog("NEW USER");

            newUser.AcceptCommand = new DelegateCommand(dd =>
            {
                IsDialogOpen     = false;
                var encoder      = new Models.User();
                encoder.Username = newUser.Username;
                encoder.Fullname = newUser.FullName;
                encoder.Picture  = ImageProcessor.GetRandomLego();
                encoder.Save();
            }, dd => !string.IsNullOrWhiteSpace(newUser.Username) && User.Cache.All(x => x.Username.ToLower() != newUser.Username.ToLower()));

            await DialogHost.Show(new Views.NewUserDialog()
            {
                DataContext = newUser
            }, "InnerDialog");

            OnPropertyChanged(nameof(HasUsers));
        }