Пример #1
0
        /// <summary>
        /// Sets the settings view model properties based on the data in the client data store
        /// </summary>
        public async Task LoadAsync()
        {
            // Run as a task so we can await client data store
            // Get the stored credentials
            var storedCredentials = await DI.ClientDataStore.GetLoginCredentialsAsync();

            Name = new TextEntryViewModel()
            {
                Label        = "Name",
                OriginalText = $"{storedCredentials?.FirstName} {storedCredentials?.LastName}",
                CommitAction = SaveNameAsync,
            };
            Username = new TextEntryViewModel()
            {
                Label        = "Username",
                OriginalText = storedCredentials?.Username,
                CommitAction = SaveUsernameAsync,
            };
            Password = new PasswordEntryViewModel()
            {
                Label        = "Password",
                FakePassword = "******",
                CommitAction = SavePasswordAsync,
            };
            Email = new TextEntryViewModel()
            {
                Label        = "Email",
                OriginalText = storedCredentials?.Email,
                CommitAction = SaveEmailAsync,
            };
        }
Пример #2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public SettingsViewModel()
        {
            // Create first name
            FirstName = new TextEntryViewModel
            {
                Label        = "First Name",
                OriginalText = loadingText,
                CommitAction = SaveFirstNameAsync
            };

            // Create last name
            LastName = new TextEntryViewModel
            {
                Label        = "Last Name",
                OriginalText = loadingText,
                CommitAction = SaveLastNameAsync
            };

            // Create Username
            Username = new TextEntryViewModel
            {
                Label        = "Username",
                OriginalText = loadingText,
                CommitAction = SaveUsernameAsync
            };

            // Create Password
            Password = new PasswordEntryViewModel
            {
                Label        = "Password",
                FakePassword = "******",
                CommitAction = SavePasswordAsync
            };

            // Create Email
            Email = new TextEntryViewModel
            {
                Label        = "Email",
                OriginalText = loadingText,
                CommitAction = SaveEmailAsync
            };

            // Create commands
            OpenCommand          = new RelayCommand(Open);
            CloseCommand         = new RelayCommand(Close);
            LogoutCommand        = new RelayCommand(async() => await LogoutAsync());
            ClearUserDataCommand = new RelayCommand(ClearUserData);
            LoadCommand          = new RelayCommand(async() => await LoadAsync());
            SaveFirstNameCommand = new RelayCommand(async() => await SaveFirstNameAsync());
            SaveLastNameCommand  = new RelayCommand(async() => await SaveLastNameAsync());
            SaveUsernameCommand  = new RelayCommand(async() => await SaveUsernameAsync());
            SaveEmailCommand     = new RelayCommand(async() => await SaveEmailAsync());

            //TODO: Get from localization
            LogoutButtonText = "Logout";
        }
 /// <summary>
 /// Default constructor
 /// </summary>
 public SettingsDesignModel()
 {
     FirstName = new TextEntryViewModel {
         Label = "Fist Name", OriginalText = "Luke"
     };
     LastName = new TextEntryViewModel {
         Label = "Last Name", OriginalText = "Malpass"
     };
     Username = new TextEntryViewModel {
         Label = "Username", OriginalText = "luke"
     };
     Password = new PasswordEntryViewModel {
         Label = "Password", FakePassword = "******"
     };
     Email = new TextEntryViewModel {
         Label = "Email", OriginalText = "*****@*****.**"
     };
 }