Exemplo n.º 1
0
        /**
         * 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");
            }
        }
Exemplo n.º 2
0
 /**
  * Carga los perfiles que tiene el usuario
  */
 private void addProfilesOptions()
 {
     perfiles.Children.Clear();
     Lista.reloadProfiles();
     foreach (PerfilClass p in Lista.getProfiles())
     {
         Button b = new Button();
         b.Content                    = p.nombre;
         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;
         bool added = Lista.addButtonProfile(b);
         if (added)
         {
             perfiles.Children.Add(b);
         }
         else
         {
             b = null;
         }
         if (b.Content.ToString().CompareTo(_profile.nombre) == 0)
         {
             selectProfile(b);
         }
     }
 }