Example #1
0
        private Tuple <bool, string> Validator(string input)
        {
            ViewModel.ManageProfilesViewModel dc = (ViewModel.ManageProfilesViewModel)DataContext;

            if (dc.Profiles.Contains(input))
            {
                return(Tuple.Create(false, "A profile with that name already exists"));
            }

            return(Tuple.Create(true, (string)null));
        }
Example #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            PromptWindow prompt = new PromptWindow("Profile name", "Profile name", Validator);

            prompt.Owner = this;
            prompt.ShowDialog();

            if (prompt.DialogResult.HasValue && prompt.DialogResult.Value)
            {
                ViewModel.ManageProfilesViewModel dc = (ViewModel.ManageProfilesViewModel)DataContext;
                dc.AddProfileCommand.Execute(prompt.Input);
            }
        }