diff --git a/Model/OliviaConf.cs b/Model/OliviaConf.cs index ad9078a..7f86043 100644 --- a/Model/OliviaConf.cs +++ b/Model/OliviaConf.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -13,9 +14,12 @@ using Xceed.Wpf.Toolkit.PropertyGrid.Editors; namespace OliviaAddInPro.Model { + //This defaults to AllowMultiple = false. + [Serializable] class OliviaConf { + public enum OpsRecoCont { [Description("Contenedor lleno")] @@ -55,7 +59,11 @@ namespace OliviaAddInPro.Model TiempoOutSocket = 20; } - + public void SimplificaConfig() + { + + //} + } #region PropiedadesOcultas #region parametrosConexion /** @@ -195,8 +203,9 @@ namespace OliviaAddInPro.Model [DisplayName("Eje via de red de carreteras")] [Description("Eje de via de red de carreteras que se usara para la navegación")] [Editor(typeof(PropertyGridFilePickerLine), typeof(PropertyGridFilePickerLine))] + //[AtributoSimpleProperty] //[Editor(typeof(EditorFilePickerDefinition), typeof(EditorFilePickerDefinition))] - public string Path_Eje_via { get; set; } + public virtual string Path_Eje_via { get; set; } /* [Category("General")] [DisplayName("Red de carreteras")] @@ -1317,5 +1326,24 @@ namespace OliviaAddInPro.Model #endregion - } + } + + + + + [Serializable] + class OliviaConfSimple: OliviaConf + { + [Browsable(false)] + public override string Path_Eje_via + { + get { + return base.Path_Eje_via; + } + set + { + base.Path_Eje_via = value; + } + } + } } diff --git a/Services/ConfigServ.cs b/Services/ConfigServ.cs index f07bc7f..71393a3 100644 --- a/Services/ConfigServ.cs +++ b/Services/ConfigServ.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.IO; using Newtonsoft.Json; using Microsoft.Win32; +using System.Windows; namespace OliviaAddInPro.Services { @@ -26,13 +27,23 @@ namespace OliviaAddInPro.Services } } - public OliviaConf Leer() + public OliviaConf Leer(bool simplif=false) { + var aa= System.Reflection.Assembly.GetEntryAssembly().Location; + var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly(); //MyLibrary.dll + var callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); //MyLibrary.dll + var entryAssembly = System.Reflection.Assembly.GetEntryAssembly(); //WpfApp.exe or MyLibrary.dll + + OliviaConf res = null; try { - res= JsonConvert.DeserializeObject(File.ReadAllText(GetPathConfig())); - }catch(Exception e) + if(!simplif) + res = JsonConvert.DeserializeObject(File.ReadAllText(GetPathConfig())); + else + res = JsonConvert.DeserializeObject(File.ReadAllText(GetPathConfig())); + } + catch(Exception e) { var ee = e; res = null; diff --git a/ViewModel/Configuracion/PaneConfigViewModel.cs b/ViewModel/Configuracion/PaneConfigViewModel.cs index 096953c..7a49ea4 100644 --- a/ViewModel/Configuracion/PaneConfigViewModel.cs +++ b/ViewModel/Configuracion/PaneConfigViewModel.cs @@ -44,7 +44,14 @@ namespace OliviaAddInPro public void OnRefres() { - Configuracion = ConfigServ.Serv.Leer(); + ReferesConfig(true); + + } + + private void ReferesConfig(bool simplificado) + { + Configuracion = ConfigServ.Serv.Leer(simplificado); + } }