Cambios TareaRes ->Respuesta
parent
472beaae01
commit
bf95769ffd
|
|
@ -31,11 +31,5 @@ namespace OliviaAddInPro.Model
|
||||||
public static string atr_pedes; //<Atributo del campo FOW que indica peatonal
|
public static string atr_pedes; //<Atributo del campo FOW que indica peatonal
|
||||||
};
|
};
|
||||||
|
|
||||||
public class TareaRes
|
|
||||||
{
|
|
||||||
public bool Errores { get; set; }
|
|
||||||
public object data { get; set; }
|
|
||||||
public string msg { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,41 +47,27 @@ namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
Serv = new LimpiezaServ(this);
|
Serv = new LimpiezaServ(this);
|
||||||
LanzaSrv = new LanzaLimpSrv();
|
LanzaSrv = new LanzaLimpSrv();
|
||||||
ProgrSrc = new MyCancelableProgressorSource(OliviaGlob.progrDialog);
|
|
||||||
ProceSrv = new ProcesoEjecServ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TareaRes Ejecuta(ModosEjec modo)
|
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
|
||||||
{
|
{
|
||||||
TareaRes res = null;
|
Respuesta<bool> res = new Respuesta<bool> { Value=false};
|
||||||
|
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion> (){ Value = TiposEjecucion.FinEjecNOk };
|
||||||
res = Serv.Ejecuta(modo);
|
res = Serv.Ejecuta(modo);
|
||||||
if (!res.Errores)
|
if (res.Value)
|
||||||
{
|
{
|
||||||
var res1=LanzaSrv.ejec(this, modo, TipoTtoStr);
|
res=LanzaSrv.ejec(this, modo, TipoTtoStr);
|
||||||
if (!res1.HasError)
|
if (res.Value)
|
||||||
{
|
{
|
||||||
ProceSrv.ConfigConex();
|
ProceSrv.ConfigConex();
|
||||||
res1 = ProceSrv.start(LanzaSrv.str_cfg, ProgrSrc._ProgrSrc);
|
res2 = ProceSrv.start(LanzaSrv.str_cfg, ProgrSrc._ProgrSrc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (res1.HasError)
|
if (res.HasError)
|
||||||
{
|
{
|
||||||
res.Errores = true;
|
res2.Error.AddRange(res.Error);
|
||||||
res.msg = "";
|
|
||||||
res1.Error.ForEach(e=> res.msg+=e+".\n ");
|
|
||||||
}
|
}
|
||||||
}
|
return res2;
|
||||||
return res;
|
|
||||||
}
|
|
||||||
public async void EjecutaAsync(ModosEjec modo, Action<TareaRes> ffin)
|
|
||||||
{
|
|
||||||
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
|
||||||
{
|
|
||||||
var res = Ejecuta(modo);
|
|
||||||
ffin(res);
|
|
||||||
return res;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ using OliviaAddInPro.Helper;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace OliviaAddInPro.Model
|
namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
|
|
@ -307,36 +306,6 @@ namespace OliviaAddInPro.Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void finEjecuta(OliviaAddInPro.Model.ComunDef.TareaRes res)
|
|
||||||
{
|
|
||||||
progrDialog.Hide();
|
|
||||||
|
|
||||||
if (res.Errores)
|
|
||||||
{
|
|
||||||
HelperGlobal.ponMsg(res.msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HelperGlobal.ponMsg(Resource1.String_exito);
|
|
||||||
}
|
|
||||||
Application.Current.Dispatcher.Invoke(new Action(() => { finEjecuta2(); }));
|
|
||||||
//tiene que hacer delegate finEjecuta2()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void finEjecuta2()
|
|
||||||
{
|
|
||||||
//muestra la ventana
|
|
||||||
ShowHidePane(true);
|
|
||||||
|
|
||||||
//importa resultados
|
|
||||||
|
|
||||||
//borra los archivos que le toca borrar
|
|
||||||
//hay una funcion borrafiles en EjecServ, usar esa?
|
|
||||||
//pone modo config2
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inicializa los nombres por defecto de las variables, para debug por si no hay instalador
|
* Inicializa los nombres por defecto de las variables, para debug por si no hay instalador
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -75,44 +75,27 @@ namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
Serv = new RecogidaServ(this);
|
Serv = new RecogidaServ(this);
|
||||||
LanzaSrv = new LanzaRecoSrv();
|
LanzaSrv = new LanzaRecoSrv();
|
||||||
ProgrSrc = new MyCancelableProgressorSource(OliviaGlob.progrDialog);
|
|
||||||
ProceSrv = new ProcesoEjecServ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
|
||||||
public TareaRes Ejecuta(ModosEjec modo)
|
|
||||||
{
|
{
|
||||||
TareaRes res = null;
|
Respuesta<bool> res = new Respuesta<bool> { Value = false };
|
||||||
|
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion>() { Value = TiposEjecucion.FinEjecNOk };
|
||||||
res = Serv.Ejecuta(modo);
|
res = Serv.Ejecuta(modo);
|
||||||
if (!res.Errores)
|
if (res.Value)
|
||||||
{
|
{
|
||||||
var res1 = LanzaSrv.ejec(this, modo, TipoTtoStr);
|
res = LanzaSrv.ejec(this, modo, TipoTtoStr);
|
||||||
if (!res1.HasError)
|
if (res.Value)
|
||||||
{
|
{
|
||||||
ProceSrv.ConfigConex();
|
ProceSrv.ConfigConex();
|
||||||
res1 = ProceSrv.start(LanzaSrv.str_cfg, ProgrSrc._ProgrSrc);
|
res2 = ProceSrv.start(LanzaSrv.str_cfg, ProgrSrc._ProgrSrc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (res1.HasError)
|
if (res.HasError)
|
||||||
{
|
{
|
||||||
res.Errores = true;
|
res2.Error.AddRange(res.Error);
|
||||||
res.msg = "";
|
|
||||||
res1.Error.ForEach(e => res.msg += e + ".\n ");
|
|
||||||
}
|
}
|
||||||
}
|
return res2;
|
||||||
return res;
|
|
||||||
|
|
||||||
}
|
|
||||||
public async void EjecutaAsync(ModosEjec modo, Action<TareaRes> ffin)
|
|
||||||
{
|
|
||||||
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
|
||||||
{
|
|
||||||
var res = Ejecuta(modo);
|
|
||||||
ffin(res);
|
|
||||||
return res;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using ArcGIS.Core.Geometry;
|
||||||
using ArcGIS.Desktop.Internal.Layouts.Utilities;
|
using ArcGIS.Desktop.Internal.Layouts.Utilities;
|
||||||
using OliviaAddInPro.Helper;
|
using OliviaAddInPro.Helper;
|
||||||
using OliviaAddInPro.Services;
|
using OliviaAddInPro.Services;
|
||||||
|
using static OliviaAddInPro.Model.ComunDef;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Model
|
namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
|
|
@ -117,21 +118,55 @@ namespace OliviaAddInPro.Model
|
||||||
private string err_str = string.Empty;
|
private string err_str = string.Empty;
|
||||||
public string ErrStr
|
public string ErrStr
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
/*string val = string.Empty;
|
/*string val = string.Empty;
|
||||||
val.CopyFrom(err_str);
|
val.CopyFrom(err_str);
|
||||||
err_str = string.Empty;
|
err_str = string.Empty;
|
||||||
return val; */
|
return val; */
|
||||||
return err_str;
|
return err_str;
|
||||||
}
|
}
|
||||||
set { err_str = value;}
|
set { err_str = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Para la ventana de progreso
|
* Para la ventana de progreso
|
||||||
*/
|
*/
|
||||||
public MyCancelableProgressorSource ProgrSrc;
|
public MyCancelableProgressorSource ProgrSrc { get; set; } = null;
|
||||||
public ProcesoEjecServ ProceSrv { get; set; } = null;
|
public ProcesoEjecServ ProceSrv { get; set; } = null;
|
||||||
|
public FinProcServ FinProceSrv { get; set; } = null;
|
||||||
|
|
||||||
|
public TratamientoComun()
|
||||||
|
{
|
||||||
|
ProgrSrc = new MyCancelableProgressorSource(OliviaGlob.progrDialog);
|
||||||
|
ProceSrv = new ProcesoEjecServ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ComienzaEjec(OliviaAddInPro.Services.ModosEjec modo)
|
||||||
|
{
|
||||||
|
//muestra progreso
|
||||||
|
OliviaGlob.progrDialog.Show();
|
||||||
|
//oculta la ventana
|
||||||
|
OliviaGlob.ShowHidePane(false);
|
||||||
|
//comienza ejecución
|
||||||
|
Action<Respuesta<TiposEjecucion>> ac = FinProceSrv.finEjecuta;
|
||||||
|
EjecutaAsync(modo, ac);
|
||||||
|
}
|
||||||
|
public async void EjecutaAsync(ModosEjec modo, Action<Respuesta<TiposEjecucion>> ffin)
|
||||||
|
{
|
||||||
|
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
var res = Ejecuta(modo);
|
||||||
|
ffin(res);
|
||||||
|
return res;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public virtual Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
|
||||||
|
{
|
||||||
|
Respuesta<TiposEjecucion> res = new Respuesta<TiposEjecucion>() { Value = TiposEjecucion.FinEjecNOk };
|
||||||
|
res.Error.Add("No implementado");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
<Compile Include="Model\OliviaConf.cs" />
|
<Compile Include="Model\OliviaConf.cs" />
|
||||||
<Compile Include="Model\OliviaDef.cs" />
|
<Compile Include="Model\OliviaDef.cs" />
|
||||||
<Compile Include="Services\ConfigServ.cs" />
|
<Compile Include="Services\ConfigServ.cs" />
|
||||||
<Compile Include="Services\ImportaResServ.cs" />
|
<Compile Include="Services\FinProcServ.cs" />
|
||||||
<Compile Include="Services\LanzaSrv\LanzaLimpSrv.cs" />
|
<Compile Include="Services\LanzaSrv\LanzaLimpSrv.cs" />
|
||||||
<Compile Include="Services\LanzaSrv\LanzaOlvServ.cs" />
|
<Compile Include="Services\LanzaSrv\LanzaOlvServ.cs" />
|
||||||
<Compile Include="Services\LanzaSrv\LanzaRecoSrv.cs" />
|
<Compile Include="Services\LanzaSrv\LanzaRecoSrv.cs" />
|
||||||
|
|
|
||||||
|
|
@ -333,44 +333,5 @@ namespace OliviaAddInPro.Services
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Borra los archivos exportados para el proceso
|
|
||||||
*/
|
|
||||||
public static void BorraFiles()
|
|
||||||
{
|
|
||||||
string[] list = null;
|
|
||||||
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
|
|
||||||
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (capa_principal == null)
|
|
||||||
return;
|
|
||||||
list = System.IO.Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal + "*");
|
|
||||||
if (list.Length > 0)
|
|
||||||
{
|
|
||||||
foreach (string f in list)
|
|
||||||
{
|
|
||||||
if (System.IO.Path.GetExtension(f) == ".lock")
|
|
||||||
continue;
|
|
||||||
System.IO.File.Delete(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (capa_principal_nw == null)
|
|
||||||
return;
|
|
||||||
list = System.IO.Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal_nw + "*");
|
|
||||||
if (list.Length > 0)
|
|
||||||
{
|
|
||||||
foreach (string f in list)
|
|
||||||
{
|
|
||||||
System.IO.File.Delete(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.IO;
|
||||||
|
using OliviaAddInPro.Model;
|
||||||
|
using OliviaAddInPro.Helper;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace OliviaAddInPro.Services
|
||||||
|
{
|
||||||
|
public class FinProcServ
|
||||||
|
{
|
||||||
|
public void finEjecuta(Respuesta<TiposEjecucion> res)
|
||||||
|
{
|
||||||
|
OliviaGlob.progrDialog.Hide();
|
||||||
|
|
||||||
|
//gestiona los flags, el estado de finok o finnok va en res.Vale
|
||||||
|
if (res.HasError)
|
||||||
|
{
|
||||||
|
HelperGlobal.ponMsg(res.Error.First());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HelperGlobal.ponMsg(Resource1.String_exito);
|
||||||
|
}
|
||||||
|
Application.Current.Dispatcher.Invoke(new Action(() => { finEjecuta2(); }));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void finEjecuta2()
|
||||||
|
{
|
||||||
|
//muestra la ventana
|
||||||
|
OliviaGlob.ShowHidePane(true);
|
||||||
|
|
||||||
|
//importa resultados
|
||||||
|
|
||||||
|
//borra los archivos que le toca borrar
|
||||||
|
//hay una funcion borrafiles en EjecServ, usar esa?
|
||||||
|
//pone modo config2
|
||||||
|
}
|
||||||
|
|
||||||
|
//se le llama cuando ha terminado el proceso de ejecución en Olivia Tasks
|
||||||
|
//puede haber ido bien, haberse cancelado, etc. En función de ello se realizan
|
||||||
|
//unas tareas u otras
|
||||||
|
public void FinProceso()
|
||||||
|
{
|
||||||
|
bool mal = true;
|
||||||
|
string err = "";
|
||||||
|
|
||||||
|
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.FinEjecOk)) //ha terminado bien
|
||||||
|
{
|
||||||
|
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización
|
||||||
|
{
|
||||||
|
/*if (gdb.import_secto_ini())
|
||||||
|
{
|
||||||
|
mal = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mal = true;
|
||||||
|
err = gdb.err_st;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
|
||||||
|
{
|
||||||
|
/*guarda_csv();
|
||||||
|
if (gdb.import_planif())
|
||||||
|
{
|
||||||
|
mal = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mal = true;
|
||||||
|
err = gdb.err_st;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
//actualiza los flags
|
||||||
|
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
|
||||||
|
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
|
||||||
|
}
|
||||||
|
else if(OliviaGlob.HasFlagTipEjec(TiposEjecucion.FinEjecNOk)) //ha habido error
|
||||||
|
{
|
||||||
|
/*mal = true;
|
||||||
|
err = progr_eje.err_str;*/
|
||||||
|
//actualiza los flags
|
||||||
|
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecNOk);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mal)
|
||||||
|
{
|
||||||
|
HelperGlobal.ponMsg(err, System.Windows.MessageBoxImage.Error);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OliviaGlob.ShowHidePane(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Borra los archivos exportados para el proceso
|
||||||
|
*/
|
||||||
|
public static void BorraFiles()
|
||||||
|
{
|
||||||
|
string[] list = null;
|
||||||
|
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
|
||||||
|
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (capa_principal == null)
|
||||||
|
return;
|
||||||
|
list = System.IO.Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal + "*");
|
||||||
|
if (list.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (string f in list)
|
||||||
|
{
|
||||||
|
if (System.IO.Path.GetExtension(f) == ".lock")
|
||||||
|
continue;
|
||||||
|
System.IO.File.Delete(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (capa_principal_nw == null)
|
||||||
|
return;
|
||||||
|
list = System.IO.Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal_nw + "*");
|
||||||
|
if (list.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (string f in list)
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.IO;
|
|
||||||
using OliviaAddInPro.Model;
|
|
||||||
using OliviaAddInPro.Helper;
|
|
||||||
|
|
||||||
namespace OliviaAddInPro.Services
|
|
||||||
{
|
|
||||||
class ImportaResServ
|
|
||||||
{
|
|
||||||
//se le llama cuando ha terminado el proceso de ejecución en Olivia Tasks
|
|
||||||
//puede haber ido bien, haberse cancelado, etc. En función de ello se realizan
|
|
||||||
//unas tareas u otras
|
|
||||||
public void FinProceso()
|
|
||||||
{
|
|
||||||
bool mal = true;
|
|
||||||
string err = "";
|
|
||||||
|
|
||||||
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.FinEjecOk)) //ha terminado bien
|
|
||||||
{
|
|
||||||
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización
|
|
||||||
{
|
|
||||||
/*if (gdb.import_secto_ini())
|
|
||||||
{
|
|
||||||
mal = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mal = true;
|
|
||||||
err = gdb.err_st;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
|
|
||||||
{
|
|
||||||
/*guarda_csv();
|
|
||||||
if (gdb.import_planif())
|
|
||||||
{
|
|
||||||
mal = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mal = true;
|
|
||||||
err = gdb.err_st;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
//actualiza los flags
|
|
||||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
|
|
||||||
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
|
|
||||||
}
|
|
||||||
else if(OliviaGlob.HasFlagTipEjec(TiposEjecucion.FinEjecNOk)) //ha habido error
|
|
||||||
{
|
|
||||||
/*mal = true;
|
|
||||||
err = progr_eje.err_str;*/
|
|
||||||
//actualiza los flags
|
|
||||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecNOk);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mal)
|
|
||||||
{
|
|
||||||
HelperGlobal.ponMsg(err, System.Windows.MessageBoxImage.Error);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
OliviaGlob.ShowHidePane(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,13 +27,11 @@ namespace OliviaAddInPro.Services
|
||||||
* Modo 0, sectorizar
|
* Modo 0, sectorizar
|
||||||
* Modo 1, planificar
|
* Modo 1, planificar
|
||||||
*/
|
*/
|
||||||
public TareaRes Ejecuta(ModosEjec modo)
|
public Respuesta<bool> Ejecuta(ModosEjec modo)
|
||||||
{
|
{
|
||||||
var res = new TareaRes()
|
var res = new Respuesta<bool>()
|
||||||
{
|
{
|
||||||
Errores = false,
|
Value = false
|
||||||
data = null,
|
|
||||||
msg = ""
|
|
||||||
};
|
};
|
||||||
MyCancelableProgressorSource cps = limp.ProgrSrc;
|
MyCancelableProgressorSource cps = limp.ProgrSrc;
|
||||||
|
|
||||||
|
|
@ -43,8 +41,7 @@ namespace OliviaAddInPro.Services
|
||||||
ErrStr = string.Empty;
|
ErrStr = string.Empty;
|
||||||
if (!PreparaConsulta(out nombFileAmbs))
|
if (!PreparaConsulta(out nombFileAmbs))
|
||||||
{
|
{
|
||||||
res.msg= "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs;
|
res.Error.Add("No se ha seleccionado una consulta válida" + limp.ConsultaAmbs);
|
||||||
res.Errores = true;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,11 +52,10 @@ namespace OliviaAddInPro.Services
|
||||||
//comienza ejecucion
|
//comienza ejecucion
|
||||||
if(!ExportaEjec(modo, out msg))
|
if(!ExportaEjec(modo, out msg))
|
||||||
{
|
{
|
||||||
res.Errores = true;
|
res.Error.Add(msg);
|
||||||
res.msg = msg;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
res.Value = true;
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace OliviaAddInPro.Services
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public Respuesta<bool> start(string cfg, CancelableProgressorSource cps)
|
public Respuesta<TiposEjecucion> start(string cfg, CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
this.cps = cps;
|
this.cps = cps;
|
||||||
soc = new Cstr_socket();
|
soc = new Cstr_socket();
|
||||||
|
|
@ -63,7 +63,7 @@ namespace OliviaAddInPro.Services
|
||||||
};*/
|
};*/
|
||||||
return run();
|
return run();
|
||||||
}
|
}
|
||||||
private Respuesta<bool> run()
|
private Respuesta<TiposEjecucion> run()
|
||||||
{
|
{
|
||||||
int nint = 0;
|
int nint = 0;
|
||||||
int nint_max = 10;
|
int nint_max = 10;
|
||||||
|
|
@ -71,7 +71,7 @@ namespace OliviaAddInPro.Services
|
||||||
bool first_send_cfg = true;
|
bool first_send_cfg = true;
|
||||||
bool fin = false;
|
bool fin = false;
|
||||||
int lastprog = 0;
|
int lastprog = 0;
|
||||||
var res = new Respuesta<bool>() { Value = false };
|
var res = new Respuesta<TiposEjecucion>() { Value = TiposEjecucion.FinEjecNOk };
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +130,7 @@ namespace OliviaAddInPro.Services
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (!res.HasError)
|
if (!res.HasError)
|
||||||
res.Value = true;
|
res.Value = TiposEjecucion.FinEjecOk;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
//funciones auxiliares----------------------------------------
|
//funciones auxiliares----------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -62,13 +62,11 @@ namespace OliviaAddInPro.Services
|
||||||
* Modo 0, sectorizar
|
* Modo 0, sectorizar
|
||||||
* Modo 1, planificar
|
* Modo 1, planificar
|
||||||
*/
|
*/
|
||||||
public TareaRes Ejecuta(ModosEjec modo)
|
public Respuesta<bool> Ejecuta(ModosEjec modo)
|
||||||
{
|
{
|
||||||
var res = new TareaRes()
|
var res = new Respuesta<bool>()
|
||||||
{
|
{
|
||||||
Errores = false,
|
Value = false
|
||||||
data = null,
|
|
||||||
msg = ""
|
|
||||||
};
|
};
|
||||||
|
|
||||||
com = (TratamientoComun)reco;
|
com = (TratamientoComun)reco;
|
||||||
|
|
@ -79,8 +77,7 @@ namespace OliviaAddInPro.Services
|
||||||
|
|
||||||
if (!PreparaConsulta(out nombFileAmbs))
|
if (!PreparaConsulta(out nombFileAmbs))
|
||||||
{
|
{
|
||||||
res.msg = "No se ha seleccionado una consulta válida" + reco.ConsultaAmbs;
|
res.Error.Add("No se ha seleccionado una consulta válida" + reco.ConsultaAmbs);
|
||||||
res.Errores = true;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,8 +89,7 @@ namespace OliviaAddInPro.Services
|
||||||
//comienza ejecucion
|
//comienza ejecucion
|
||||||
if (!ExportaEjec(modo, out msg))
|
if (!ExportaEjec(modo, out msg))
|
||||||
{
|
{
|
||||||
res.Errores = true;
|
res.Error.Add(msg);
|
||||||
res.msg = msg;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,13 +182,7 @@ namespace OliviaAddInPro
|
||||||
HelperGlobal.ponMsg(err);
|
HelperGlobal.ponMsg(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//muestra progreso
|
OliviaGlob.Limp.ComienzaEjec(modo);
|
||||||
OliviaGlob.progrDialog.Show();
|
|
||||||
//oculta la ventana
|
|
||||||
OliviaGlob.ShowHidePane(false);
|
|
||||||
//comienza ejecución
|
|
||||||
Action<TareaRes> ac = OliviaGlob.finEjecuta;
|
|
||||||
OliviaGlob.Limp.EjecutaAsync(modo, ac);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,13 +230,7 @@ namespace OliviaAddInPro
|
||||||
HelperGlobal.ponMsg(err);
|
HelperGlobal.ponMsg(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//muestra la ventana de progreso
|
OliviaGlob.Reco.ComienzaEjec(modo);
|
||||||
OliviaGlob.progrDialog.Show();
|
|
||||||
//oculta la ventana
|
|
||||||
OliviaGlob.ShowHidePane(false);
|
|
||||||
//comienza ejecución
|
|
||||||
Action<TareaRes> ac = OliviaGlob.finEjecuta;
|
|
||||||
OliviaGlob.Reco.EjecutaAsync(modo, ac);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue