Integracion y añadir editor de path a configuraciones
parent
5fb7c3375a
commit
788e69c70c
|
|
@ -32,6 +32,7 @@ namespace OliviaAddInPro
|
||||||
if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno)
|
if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno)
|
||||||
{
|
{
|
||||||
///Comprueba que existe la red navegable configurada
|
///Comprueba que existe la red navegable configurada
|
||||||
|
|
||||||
if (HelperGdb.GetGdb(OliviaGlob.Paths.PathGdbNw).Result == null)
|
if (HelperGdb.GetGdb(OliviaGlob.Paths.PathGdbNw).Result == null)
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg("No encuentra Gdb de red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
HelperGlobal.ponMsg("No encuentra Gdb de red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using OliviaAddInPro.View.Configuracion;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
@ -6,6 +7,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using Xceed.Wpf.Toolkit.PropertyGrid;
|
using Xceed.Wpf.Toolkit.PropertyGrid;
|
||||||
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
|
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
|
||||||
|
|
||||||
|
|
@ -190,11 +192,19 @@ namespace OliviaAddInPro.Model
|
||||||
#endregion
|
#endregion
|
||||||
#region General
|
#region General
|
||||||
[Category("General")]
|
[Category("General")]
|
||||||
|
[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))]
|
||||||
|
//[Editor(typeof(EditorFilePickerDefinition), typeof(EditorFilePickerDefinition))]
|
||||||
|
public string Path_Eje_via { get; set; }
|
||||||
|
/*
|
||||||
|
[Category("General")]
|
||||||
[DisplayName("Red de carreteras")]
|
[DisplayName("Red de carreteras")]
|
||||||
[Description("Red de carreteras que se usara para la navegación")]
|
[Description("Red de carreteras que se usara para la navegación")]
|
||||||
|
[Editor(typeof(PropertyGridFilePickerGDB), typeof(PropertyGridFilePickerGDB))]
|
||||||
//[Editor(typeof(EditorFilePickerDefinition), typeof(EditorFilePickerDefinition))]
|
//[Editor(typeof(EditorFilePickerDefinition), typeof(EditorFilePickerDefinition))]
|
||||||
public string red_carreteras { get; set; }
|
public string red_carreteras { get; set; }
|
||||||
|
*/
|
||||||
[Category("General")]
|
[Category("General")]
|
||||||
[DisplayName("Puerto")]
|
[DisplayName("Puerto")]
|
||||||
[Description("Puerto de conexión con el proceso olivia")]
|
[Description("Puerto de conexión con el proceso olivia")]
|
||||||
|
|
@ -207,15 +217,18 @@ namespace OliviaAddInPro.Model
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CAPAS_GENERALES
|
#region CAPAS_GENERALES
|
||||||
|
/*
|
||||||
[Category("Capas Generales")]
|
[Category("Capas Generales")]
|
||||||
[DisplayName("Eje de via")]
|
[DisplayName("Eje de via")]
|
||||||
[Description("Capa de eje de via que se usara")]
|
[Description("Capa de eje de via que se usara")]
|
||||||
|
[Editor(typeof(PropertyGridFilePickerLine), typeof(PropertyGridFilePickerLine))]
|
||||||
public string eje_via { get; set; }
|
public string eje_via { get; set; }
|
||||||
|
|
||||||
[Category("Capas Generales")]
|
[Category("Capas Generales")]
|
||||||
[DisplayName("Capa municipios")]
|
[DisplayName("Capa municipios")]
|
||||||
[Description("Capa municipios")]
|
[Description("Capa municipios")]
|
||||||
public string municipios { get; set; }
|
public string municipios { get; set; }
|
||||||
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CamposGenerales
|
#region CamposGenerales
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ namespace OliviaAddInPro.Model
|
||||||
*/
|
*/
|
||||||
public struct Capas
|
public struct Capas
|
||||||
{
|
{
|
||||||
|
public static string pathEjeVia;
|
||||||
public static string ftclass_ejes; //<Nombre de la capa de ejes de carretera
|
public static string ftclass_ejes; //<Nombre de la capa de ejes de carretera
|
||||||
public static string ftclass_muni; //<Nombre de la capa de municipios de TOMTOM
|
public static string ftclass_muni; //<Nombre de la capa de municipios de TOMTOM
|
||||||
};
|
};
|
||||||
|
|
@ -202,7 +203,7 @@ namespace OliviaAddInPro.Model
|
||||||
HelperGlobal.create_folder(Paths.PathTemp);
|
HelperGlobal.create_folder(Paths.PathTemp);
|
||||||
|
|
||||||
Paths.PathGdbGen = c.PathGdbGen;
|
Paths.PathGdbGen = c.PathGdbGen;
|
||||||
Paths.PathGdbNw = c.red_carreteras;
|
Paths.PathGdbNw = c.Path_Eje_via;
|
||||||
Paths.PathSimbVSM = c.PathSimbVSM;
|
Paths.PathSimbVSM = c.PathSimbVSM;
|
||||||
Paths.PathSimbESRI = c.PathSimbESRI;
|
Paths.PathSimbESRI = c.PathSimbESRI;
|
||||||
Conexion.Puerto = c.Puerto;
|
Conexion.Puerto = c.Puerto;
|
||||||
|
|
@ -211,9 +212,9 @@ namespace OliviaAddInPro.Model
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
//Capas, consultas y filtros GENERALES
|
//Capas, consultas y filtros GENERALES
|
||||||
Capas.ftclass_ejes = c.eje_via;
|
//Capas.ftclass_ejes = c.eje_via;
|
||||||
Capas.ftclass_muni = c.municipios;
|
//Capas.ftclass_muni = c.municipios;
|
||||||
|
Capas.pathEjeVia = c.Path_Eje_via;
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
//Capas, consultas, atributos y filtros de LIMPIEZA
|
//Capas, consultas, atributos y filtros de LIMPIEZA
|
||||||
LimpiezaDef.Campos.consulta_entidad = c.cons_tip_ent;
|
LimpiezaDef.Campos.consulta_entidad = c.cons_tip_ent;
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,12 @@
|
||||||
<Compile Include="ViewModel\Limpieza\PaneLimpiezaViewModel.cs" />
|
<Compile Include="ViewModel\Limpieza\PaneLimpiezaViewModel.cs" />
|
||||||
<Compile Include="ViewModel\PanelViewModelBase.cs" />
|
<Compile Include="ViewModel\PanelViewModelBase.cs" />
|
||||||
<Compile Include="ViewModel\Recogida\PaneRecogidaSub1ViewModel.cs" />
|
<Compile Include="ViewModel\Recogida\PaneRecogidaSub1ViewModel.cs" />
|
||||||
|
<Compile Include="View\Configuracion\PropertyGridFilePickerLine.xaml.cs">
|
||||||
|
<DependentUpon>PropertyGridFilePickerLine.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="View\Configuracion\PropertyGridFilePickerGDB.xaml.cs">
|
||||||
|
<DependentUpon>PropertyGridFilePickerGDB.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="View\Recogida\PaneRecogidaSub1.xaml.cs">
|
<Compile Include="View\Recogida\PaneRecogidaSub1.xaml.cs">
|
||||||
<DependentUpon>PaneRecogidaSub1.xaml</DependentUpon>
|
<DependentUpon>PaneRecogidaSub1.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -234,6 +240,14 @@
|
||||||
<Resource Include="OliviaIconPro.ico" />
|
<Resource Include="OliviaIconPro.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Page Include="View\Configuracion\PropertyGridFilePickerLine.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="View\Configuracion\PropertyGridFilePickerGDB.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="View\Recogida\PaneRecogidaSub1.xaml">
|
<Page Include="View\Recogida\PaneRecogidaSub1.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace OliviaAddInPro.Services
|
||||||
res.PathSimbVSM = pon_path_absoluto(res.PathSimbVSM, res.path_work);
|
res.PathSimbVSM = pon_path_absoluto(res.PathSimbVSM, res.path_work);
|
||||||
res.PathSimbESRI = pon_path_absoluto(res.PathSimbESRI, res.path_work);
|
res.PathSimbESRI = pon_path_absoluto(res.PathSimbESRI, res.path_work);
|
||||||
res.PathCartela = pon_path_absoluto(res.PathCartela, res.path_work);
|
res.PathCartela = pon_path_absoluto(res.PathCartela, res.path_work);
|
||||||
res.red_carreteras = pon_path_absoluto(res.red_carreteras, res.path_work);
|
res.Path_Eje_via = pon_path_absoluto(res.Path_Eje_via, res.path_work);
|
||||||
|
|
||||||
|
|
||||||
res.path_exe = pon_path_absoluto(res.path_exe, res.path_work);
|
res.path_exe = pon_path_absoluto(res.path_exe, res.path_work);
|
||||||
|
|
@ -64,7 +64,7 @@ namespace OliviaAddInPro.Services
|
||||||
conf.PathSimbVSM = pon_path_relativo(conf.PathSimbVSM, conf.path_work);
|
conf.PathSimbVSM = pon_path_relativo(conf.PathSimbVSM, conf.path_work);
|
||||||
conf.PathSimbESRI = pon_path_relativo(conf.PathSimbESRI, conf.path_work);
|
conf.PathSimbESRI = pon_path_relativo(conf.PathSimbESRI, conf.path_work);
|
||||||
conf.PathCartela = pon_path_relativo(conf.PathCartela, conf.path_work);
|
conf.PathCartela = pon_path_relativo(conf.PathCartela, conf.path_work);
|
||||||
conf.red_carreteras = pon_path_relativo(conf.red_carreteras, conf.path_work);
|
conf.Path_Eje_via = pon_path_relativo(conf.Path_Eje_via, conf.path_work);
|
||||||
|
|
||||||
string jsonString = JsonConvert.SerializeObject(conf);
|
string jsonString = JsonConvert.SerializeObject(conf);
|
||||||
File.WriteAllText(GetPathConfig(), jsonString);
|
File.WriteAllText(GetPathConfig(), jsonString);
|
||||||
|
|
@ -76,14 +76,14 @@ namespace OliviaAddInPro.Services
|
||||||
conf.PathSimbVSM = pon_path_absoluto(conf.PathSimbVSM, conf.path_work);
|
conf.PathSimbVSM = pon_path_absoluto(conf.PathSimbVSM, conf.path_work);
|
||||||
conf.PathSimbESRI = pon_path_absoluto(conf.PathSimbESRI, conf.path_work);
|
conf.PathSimbESRI = pon_path_absoluto(conf.PathSimbESRI, conf.path_work);
|
||||||
conf.PathCartela = pon_path_absoluto(conf.PathCartela, conf.path_work);
|
conf.PathCartela = pon_path_absoluto(conf.PathCartela, conf.path_work);
|
||||||
conf.red_carreteras = pon_path_absoluto(conf.red_carreteras, conf.path_work);
|
conf.Path_Eje_via = pon_path_absoluto(conf.Path_Eje_via, conf.path_work);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* cambia la carpeta referida a directorio de trabajo por los caracteres OliviaDirWork (%dir_work%)
|
* cambia la carpeta referida a directorio de trabajo por los caracteres OliviaDirWork (%dir_work%)
|
||||||
*/
|
*/
|
||||||
private string pon_path_relativo(string path, string DirWork)
|
private string pon_path_relativo(string path, string DirWork)
|
||||||
{
|
{
|
||||||
if (DirWork == null || DirWork[0] == 0)
|
if (string.IsNullOrEmpty(DirWork) || string.IsNullOrEmpty(path))
|
||||||
return path;
|
return path;
|
||||||
return path.Replace( DirWork, nameDirWork);
|
return path.Replace( DirWork, nameDirWork);
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +93,7 @@ namespace OliviaAddInPro.Services
|
||||||
*/
|
*/
|
||||||
private string pon_path_absoluto(string path, string DirWork)
|
private string pon_path_absoluto(string path, string DirWork)
|
||||||
{
|
{
|
||||||
if (DirWork == null || DirWork[0] == 0)
|
if (string.IsNullOrEmpty(DirWork) || string.IsNullOrEmpty(path))
|
||||||
return path;
|
return path;
|
||||||
return path.Replace( nameDirWork, DirWork);
|
return path.Replace( nameDirWork, DirWork);
|
||||||
}
|
}
|
||||||
|
|
@ -143,16 +143,16 @@ namespace OliviaAddInPro.Services
|
||||||
c.consulta_sector = "SECTOR";
|
c.consulta_sector = "SECTOR";
|
||||||
c.consulta_secuen = "SECUENCIA";
|
c.consulta_secuen = "SECUENCIA";
|
||||||
|
|
||||||
c.red_carreteras = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb";
|
//c.red_carreteras = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb";
|
||||||
c.puerto = 19995;
|
c.puerto = 19995;
|
||||||
c.buffer_export = 1000;
|
c.buffer_export = 1000;
|
||||||
|
|
||||||
c.path_exe=@"%dir_work%bin\OliviaTasks.exe";
|
c.path_exe=@"%dir_work%bin\OliviaTasks.exe";
|
||||||
c.path_temp = @"%dir_work%temp\";
|
c.path_temp = @"%dir_work%temp\";
|
||||||
c.path_data=@"%dir_work%data\";
|
c.path_data=@"%dir_work%data\";
|
||||||
|
c.Path_Eje_via = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb\TomTom_Q4_2015___nw";
|
||||||
c.eje_via = "TomTom_Q4_2015___nw";
|
/*c.eje_via = "TomTom_Q4_2015___nw";
|
||||||
c.municipios = "TomTom_Q4_2015___a8";
|
c.municipios = "TomTom_Q4_2015___a8";*/
|
||||||
|
|
||||||
c.cons_tip_ent= "NOM_TIPO_ENTIDAD";
|
c.cons_tip_ent= "NOM_TIPO_ENTIDAD";
|
||||||
c.cons_mecaniz= "MECANIZABLE";
|
c.cons_mecaniz= "MECANIZABLE";
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ namespace OliviaAddInPro.Services
|
||||||
//Prepara naombre de exportación
|
//Prepara naombre de exportación
|
||||||
com.NombreShpExportNw = prefNameExportNw + fechaHora + extShp;
|
com.NombreShpExportNw = prefNameExportNw + fechaHora + extShp;
|
||||||
//exporta los datos de entrada
|
//exporta los datos de entrada
|
||||||
string capaNw =System.IO.Path.Combine(OliviaGlob.Paths.PathGdbNw, OliviaGlob.Capas.ftclass_ejes);
|
string capaNw =OliviaGlob.Paths.PathGdbNw;
|
||||||
//if (!HelperGdb.ExportShp(capaNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, cps, out ErrStr))
|
//if (!HelperGdb.ExportShp(capaNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, cps, out ErrStr))
|
||||||
if (!HelperGdb.ExportShp2(capaNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, cps))
|
if (!HelperGdb.ExportShp2(capaNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, cps))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<UserControl x:Class="OliviaAddInPro.View.Configuracion.PropertyGridFilePickerGDB"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OliviaAddInPro.View.Configuracion"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
x:Name="TheControl">
|
||||||
|
<DockPanel>
|
||||||
|
<Button x:Name="PickFileButton" Content="…" Click="PickFileButton_Click" DockPanel.Dock="Right" Width="15" />
|
||||||
|
<TextBox Text="{Binding ElementName=TheControl, Path=Value}" />
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using OliviaAddInPro.Helper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using Xceed.Wpf.Toolkit.PropertyGrid;
|
||||||
|
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
|
||||||
|
using static OliviaAddInPro.Helper.HelperGdb;
|
||||||
|
|
||||||
|
namespace OliviaAddInPro.View.Configuracion
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Lógica de interacción para PropertyGridFilePicker.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PropertyGridFilePickerGDB : ITypeEditor
|
||||||
|
{
|
||||||
|
public PropertyGridFilePickerGDB()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(ValueProperty); }
|
||||||
|
set { SetValue(ValueProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty ValueProperty =
|
||||||
|
DependencyProperty.Register("Value", typeof(string), typeof(PropertyGridFilePickerGDB), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FrameworkElement ResolveEditor(PropertyItem propertyItem)
|
||||||
|
{
|
||||||
|
Binding binding = new Binding("Value");
|
||||||
|
binding.Source = propertyItem;
|
||||||
|
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
|
||||||
|
BindingOperations.SetBinding(this, ValueProperty, binding);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickFileButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog fd = new OpenFileDialog();
|
||||||
|
var st = HelperGdb.OpenFileDialog(TiposOpenFileDlg.OpenGdb, Value);
|
||||||
|
if (!string.IsNullOrEmpty(st))
|
||||||
|
{
|
||||||
|
Value = st;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<UserControl x:Class="OliviaAddInPro.View.Configuracion.PropertyGridFilePickerLine"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:OliviaAddInPro.View.Configuracion"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
x:Name="TheControl">
|
||||||
|
<DockPanel>
|
||||||
|
<Button x:Name="PickFileButton" Content="…" Click="PickFileButton_Click" DockPanel.Dock="Right" Width="15" />
|
||||||
|
<TextBox Text="{Binding ElementName=TheControl, Path=Value}" />
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using OliviaAddInPro.Helper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using Xceed.Wpf.Toolkit.PropertyGrid;
|
||||||
|
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
|
||||||
|
using static OliviaAddInPro.Helper.HelperGdb;
|
||||||
|
|
||||||
|
namespace OliviaAddInPro.View.Configuracion
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Lógica de interacción para PropertyGridFilePicker.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PropertyGridFilePickerLine : ITypeEditor
|
||||||
|
{
|
||||||
|
public PropertyGridFilePickerLine()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(ValueProperty); }
|
||||||
|
set { SetValue(ValueProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty ValueProperty =
|
||||||
|
DependencyProperty.Register("Value", typeof(string), typeof(PropertyGridFilePickerLine), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FrameworkElement ResolveEditor(PropertyItem propertyItem)
|
||||||
|
{
|
||||||
|
Binding binding = new Binding("Value");
|
||||||
|
binding.Source = propertyItem;
|
||||||
|
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
|
||||||
|
BindingOperations.SetBinding(this, ValueProperty, binding);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickFileButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog fd = new OpenFileDialog();
|
||||||
|
var st = HelperGdb.OpenFileDialog(TiposOpenFileDlg.OpenFtrClassLine, Value);
|
||||||
|
if (!string.IsNullOrEmpty(st))
|
||||||
|
{
|
||||||
|
Value = st;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue