public void RecuperarDelDisco(string pathDeLaCarpetaPersonalParaLlegarHastaLosThumbnails, string pathDeLaCarpetaBaseParaLlegarHastaLosThumbnails) { familiasFavoritas.Clear(); try { if (File.Exists(archivoFavoritos)) { XmlDocument doc = new XmlDocument(); FileStream archivo = File.OpenRead(archivoFavoritos); doc.Load(archivo); archivo.Close(); foreach (XmlNode nFamilia in doc.SelectNodes("//" + ETIQUETAfamilia)) { Familia familia = new Familia(id: nFamilia.SelectSingleNode("id").InnerText, nombre: nFamilia.SelectSingleNode("name").InnerText, nombreArchivo: nFamilia.SelectSingleNode("file").InnerText, esDinamica: false, esConjunto: false, esAnnotationSymbol: false); familia.thumbnail = BibliotecaDeFamilias.ObtenerImagen(nombreArchivoFamilia: familia.nombreArchivo, pathDeLaCarpetaPersonalDeImagenesThumbnail: pathDeLaCarpetaPersonalParaLlegarHastaLosThumbnails, pathDeLaCarpetaBaseDeImagenesThumbnail: pathDeLaCarpetaBaseParaLlegarHastaLosThumbnails); familiasFavoritas.Add(familia); } } } catch (Exception ex) { System.Windows.MessageBox.Show("Some problem reading favorits." + Environment.NewLine + Environment.NewLine + archivoFavoritos + Environment.NewLine + ex.Message, "ATTENTION", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); } }
internal void InicializarDatos() { Mouse.OverrideCursor = Cursors.Wait; try { _lineasDeProducto = new List <LineaDeProducto>(); NotifyPropertyChanged("lineasDeProducto"); _grupos = new List <GrupoDeFamilias>(); NotifyPropertyChanged("grupos"); _familias = new List <Familia>(); NotifyPropertyChanged("familias"); opciones = Opciones.getOpcionesAlmacenadas(mostrarAvisoEnCasoDeError: true); tituloDeLaVentana = "Browser"; // [" + opciones.modoDeObtenerLosDatosBDI + "] [" + opciones.idFilialConLaQueTrabajar //+ "] [" + opciones.idiomaParaLosNombres + "] " //+ " (v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() //+ "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() //+ " c" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString() + ") "; biblioteca = new BibliotecaDeFamilias(idCompaniaBaan: opciones.idFilialConLaQueTrabajar, modoDeObtenerLosDatosBDI: opciones.modoDeObtenerLosDatosBDI, pathDeLaCarpetaConLosXMLParaOffline: opciones.pathDeLaCarpetaConLosXMLParaOffline, idiomaParaLosNombres: opciones.idiomaParaLosNombres, pathDeLaCarpetaBaseDeArchivosDeFamilia: opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia, pathDeLaCarpetaBaseDeImagenesThumbnail: opciones.pathDeLaCarpetaBaseDeImagenesThumbnail, pathDeLaCarpetaPersonalDeArchivosDeFamilia: opciones.pathDeLaCarpetaPersonalDeArchivosDeFamilia, pathDeLaCarpetaPersonalDeImagenesThumbnail: opciones.pathDeLaCarpetaPersonalDeImagenesThumbnail); NotifyPropertyChanged("familias"); if (opciones.usarNombresCortosEnLosGrupos) { biblioteca.UsarNombresCortosEnLosGrupos(); } else { biblioteca.UsarNombresNormalesEnLosGrupos(); } if (opciones.usarNombresDeArchivoEnLasFamilias) { biblioteca.UsarNombresDeArchivoEnLasFamilias(); } else { biblioteca.UsarNombresNormalesEnLasFamilias(); } //_lineasDeProducto = biblioteca.getLineasDeProducto(); _lineasDeProducto = biblioteca.getLineasDeProductoFiltrado(); NotifyPropertyChanged("lineasDeProducto"); //if (BibliotecaDeFamilias.familiasimg == null) { BibliotecaDeFamilias.familiasimg = new List<Familia>(); }; //BibliotecaDeFamilias.familiasimg.Clear(); //for (int x = 0; x < _familias.Count - 1; x++) //{ // if (_familias[x].thumbnail != null && _familias[x].thumbnail != Properties.Resources._default) // { // BibliotecaDeFamilias.familiasimg.Add(_familias[x]); // } //} //_familias.Clear(); //_familias = BibliotecaDeFamilias.familiasimg; //BibliotecaDeFamilias.familiasimg.Clear(); //NotifyPropertyChanged("familiasimg"); //Main_window.mWindows.actualizar(); favoritos = new Favoritos(); favoritos.RecuperarDelDisco(opciones.pathDeLaCarpetaPersonalDeImagenesThumbnail, opciones.pathDeLaCarpetaBaseDeImagenesThumbnail); filtroAll = true; filtroDyn = false; filtroSET = false; filtroUnit = false; filtroAnnSymb = false; filtroANN_ = false; filtroDET_ = false; if (opciones.orientacionParaLaListaDeGrupos == "V") { anguloDeRotacionTextBlockGrupos = -90; } else { anguloDeRotacionTextBlockGrupos = 0; } } finally { Mouse.OverrideCursor = null; } }
public Opciones_viewmodel(Main_viewmodel enlaceConLaVentanaUCBrowser) { this.enlaceConLaVentanaUCBrowser = enlaceConLaVentanaUCBrowser; Opciones opciones = Opciones.getOpcionesAlmacenadas(mostrarAvisoEnCasoDeError: false); pathDeLaCarpetaConLosXMLParaOffline = opciones.pathDeLaCarpetaConLosXMLParaOffline; pathDeLaCarpetaBaseDeArchivosDeFamilia = opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia; pathDeLaCarpetaBaseDeImagenesThumbnail = opciones.pathDeLaCarpetaBaseDeImagenesThumbnail; pathDeLaCarpetaPersonalDeArchivosDeFamilia = opciones.pathDeLaCarpetaPersonalDeArchivosDeFamilia; pathDeLaCarpetaPersonalDeImagenesThumbnail = opciones.pathDeLaCarpetaPersonalDeImagenesThumbnail; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; try { _filiales = BibliotecaDeFamilias.getFilialesDirectamenteDeLaBDI(opciones.modoDeObtenerLosDatosBDI); NotifyPropertyChanged("filiales"); filialSeleccionada = opciones.idFilialConLaQueTrabajar; _idiomas = new ReadOnlyObservableCollection <string>(new ObservableCollection <string>(BibliotecaDeFamilias.getIdiomasDirectamenteDeLaBDI(opciones.modoDeObtenerLosDatosBDI))); NotifyPropertyChanged("idiomas"); idiomaSeleccionado = opciones.idiomaParaLosNombres; } finally { Mouse.OverrideCursor = null; } if (opciones.modoDeObtenerLosDatosBDI == ConsultarBDI.CONSULTAS.ModoDeObtenerLosDatos.online) { leerBDIonline = true; leerBDIoffline = false; } else { leerBDIonline = false; leerBDIoffline = true; } if (opciones.orientacionParaLaListaDeGrupos == "V") { gruposEnVertical = true; gruposEnHorizontal = false; } else { gruposEnVertical = false; gruposEnHorizontal = true; } double limite; if (double.TryParse(opciones.limiteDeTamainoElementoGrupo, out limite)) { limitarTamainoElementoGrupo = true; limiteDeTamainoElementoGrupo = opciones.limiteDeTamainoElementoGrupo; } else { limitarTamainoElementoGrupo = false; limiteDeTamainoElementoGrupo = ""; } usarNombresCortosEnLosGrupos = opciones.usarNombresCortosEnLosGrupos; if (opciones.usarNombresDeArchivoEnLasFamilias) { mostrarNombresDescriptivosEnLasFamilias = false; mostrarNombresDeArchivoEnLasFamilias = true; } else { mostrarNombresDescriptivosEnLasFamilias = true; mostrarNombresDeArchivoEnLasFamilias = false; } }