Esempio n. 1
0
        private void AddProfileButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new TextInputDialog("Enter a name.", "Please enter a name for the new profile.", _viewModel.ProfileManagement.ValidateNewProfileName);

            if (dialog.ShowDialogCentered(this) == true && !string.IsNullOrWhiteSpace(dialog.Result))
            {
                _viewModel.ProfileManagement.CommandAddProfile.Execute(dialog.Result);
            }
        }
Esempio n. 2
0
        private void RenameProfileButton_Click(object sender, RoutedEventArgs e)
        {
            if ((sender as FrameworkElement)?.DataContext is not IBindingProfileViewModel profile)
            {
                throw new Exception("Expected to find a DataContext of type IBindingProfileViewModel.");
            }

            var dialog = new TextInputDialog("Enter a name.", $"Please enter a new name for the profile \"{profile.Name}\".", _viewModel.ProfileManagement.ValidateNewProfileName);

            if (dialog.ShowDialogCentered(this) == true && !string.IsNullOrWhiteSpace(dialog.Result))
            {
                _viewModel.ProfileManagement.RenameProfile(profile, dialog.Result);
            }
        }