public static void addProfile(PerfilClass p) { if (!_perfiles.Contains(p)) { _perfiles.Add(p); } }
/** * Borra el perfil seleccionado */ private void removeProfile(object sender, RoutedEventArgs e) { try { if (_profile.nombre.CompareTo(_newSelectedProfile.nombre) != 0) { Conexion.deleteProfile(_newSelectedProfile.id); Button b = Lista.getProfileButton(_newSelectedProfile.nombre); if (perfiles.Children.Contains(b)) { perfiles.Children.Remove(b); } Lista.removeProfile(_newSelectedProfile.nombre); _newSelectedProfile = _profile; Button aux = Lista.getProfileButton(_profile.nombre); selectProfile(aux); } else { MessageBox.Show("No puedes borrrar el perfil seleccionado"); } } catch (MySqlException exc) { MessageBox.Show("No se ha podido conectar a la base de datos"); } }
public void addButton(PerfilClass s) { Button b = new Button(); b.Content = s.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; } selectProfile(b); }
/** * Modifica el background del perfil seleccionado */ private void selectProfile(Button b) { PerfilClass perfilSelected = Lista.getProfile(b.Content.ToString()); if (perfilSelected != null) { Lista.clearBackProfile(); b.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF595959")); } }
public static PerfilClass addProfile(PerfilClass profile) { try { var parameters = new { nombre = profile.nombre, numMenus = 0, mode = 0 }; cnn.Execute("insert into Perfil (nombre,numMenus,mode) values (@nombre,@numMenus,@mode)", parameters); Console.WriteLine("Añadido Perfil"); return(getPerfil(profile)); } catch (Exception) { } return(null); }
private void selectProfile(object sender, RoutedEventArgs e) { Button aux = (Button)sender; PerfilClass perfilSelected = Lista.getProfile(aux.Content.ToString()); if (perfilSelected != null) { _selectedProfile = perfilSelected; Lista.clearBackProfile(); aux.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF595959")); } }
public VIGallery(PerfilClass profile) { InitializeComponent(); _profile = profile; Lista.clearListas(); _botones = menu.Items; _newSelectedProfile = _profile; _botonesMenu = new List <ComboBoxItem>(); changedProfile = false; _wrapsPrincipales = new List <WrapPanelPrincipal>(); //menuReciente.setMain(this); reproductorControl.setVIGallery(this); }
public static void updateMode(long modeFolder, PerfilClass profile) { try { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { var parameters = new { mode = modeFolder, idPerfil = profile.id }; var output = cnn.Query <CarpetaClass>("UPDATE perfil set mode=@mode where id=@idPerfil", parameters); cnn.Close(); } } catch (SQLiteException e) { Console.WriteLine(e); throw e; } }
public Carpeta(VIGallery ventana, WrapPanelPrincipal primerPanel, Menu menu, Carpeta carpetaPadre) { InitializeComponent(); Title.SetText(""); _carpetaPadre = carpetaPadre; _primerPanel = primerPanel; _menu = menu; _archivos = new List <Archivo>(); _carpetasHijo = new List <Carpeta>(); _ventanaMain = ventana; _defaultCanvas = canvasFolder; _profile = VIGallery._profile; changeMode(_profile.mode); }
public static List <MenuClass> LoadMenus(PerfilClass profile) { try { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { MenuClass m = new MenuClass("", profile.id); var output = cnn.Query <MenuClass>("select * from Menu where idPerfil=@idPerfil", m); cnn.Close(); return(output.ToList()); } } catch (SQLiteException e) { Console.WriteLine(e); throw e; } }
/** * Abre una nueva ventana con el nuevo perfil seleccionado y cierra la actual */ private void changeProfile(object sender, RoutedEventArgs e) { if (_profile.nombre.CompareTo(_newSelectedProfile.nombre) != 0) { _profile = _newSelectedProfile; changedProfile = true; VIGallery vi = new VIGallery(_profile); vi.loadDataConexion(_profile.id); vi.Show(); this.Close(); } else { MessageBox.Show("El perfil ya está seleccionado"); } }
public static PerfilClass getPerfil(PerfilClass p) { try { var parameters = new { nombre = p.nombre }; var output = cnn.Query <PerfilClass>("select * from Perfil where nombre=@nombre", parameters); if (output.ToList().Count != 0) { PerfilClass perfil = output.ToList().First <PerfilClass>(); return(perfil); } else { return(null); } } catch (SQLiteException e) { Console.WriteLine(e); throw e; } }