Configuraciones y pruebas

ConfiguracionSimplificada
Gerardo 2021-11-14 01:39:56 +01:00
parent 1fa048d3f5
commit 2c58d7e889
14 changed files with 203 additions and 73 deletions

View File

@ -29,6 +29,7 @@ namespace OliviaAddInPro
{ {
OliviaGlob.TipoEjec = TiposEjecucion.Limp; OliviaGlob.TipoEjec = TiposEjecucion.Limp;
OliviaGlob.Limp = new Limpieza(); OliviaGlob.Limp = new Limpieza();
DockpaneLimpiezaViewModel.Reset();
DockpaneLimpiezaViewModel.Show(); DockpaneLimpiezaViewModel.Show();
} }
else else

View File

@ -14,6 +14,11 @@ using ArcGIS.Desktop.Mapping;
using ArcGIS.Core.Internal.CIM; using ArcGIS.Core.Internal.CIM;
using ArcGIS.Desktop.Internal.Layouts.Utilities; using ArcGIS.Desktop.Internal.Layouts.Utilities;
using ArcGIS.Desktop.Core.Geoprocessing;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Editing;
using OliviaAddInPro.Model;
namespace OliviaAddInPro.Helper namespace OliviaAddInPro.Helper
{ {
public static class HelperGdb public static class HelperGdb
@ -42,6 +47,8 @@ namespace OliviaAddInPro.Helper
} }
set { texto_sal = value; } set { texto_sal = value; }
} }
public static string SHP_EXT = ".shp";
public static string GDB_EXT = ".gdb";
[Flags] [Flags]
public enum TiposOpenFileDlg public enum TiposOpenFileDlg
@ -136,11 +143,10 @@ namespace OliviaAddInPro.Helper
{ {
string pathGdb = string.Empty; string pathGdb = string.Empty;
int i = 0; int i = 0;
string gdbext = ".gdb"; if(path.Contains(GDB_EXT))
if(path.Contains(gdbext))
{ {
i = path.IndexOf(gdbext, 0, path.Length); i = path.IndexOf(GDB_EXT, 0, path.Length);
pathGdb = path.Substring(0, i + 4); pathGdb = path.Substring(0,i + 4);
} }
return pathGdb; return pathGdb;
@ -187,7 +193,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = GetFtClassFromShp(pathFtClss).Result; ftclss = GetFtClassFromShp(pathFtClss).Result;
} }
Free(gdb);
return ftclss; return ftclss;
} }
@ -219,7 +225,7 @@ namespace OliviaAddInPro.Helper
ReiniciaOutStr(); ReiniciaOutStr();
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<FeatureClass>)(() => return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<FeatureClass>)(() =>
{ {
if (pathShp.Contains(".shp")) if (pathShp.Contains(SHP_EXT))
{ {
try try
{ {
@ -425,25 +431,29 @@ namespace OliviaAddInPro.Helper
* Forma la envolvente convexa, el mínimo polígono, * Forma la envolvente convexa, el mínimo polígono,
* que contiene los ámbitos para exportar, a partir de ahí la red navegable ampliando a un buffer * que contiene los ámbitos para exportar, a partir de ahí la red navegable ampliando a un buffer
*/ */
public static ArcGIS.Core.Geometry.Geometry GetGeomConvexHull(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filter) public static Task<ArcGIS.Core.Geometry.Geometry> GetGeomConvexHull(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filter)
{ {
ArcGIS.Core.Geometry.Geometry geomIni = null; ArcGIS.Core.Geometry.Geometry geomIni = null;
geomIni = GetGeomUnica(fclss, filter);
if (geomIni != null) return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<ArcGIS.Core.Geometry.Geometry>)(() =>
{ {
ArcGIS.Core.Geometry.Geometry geomSal = null; geomIni = GetGeomUnica(fclss, filter);
try if (geomIni != null)
{ {
geomSal = GeometryEngine.Instance.ConvexHull(geomIni); ArcGIS.Core.Geometry.Geometry geomSal = null;
return geomSal; try
{
geomSal = GeometryEngine.Instance.ConvexHull(geomIni);
return geomSal;
}
catch
{
return null;
}
} }
catch else
{
return null; return null;
} }));
}
else
return null;
} }
/* /*
@ -490,7 +500,7 @@ namespace OliviaAddInPro.Helper
bool ok = true; bool ok = true;
ReiniciaOutStr(); ReiniciaOutStr();
string txtsal = string.Empty; string txtsal = string.Empty;
ReiniciaOutStr();
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<ArcGIS.Core.Geometry.Geometry>)(() => return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<ArcGIS.Core.Geometry.Geometry>)(() =>
{ {
try try
@ -551,6 +561,7 @@ namespace OliviaAddInPro.Helper
public static Task<int> GetNumElems(FeatureClass fc, string consulta = "") public static Task<int> GetNumElems(FeatureClass fc, string consulta = "")
{ {
int n = -1; int n = -1;
ReiniciaOutStr();
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<int>)(() => return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<int>)(() =>
{ {
try try
@ -588,5 +599,84 @@ namespace OliviaAddInPro.Helper
Free(fc); Free(fc);
return n; return n;
} }
public static async Task<bool> ExportShp(string pathLayerIn, SpatialQueryFilter filter, string nameShp, string outpath, ProgressDialog progrDialog = null)
{
if (!System.IO.Directory.Exists(outpath))
System.IO.Directory.CreateDirectory(outpath);
ReiniciaOutStr();
string dirPath;
string fclassName = System.IO.Path.GetFileName(pathLayerIn);
IReadOnlyList<string> parameters = null;
FeatureClass featureClass = null;
var fin = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<bool>)(() =>
{
if (string.IsNullOrEmpty(fclassName))
return false;
try
{
if (System.IO.Path.GetExtension(pathLayerIn).Equals(".shp"))
{
dirPath = System.IO.Path.GetDirectoryName(pathLayerIn);
//es un shape de entrada
FileSystemConnectionPath fileConnection = new FileSystemConnectionPath(new Uri(dirPath), FileSystemDatastoreType.Shapefile);
using (FileSystemDatastore shapefile = new FileSystemDatastore(fileConnection))
{
featureClass = shapefile.OpenDataset<FeatureClass>(fclassName);
}
}
else
{
dirPath = GetPathGdb(pathLayerIn);
//es una feature class de una gdb
using (Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(dirPath))))
{
featureClass = fileGeodatabase.OpenDataset<FeatureClass>(fclassName);
}
}
if (featureClass == null)
return false;
//Selection selFeatures = featureClass.Select(filter, SelectionType.ObjectID, SelectionOption.Normal);
// make a value array of strings to be passed to ExecuteToolAsync
parameters = Geoprocessing.MakeValueArray(pathLayerIn, outpath, nameShp);
}
catch
{
OutStr = "Ha ocurrido un error al convertir a shape";
return false;
}
return true;
}));
if(!fin.Result || parameters==null)
{
OutStr = "Ha ocurrido un error al convertir a shape";
return false;
}
/*ObservableCollection<string> parameters = new ObservableCollection<string>();
parameters.Add(pathLayerIn);
parameters.Add(outpath);
parameters.Add(nameShp);*/
var progSrc = new CancelableProgressorSource(progrDialog);
// execute the tool
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToShapefile_conversion", parameters,
null, new CancelableProgressorSource(progrDialog).Progressor, GPExecuteToolFlags.GPThread).Result;
Free(featureClass);
if (string.IsNullOrEmpty(gpResult.ReturnValue))
{
OutStr = "Ha ocurrido un error en la herramienta de GeoProcesamiento: " + gpResult.ErrorMessages;
return false;
}
else
{
OutStr = "Ok: " + gpResult.ReturnValue;
return true;
}
}
} }
} }

View File

@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using OliviaAddInPro.Services; using OliviaAddInPro.Services;
using ArcGIS.Core.Geometry; using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Framework.Threading.Tasks;
namespace OliviaAddInPro.Model namespace OliviaAddInPro.Model
{ {
@ -65,7 +66,7 @@ namespace OliviaAddInPro.Model
} }
public static EjecServ Serv { get; } = new EjecServ(); public static EjecServ Serv { get; } = new EjecServ();
public static SpatialReference SpatRef { get; set; } = null; public static SpatialReference SpatRef { get; set; } = null;
public static ProgressDialog progrDialog { get; set; } = null;
#endregion Properties #endregion Properties
public static void Inicia() public static void Inicia()

View File

@ -14,6 +14,14 @@ namespace OliviaAddInPro.Model
* Capa de ámbitos * Capa de ámbitos
*/ */
public string CapaElems { get; set; } = string.Empty; public string CapaElems { get; set; } = string.Empty;
/**
* Nombre dle shp exportado de datos
*/
public string NombreShpExport { get; set; } = string.Empty;
/**
* Nombre dle shp exportado de nw
*/
public string NombreShpExportNw { get; set; } = string.Empty;
/** /**
* Velocidad de desplazamiento, en km/h. Si es 0, es determinada por la vía * Velocidad de desplazamiento, en km/h. Si es 0, es determinada por la vía
*/ */

View File

@ -317,7 +317,7 @@
<Resource Include="Resources\Rabbit32.png" /> <Resource Include="Resources\Rabbit32.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="View\openfolder.png" /> <Resource Include="View\Limpieza\openfolder.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="View\OliviaIconPro16.png" /> <Resource Include="View\OliviaIconPro16.png" />

View File

@ -8,6 +8,8 @@ using ArcGIS.Core.Data;
using ArcGIS.Core.Geometry; using ArcGIS.Core.Geometry;
using OliviaAddInPro.Helper; using OliviaAddInPro.Helper;
using ArcGIS.Core.Internal.Data; using ArcGIS.Core.Internal.Data;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using System.Windows;
namespace OliviaAddInPro.Services namespace OliviaAddInPro.Services
{ {
@ -25,6 +27,8 @@ namespace OliviaAddInPro.Services
public string name_export_nw = "nw_"; public string name_export_nw = "nw_";
public string ErrStr = ""; public string ErrStr = "";
SpatialQueryFilter filtroEspacial = null;
SpatialReference spatRef = null;
public TratamientoComun com; public TratamientoComun com;
/** /**
* Acciones para comenzar ejecución * Acciones para comenzar ejecución
@ -37,6 +41,7 @@ namespace OliviaAddInPro.Services
//esconde el pane //esconde el pane
OliviaGlob.ShowHidePane(false); OliviaGlob.ShowHidePane(false);
ErrStr = string.Empty;
//Cuenta las filas que cumplen la consulta //Cuenta las filas que cumplen la consulta
int nelems = HelperGdb.GetNumElems(com.CapaElems, com.ConsultaAmbs); int nelems = HelperGdb.GetNumElems(com.CapaElems, com.ConsultaAmbs);
@ -51,19 +56,23 @@ namespace OliviaAddInPro.Services
if (!fue_mal) if (!fue_mal)
{ {
geom_export = GetGeomAmbitsExport(); geom_export = GetGeomAmbitsExport();
if (geom_export == null || geom_export.IsEmpty)
{
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + ErrStr;
fue_mal = true;
}
if (geom_export == null || geom_export.IsEmpty) if (geom_export == null || geom_export.IsEmpty)
{ {
fue_mal = true; fue_mal = true;
} }
} }
//mira spatialreference de los datos de entrada
GetSpatialRef(geom_export);
//crea el filtro de exportación //crea el filtro de exportación
SpatialQueryFilter filtroEspacial = null;
if (!fue_mal) if (!fue_mal)
{ {
//mira spatialreference de los datos de entrada
spatRef = geom_export.SpatialReference;
filtroEspacial = CreaFiltro(com.ConsultaAmbs, geom_export); filtroEspacial = CreaFiltro(com.ConsultaAmbs, geom_export);
if (filtroEspacial == null) if (filtroEspacial == null)
{ {
@ -84,12 +93,14 @@ namespace OliviaAddInPro.Services
return false; return false;
} }
/** /**
* Prepara la geometría para exportar los ámbitos * Prepara la geometría para exportar los ámbitos
*/ */
public Geometry GetGeomAmbitsExport() public Geometry GetGeomAmbitsExport()
{ {
Geometry geomAux = null; Geometry geomAux = null;
ErrStr = string.Empty;
FeatureClass fc = HelperGdb.GetFtClass(com.CapaElems); FeatureClass fc = HelperGdb.GetFtClass(com.CapaElems);
QueryFilter filtro = new QueryFilter { WhereClause = com.ConsultaAmbs }; QueryFilter filtro = new QueryFilter { WhereClause = com.ConsultaAmbs };
if (fc == null) if (fc == null)
@ -97,18 +108,11 @@ namespace OliviaAddInPro.Services
ErrStr = "No se ha podido abrir la clase " + com.CapaElems; ErrStr = "No se ha podido abrir la clase " + com.CapaElems;
return null; return null;
} }
//comprueba que haya elementos que cumplen la consulta
int nElem = HelperGdb.GetNumElems(fc, com.ConsultaAmbs).Result;
if (nElem <= 0)
{
ErrStr = "No existen ámbitos que cumplan las condiciones dadas " + com.ConsultaAmbs;
return null;
}
//Primero hace la geometría de los ámbitos que cumplen la consulta //Primero hace la geometría de los ámbitos que cumplen la consulta
geomAux = HelperGdb.GetGeomConvexHull(fc, filtro); geomAux = HelperGdb.GetGeomConvexHull(fc, filtro).Result;
if (geomAux == null || geomAux.IsEmpty) if (geomAux == null || geomAux.IsEmpty)
{ {
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs; ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
return null; return null;
} }
//Hace la intersección de dicha geometría con las zonas //Hace la intersección de dicha geometría con las zonas
@ -153,7 +157,7 @@ namespace OliviaAddInPro.Services
return null; return null;
} }
} }
HelperGdb.Free(fc);
return geomAux; return geomAux;
} }
@ -185,27 +189,26 @@ namespace OliviaAddInPro.Services
return str; return str;
} }
/**
* Coge spatial reference de los datos a exportar
*/
public void GetSpatialRef(Geometry geom)
{
OliviaGlob.SpatRef = geom.SpatialReference;
}
/** /**
* Exporta y lanza proceso y ventana de proceso * Exporta y lanza proceso y ventana de proceso
*/ */
public void Ejecuta(ModosEjec modo) public void Ejecuta(ModosEjec modo)
{ {
//lanza ventana de progreso
OliviaGlob.progrDialog = new ProgressDialog("Exportando Datos", "Cancelar", 100);
OliviaGlob.progrDialog.Show();
//exporta los datos de entrada
bool res=HelperGdb.ExportShp(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, OliviaGlob.progrDialog).Result;
if(!res)
{
string msg = HelperGdb.OutStr;
if (!string.IsNullOrEmpty(msg))
msg = "Han ocurrido errores al convertir a shape.";
HelperGlobal.ponMsg(msg);
}
}
/**
* Exporta los datos de entrada y el nw
*/
public void Exporta(ModosEjec modo)
{
} }

View File

@ -27,8 +27,10 @@ namespace OliviaAddInPro.Services
*/ */
public bool Sectoriza() public bool Sectoriza()
{ {
com = (TratamientoComun)limp;
string nombFileAmbs = string.Empty; string nombFileAmbs = string.Empty;
//Prepara consulta //Prepara consulta
ErrStr = string.Empty;
if (!PreparaConsulta(out nombFileAmbs)) if (!PreparaConsulta(out nombFileAmbs))
{ {
ErrStr = "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs; ErrStr = "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs;
@ -37,14 +39,12 @@ namespace OliviaAddInPro.Services
//Prepara nombre //Prepara nombre
string fechaHora = string.Empty; string fechaHora = string.Empty;
string nombreDatExport = string.Empty;
//se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles) //se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles)
fechaHora = DateTime.Now.ToString("yyyyMMdd_Hmmss"); fechaHora = DateTime.Now.ToString("yyyyMMdd_Hmmss");
//Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp //Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp
nombreDatExport = prefNameExport + "T" + limp.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs() + "_" + fechaHora + extShp; limp.NombreShpExport = prefNameExport + "T" + limp.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs() + "_" + fechaHora + extShp;
//comienza ejecucion //comienza ejecucion
com = (TratamientoComun)limp;
if(!ComienzaEjec(ModosEjec.Sectoriza)) if(!ComienzaEjec(ModosEjec.Sectoriza))
{ {
return false; return false;
@ -68,7 +68,8 @@ namespace OliviaAddInPro.Services
public bool Planifica() public bool Planifica()
{ {
//se asegura que tiene todo para planif //se asegura que tiene todo para planif
if(!CompruebaPlanif()) ErrStr = string.Empty;
if (!CompruebaPlanif())
{ {
ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar"; ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
return false; return false;
@ -114,7 +115,6 @@ namespace OliviaAddInPro.Services
*/ */
public bool CompruebaPlanif() public bool CompruebaPlanif()
{ {
string path = null;
//si ha importado no hace falta que compruebe, seguro que las tiene //si ha importado no hace falta que compruebe, seguro que las tiene
if (OliviaGlob.IsConfig2()) if (OliviaGlob.IsConfig2())
@ -122,6 +122,9 @@ namespace OliviaAddInPro.Services
if (ComprCamposPlanif(limp.CapaElems)) if (ComprCamposPlanif(limp.CapaElems))
return true; return true;
return false;
/*
string path = null;
if (!HelperGlobal.ponMsg("En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, " + if (!HelperGlobal.ponMsg("En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, " +
"necesarias para planificar. ¿Desea utilizar la sectorización de otra capa?",MessageBoxImage.Question,"OLIVIA", "necesarias para planificar. ¿Desea utilizar la sectorización de otra capa?",MessageBoxImage.Question,"OLIVIA",
MessageBoxButton.YesNo)) MessageBoxButton.YesNo))
@ -142,7 +145,7 @@ namespace OliviaAddInPro.Services
//almacena la info de secto auxiliar //almacena la info de secto auxiliar
limp.CapaAuxPlanif = path; limp.CapaAuxPlanif = path;
return true; return true;*/
} }
public bool ComprCamposPlanif(string pathCapa) public bool ComprCamposPlanif(string pathCapa)

View File

@ -89,7 +89,10 @@ namespace OliviaAddInPro
{ {
mod.GeomRestr = geom; mod.GeomRestr = geom;
} }
label_caparestr.Content = texto; if (geom != null)
label_caparestr.Content = texto;
else
label_caparestr.Content =Resource1.String_selec_capa;
} }
private void button_capaniv_Click(object sender, RoutedEventArgs e) private void button_capaniv_Click(object sender, RoutedEventArgs e)
@ -100,7 +103,10 @@ namespace OliviaAddInPro
{ {
mod.GeomNiv = geom; mod.GeomNiv = geom;
} }
label_capaniv.Content = texto; if (geom != null)
label_capaniv.Content = texto;
else
label_capaniv.Content = Resource1.String_selec_capa;
} }
private void button_capazon_Click(object sender, RoutedEventArgs e) private void button_capazon_Click(object sender, RoutedEventArgs e)
@ -111,7 +117,11 @@ namespace OliviaAddInPro
{ {
mod.GeomZon = geom; mod.GeomZon = geom;
} }
label_capazon.Content = texto;
if (geom != null)
label_capazon.Content = texto;
else
label_capazon.Content = Resource1.String_selec_capa;
} }
private void button_capainst_Click(object sender, RoutedEventArgs e) private void button_capainst_Click(object sender, RoutedEventArgs e)
@ -124,7 +134,10 @@ namespace OliviaAddInPro
{ {
mod.CoordsInstal = mp.Coordinate2D; mod.CoordsInstal = mp.Coordinate2D;
} }
label_capainst.Content = texto; if (geomsal != null)
label_capainst.Content = texto;
else
label_capainst.Content = Resource1.String_selec_capa;
} }
} }
} }

View File

@ -35,7 +35,7 @@
<ColumnDefinition Width="Auto" MinWidth="100"/> <ColumnDefinition Width="Auto" MinWidth="100"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Content="Nº de sectores" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" Width="90" Height="30"/> <Label Content="Nº de sectores" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" Width="90" Height="30"/>
<xctk:IntegerUpDown x:Name="spinner_nsect" Value="{Binding Path=NumSect, Mode = TwoWay}" Grid.Column="1" Height="20" Width="70" FormatString="N0" Increment="1" Maximum="30" Minimum="1" Margin="17,4,2,6" AllowTextInput ="False" IsEnabled="{Binding Path=EnableNSect, Mode = TwoWay}"/> <xctk:IntegerUpDown x:Name="spinner_nsect" Value="{Binding Path=NumSect, Mode = TwoWay}" Grid.Column="1" Height="20" Width="70" FormatString="N0" Increment="1" Maximum="30" Minimum="1" Margin="17,4,2,6" AllowTextInput ="False" IsEnabled="{Binding Path=EnableNSect}"/>
<CheckBox x:Name="checkBox_sectauto" Grid.Column="2" Margin="9,6,9,-1" Content="Automático" IsChecked="{Binding Path=CheckSectAuto, Mode = TwoWay}"/> <CheckBox x:Name="checkBox_sectauto" Grid.Column="2" Margin="9,6,9,-1" Content="Automático" IsChecked="{Binding Path=CheckSectAuto, Mode = TwoWay}"/>
</Grid> </Grid>
<CheckBox x:Name="checkBox_ajustsect" Margin="18,10,0,0" Content="Ajustar sectores a jornada" IsChecked="{Binding Path=CheckAjustSect, Mode = TwoWay}"/> <CheckBox x:Name="checkBox_ajustsect" Margin="18,10,0,0" Content="Ajustar sectores a jornada" IsChecked="{Binding Path=CheckAjustSect, Mode = TwoWay}"/>

View File

Before

Width:  |  Height:  |  Size: 611 B

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

View File

@ -23,6 +23,7 @@ namespace OliviaAddInPro
internal class DockpaneRecogidaViewModel : DockPane internal class DockpaneRecogidaViewModel : DockPane
{ {
private bool firstTimeShow = true; private bool firstTimeShow = true;
private static bool hideTemp = false;
private const string _dockPaneID = "OliviaAddInPro_DockpaneRecogida"; private const string _dockPaneID = "OliviaAddInPro_DockpaneRecogida";
protected DockpaneRecogidaViewModel() { } protected DockpaneRecogidaViewModel() { }
@ -35,7 +36,7 @@ namespace OliviaAddInPro
DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID); DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null) if (pane == null)
return; return;
hideTemp = false;
pane.Activate(); pane.Activate();
} }
@ -44,7 +45,7 @@ namespace OliviaAddInPro
DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID); DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null) if (pane == null)
return; return;
hideTemp = true;
pane.Hide(); pane.Hide();
} }
@ -52,7 +53,7 @@ namespace OliviaAddInPro
//also false the first time //also false the first time
protected override void OnShow(bool isVisible) protected override void OnShow(bool isVisible)
{ {
if (isVisible == false && !firstTimeShow) if (isVisible == false && !firstTimeShow && !hideTemp)
{ {
//avisa de cerrar la ventana //avisa de cerrar la ventana
OliviaGlob.TipoEjec = TiposEjecucion.Ninguno; OliviaGlob.TipoEjec = TiposEjecucion.Ninguno;

View File

@ -21,12 +21,13 @@ using OliviaAddInPro.Model;
namespace OliviaAddInPro namespace OliviaAddInPro
{ {
internal class DockpaneLimpiezaViewModel : DockPane public class DockpaneLimpiezaViewModel : DockPane
{ {
private bool firstTimeShow = true; private bool firstTimeShow = true;
private static bool hideTemp = false;
private const string _dockPaneID = "OliviaAddInPro_DockpaneLimpieza"; private const string _dockPaneID = "OliviaAddInPro_DockpaneLimpieza";
private PaneLimpiezaViewModel _pane; private PaneLimpiezaViewModel _pane;
protected DockpaneLimpiezaViewModel() public DockpaneLimpiezaViewModel()
{ {
_pane = new PaneLimpiezaViewModel(); _pane = new PaneLimpiezaViewModel();
CurrentPage = _pane; CurrentPage = _pane;
@ -40,7 +41,7 @@ namespace OliviaAddInPro
DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID); DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null) if (pane == null)
return; return;
hideTemp = false;
pane.Activate(); pane.Activate();
} }
@ -49,14 +50,19 @@ namespace OliviaAddInPro
DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID); DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null) if (pane == null)
return; return;
hideTemp = true; //avisa de que solo esconde temporalmente, no para siempre
pane.Hide(); pane.Hide();
} }
internal static void Reset()
{
//HAY QUE HACER QUE SE LIMPIE TODO
}
//The parameter passed to this method will be true if the Dockpane is being opened and it is false when you close the dockpane //The parameter passed to this method will be true if the Dockpane is being opened and it is false when you close the dockpane
protected override void OnShow(bool isVisible) protected override void OnShow(bool isVisible)
{ {
if (isVisible == false && !firstTimeShow) if (isVisible == false && !firstTimeShow && !hideTemp)
{ {
//avisa de cerrar la ventana //avisa de cerrar la ventana
OliviaGlob.TipoEjec = TiposEjecucion.Ninguno; OliviaGlob.TipoEjec = TiposEjecucion.Ninguno;

View File

@ -54,11 +54,15 @@ namespace OliviaAddInPro
{ {
get { return checkSectAuto; } get { return checkSectAuto; }
set { set {
checkSectAuto = value;
if (checkSectAuto) if (checkSectAuto)
EnableNSect = false; EnableNSect = false;
else else
EnableNSect = true; EnableNSect = true;
base.SetProperty(ref checkSectAuto, value, () => CheckSectAuto); } //base.SetProperty(ref checkSectAuto, value, () => CheckSectAuto);
base.NotifyPropertyChanged("CheckSectAuto");
base.NotifyPropertyChanged("EnableNSect");
}
} }
private bool enableNSect; private bool enableNSect;
public bool EnableNSect public bool EnableNSect