Ejemplo n.º 1
0
        public ResultadosBusqueda_viewmodel(List <Familia> familiasEncontradas,
                                            ProcesadorDeComandosRevit procesadorDeComandosRevit,
                                            Autodesk.Revit.UI.ExternalEvent lanzarProcesadorDeComandosRevit)
        {
            this.procesadorDeComandosRevit             = procesadorDeComandosRevit;
            procesadorDeComandosRevit.comandoAEjecutar = ProcesadorDeComandosRevit.ComandosDisponibles.noHacerNada;
            this.lanzarProcesadorDeComandosRevit       = lanzarProcesadorDeComandosRevit;

            // ALBERTO. Que solo muestre las familias .rfa que tengan imagen asociada.
            //if (opciones == null) { opciones = Opciones.getOpcionesAlmacenadas(mostrarAvisoEnCasoDeError: false); };
            //if (familiasimg == null) { familiasimg = new List<Familia>(); };
            //familiasimg.Clear();
            //for (int x = 0; x < familiasEncontradas.Count - 1; x++)
            //{
            //    //if (System.IO.Path.Combine(pathDeLaCarpetaPersonalDeImagenesThumbnail, _familias[x].nombreArchivo))
            //    if (File.Exists(System.IO.Path.Combine(opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia, familiasEncontradas[x].nombreArchivo)))
            //    {
            //        familiasimg.Add(familiasEncontradas[x]);
            //    }
            //}
            //familiasEncontradas.Clear();
            //familiasEncontradas = familiasimg;
            // ************************************************************************

            _familias = familiasEncontradas;
            NotifyPropertyChanged("familias");

            opciones = Opciones.getOpcionesAlmacenadas(mostrarAvisoEnCasoDeError: false);
        }
Ejemplo n.º 2
0
 public static Opciones getOpcionesPorDefecto()
 {
     // Alberto. Coger las opciones de uf (ULMALGFree.clsBase)
     Opciones op = new Opciones();
     op.idFilialConLaQueTrabajar = Convert.ToInt32(uf.DEFAULT_PROGRAM_MARKET);
     op.modoDeObtenerLosDatosBDI = ConsultarBDI.CONSULTAS.ModoDeObtenerLosDatos.offline;
     op.pathDeLaCarpetaConLosXMLParaOffline = System.IO.Path.GetFullPath(uf.path_offlineBDIdata);
     op.idiomaParaLosNombres = uf.DEFAULT_PROGRAM_LANGUAGE;
     // Alberto.
     string baseFamilia = uf.path_families_base.StartsWith(".\\") ? uf.path_families_base.Replace(".\\", uf._LgFullFolder) : uf.path_families_base;
     string baseFamiliaImagen = uf.path_families_base_images.StartsWith(".\\") ? uf.path_families_base_images.Replace(".\\", uf._LgFullFolder) : uf.path_families_base_images;
     string baseCustom = uf.path_families_custom.StartsWith(".\\") ? uf.path_families_custom.Replace(".\\", uf._LgFullFolder) : uf.path_families_custom;
     string baseCustomImagen = uf.path_families_custom_images.StartsWith(".\\") ? uf.path_families_custom_images.Replace(".\\", uf._LgFullFolder) : uf.path_families_custom_images;
     op.pathDeLaCarpetaBaseDeArchivosDeFamilia = baseFamilia;
     op.pathDeLaCarpetaBaseDeImagenesThumbnail = baseFamiliaImagen;
     op.pathDeLaCarpetaPersonalDeArchivosDeFamilia = baseCustom;
     op.pathDeLaCarpetaPersonalDeImagenesThumbnail = baseCustomImagen;
     //
     op.orientacionParaLaListaDeGrupos = "H";
     op.limiteDeTamainoElementoGrupo = "125";
     op.usarNombresCortosEnLosGrupos = true;
     op.usarNombresDeArchivoEnLasFamilias = true;
     //op.AlmacenarOpciones();
     return op;
 }
Ejemplo n.º 3
0
        public void Accion_SalirYGuardarOpciones()
        {
            string orientacionGrupos;

            if (gruposEnVertical == true)
            {
                orientacionGrupos = "V";
            }
            else
            {
                orientacionGrupos = "H";
            }
            bool nombresCortos;

            if (usarNombresCortosEnLosGrupos == true)
            {
                nombresCortos = true;
            }
            else
            {
                nombresCortos = false;
            }
            bool nombresDeArchivo;

            if (usarNombresDeArchivoEnLasFamilias == true)
            {
                nombresDeArchivo = true;
            }
            else
            {
                nombresDeArchivo = false;
            }

            Opciones opciones = Opciones.getOpcionesAlmacenadas(mostrarAvisoEnCasoDeError: false);

            opciones.idFilialConLaQueTrabajar            = filialSeleccionada;
            opciones.modoDeObtenerLosDatosBDI            = modoDeObtenerLosDatosBDI;
            opciones.pathDeLaCarpetaConLosXMLParaOffline = pathDeLaCarpetaConLosXMLParaOffline;
            opciones.idiomaParaLosNombres = idiomaSeleccionado;
            opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia     = pathDeLaCarpetaBaseDeArchivosDeFamilia;
            opciones.pathDeLaCarpetaBaseDeImagenesThumbnail     = pathDeLaCarpetaBaseDeImagenesThumbnail;
            opciones.pathDeLaCarpetaPersonalDeArchivosDeFamilia = pathDeLaCarpetaPersonalDeArchivosDeFamilia;
            opciones.pathDeLaCarpetaPersonalDeImagenesThumbnail = pathDeLaCarpetaPersonalDeImagenesThumbnail;
            opciones.orientacionParaLaListaDeGrupos             = orientacionGrupos;
            opciones.limiteDeTamainoElementoGrupo      = limiteDeTamainoElementoGrupo;
            opciones.usarNombresCortosEnLosGrupos      = nombresCortos;
            opciones.usarNombresDeArchivoEnLasFamilias = nombresDeArchivo;
            opciones.AlmacenarOpciones();
            enlaceConLaVentanaUCBrowser.InicializarDatos();
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        //public static Opciones getOpcionesPorDefectoDeJuan()
        //{
        //    Opciones op = new Opciones();
        //    op.idFilialConLaQueTrabajar = 120;
        //    op.modoDeObtenerLosDatosBDI = ConsultarBDI.CONSULTAS.ModoDeObtenerLosDatos.offline;
        //    op.pathDeLaCarpetaConLosXMLParaOffline = (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
        //                                              + Path.DirectorySeparatorChar + "offlineBDIdata");
        //    op.idiomaParaLosNombres = "en";
        //    op.pathDeLaCarpetaBaseDeArchivosDeFamilia = (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
        //                                              + Path.DirectorySeparatorChar + "families");
        //    op.pathDeLaCarpetaBaseDeImagenesThumbnail = (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
        //                                              + Path.DirectorySeparatorChar + "families_images");
        //    op.pathDeLaCarpetaPersonalDeArchivosDeFamilia = "";
        //    op.pathDeLaCarpetaPersonalDeImagenesThumbnail = "";
        //    op.orientacionParaLaListaDeGrupos = "H";
        //    op.limiteDeTamainoElementoGrupo = "125";
        //    op.usarNombresCortosEnLosGrupos = true;
        //    op.usarNombresDeArchivoEnLasFamilias = true;
        //    return op;
        //}

        public static Opciones getOpcionesAlmacenadas(bool mostrarAvisoEnCasoDeError)
        {
            Opciones opciones = new Opciones();
            Opciones pordefecto = Opciones.getOpcionesPorDefecto();

            XmlDocument doc = new XmlDocument();

            string errores = "";
            string error1 = "";
            try
            {
                FileStream archivo = File.OpenRead(ARCHIVO_OPCIONES);
                doc.Load(archivo);
                archivo.Close();
            }
            catch (Exception ex)
            {
                opciones = pordefecto;
                errores = errores + "    (" + ex.Message + ")" + Environment.NewLine + Environment.NewLine; 
            }

            try
            {
                opciones.idFilialConLaQueTrabajar = int.Parse(doc.SelectSingleNode("//" + ETIQUETAidFilialConLaQueTrabajar).InnerText);
            }
            catch (Exception)
            {
                opciones.idFilialConLaQueTrabajar = pordefecto.idFilialConLaQueTrabajar;
                errores = errores + ETIQUETAidFilialConLaQueTrabajar + Environment.NewLine;
            }
            
            try
            {
                Enum.TryParse<ConsultarBDI.CONSULTAS.ModoDeObtenerLosDatos>(doc.SelectSingleNode("//" + ETIQUETAmodoDeObtenerLosDatosBDI).InnerText,
                                                                            out opciones.modoDeObtenerLosDatosBDI);
            }
            catch (Exception)
            { 
                opciones.modoDeObtenerLosDatosBDI = pordefecto.modoDeObtenerLosDatosBDI;
                errores = errores + ETIQUETAmodoDeObtenerLosDatosBDI + Environment.NewLine; 
            }

            //try
            //{
            //    opciones.pathDeLaCarpetaConLosXMLParaOffline = doc.SelectSingleNode("//" + ETIQUETApathDeLaCarpetaConLosXMLParaOffline).InnerText;
            //}
            //catch (Exception)
            //{
            //    opciones.pathDeLaCarpetaConLosXMLParaOffline = pordefecto.pathDeLaCarpetaConLosXMLParaOffline;
            //    errores = errores + ETIQUETApathDeLaCarpetaConLosXMLParaOffline + Environment.NewLine;
            //}
            if (string.IsNullOrWhiteSpace(opciones.pathDeLaCarpetaConLosXMLParaOffline))
            {
                opciones.pathDeLaCarpetaConLosXMLParaOffline = pordefecto.pathDeLaCarpetaConLosXMLParaOffline;
            }

            try
            {
                opciones.idiomaParaLosNombres = doc.SelectSingleNode("//" + ETIQUETAidiomaParaLosNombres).InnerText;
            }
            catch (Exception)
            { 
                opciones.idiomaParaLosNombres = pordefecto.idiomaParaLosNombres;
                //errores = errores + ETIQUETAidiomaParaLosNombres + Environment.NewLine; 
            }

            //try
            //{
            //    opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia = doc.SelectSingleNode("//" + ETIQUETApathDeLaCarpetaBaseDeArchivosDeFamilia).InnerText;
            //}
            //catch (Exception)
            //{ 
            //    opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia = pordefecto.pathDeLaCarpetaBaseDeArchivosDeFamilia;
            //    errores = errores + ETIQUETApathDeLaCarpetaBaseDeArchivosDeFamilia + Environment.NewLine; 
            //}
            if (string.IsNullOrWhiteSpace(opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia))
            {
                opciones.pathDeLaCarpetaBaseDeArchivosDeFamilia = pordefecto.pathDeLaCarpetaBaseDeArchivosDeFamilia;
                opciones.pathDeLaCarpetaBaseDeImagenesThumbnail = pordefecto.pathDeLaCarpetaBaseDeImagenesThumbnail;
            }

            //try
            //{
            //    opciones.pathDeLaCarpetaBaseDeImagenesThumbnail = doc.SelectSingleNode("//" + ETIQUETApathDeLaCarpetaBaseDeImagenesThumbnail).InnerText;
            //}
            //catch (Exception)
            //{
            //    opciones.pathDeLaCarpetaBaseDeImagenesThumbnail = pordefecto.pathDeLaCarpetaBaseDeImagenesThumbnail;
            //    errores = errores + ETIQUETApathDeLaCarpetaBaseDeImagenesThumbnail + Environment.NewLine;
            //}

            try
            {
                opciones.pathDeLaCarpetaPersonalDeArchivosDeFamilia = doc.SelectSingleNode("//" + ETIQUETApathDeLaCarpetaPersonalDeArchivosDeFamilia).InnerText;
            }
            catch (Exception)
            { errores = errores + ETIQUETApathDeLaCarpetaPersonalDeArchivosDeFamilia + Environment.NewLine; }

            try
            {
                opciones.pathDeLaCarpetaPersonalDeImagenesThumbnail = doc.SelectSingleNode("//" + ETIQUETApathDeLaCarpetaPersonalDeImagenesThumbnail).InnerText;
            }
            catch (Exception)
            { errores = errores + ETIQUETApathDeLaCarpetaPersonalDeImagenesThumbnail + Environment.NewLine; }

            try
            {
                opciones.orientacionParaLaListaDeGrupos = doc.SelectSingleNode("//" + ETIQUETAorientacionParaLaListaDeGrupos).InnerText;
            }
            catch (Exception)
            { errores = errores + ETIQUETAorientacionParaLaListaDeGrupos + Environment.NewLine; }


            try
            {
                opciones.limiteDeTamainoElementoGrupo = doc.SelectSingleNode("//" + ETIQUETAlimiteDeTamainoElementoGrupo).InnerText;
            }
            catch (Exception)
            { 
                opciones.limiteDeTamainoElementoGrupo = pordefecto.limiteDeTamainoElementoGrupo;
                errores = errores + ETIQUETAlimiteDeTamainoElementoGrupo + Environment.NewLine; 
            }


            try
            {
                bool.TryParse(doc.SelectSingleNode("//" + ETIQUETAusarNombresCortosEnLosGrupos).InnerText,
                              out opciones.usarNombresCortosEnLosGrupos);

            }
            catch (Exception)
            { 
                opciones.usarNombresCortosEnLosGrupos = pordefecto.usarNombresCortosEnLosGrupos;
                errores = errores + ETIQUETAusarNombresCortosEnLosGrupos + Environment.NewLine; 
            }

            try
            {
                bool.TryParse(doc.SelectSingleNode("//" + ETIQUETAusarNombresDeArchivoEnLasFamilias).InnerText,
                              out opciones.usarNombresDeArchivoEnLasFamilias);
            }
            catch (Exception)
            {
                opciones.usarNombresDeArchivoEnLasFamilias = pordefecto.usarNombresDeArchivoEnLasFamilias;
                errores = errores + ETIQUETAusarNombresDeArchivoEnLasFamilias + Environment.NewLine;
            }


            if (!string.IsNullOrWhiteSpace(errores))
            {
                opciones.AlmacenarOpciones();

                if (mostrarAvisoEnCasoDeError)
                {
                    errores = "Some problem reading settings file." + Environment.NewLine + Environment.NewLine
                              + ARCHIVO_OPCIONES + Environment.NewLine + Environment.NewLine
                              + "=======================================" + Environment.NewLine + Environment.NewLine
                              + errores;
                    System.Windows.MessageBox.Show(errores, "UCBrowser", 
                        System.Windows.MessageBoxButton.OK, 
                        System.Windows.MessageBoxImage.Warning);
                }
            }
            if (!string.IsNullOrWhiteSpace(error1))
            {
                if (mostrarAvisoEnCasoDeError)
                {
                    System.Windows.MessageBox.Show(error1, "UCBrowser", 
                        System.Windows.MessageBoxButton.OK, 
                        System.Windows.MessageBoxImage.Information);
                }
            }
            
            return opciones;
        }
Ejemplo n.º 6
0
        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;
            }
        }