/** * Añade un nuevo perfil a la aplicacion */ private void addProfile(object sender, RoutedEventArgs e) { NewProfile newProf = new NewProfile(); newProf.ShowDialog(); if (newProf.isAdded()) { Button b = new Button(); b.Content = newProf.getName(); b.HorizontalAlignment = HorizontalAlignment.Stretch; b.VerticalAlignment = VerticalAlignment.Stretch; b.VerticalContentAlignment = VerticalAlignment.Center; b.HorizontalContentAlignment = HorizontalAlignment.Stretch; b.FontSize = 40; b.Padding = new Thickness(0); b.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); b.Style = Application.Current.Resources["CustomButtonStyle"] as Style; b.Click += selectProfile; Lista.addButtonProfile(b); perfiles.Children.Add(b); MessageBox.Show("El perfil ha sido creado. Cambia al perfil desde el panel de opciones pulsando \"Cambiar Perfil\""); } else { MessageBox.Show("No se ha podido crear el perfil"); } }
private void btnNewProfile_Click(object sender, RoutedEventArgs e) { this.Hide(); NewProfile newProfile = new NewProfile(); newProfile.ShowDialog(); }
private void cmdNew_Click(object sender, EventArgs e) { try { DatabaseProfile dbProfile = new DatabaseProfile(string.Format("New")); RenameProfile: NewProfile frmAddProfile = new NewProfile(dbProfile.Name); if (DialogResult.OK == frmAddProfile.ShowDialog()) { dbProfile.Name = frmAddProfile.ProfileName; if (_dbSettings.Profiles[dbProfile.Name] != null) { MessageBox.Show("The profile you entered already exists. Choose a different name for the profile."); goto RenameProfile; } ProfileSetup newProfile = new ProfileSetup(dbProfile); if (newProfile.ShowDialog() == DialogResult.OK) { _dbSettings.Profiles.Add(dbProfile); ShowProfiles(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Add profile"); } }