diff --git a/View/PaneLimpiezaSub4.xaml b/View/PaneLimpiezaSub4.xaml
index ac24e9e..2623489 100644
--- a/View/PaneLimpiezaSub4.xaml
+++ b/View/PaneLimpiezaSub4.xaml
@@ -24,7 +24,7 @@
-
+
@@ -32,7 +32,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
@@ -57,7 +57,7 @@
-
+
@@ -65,7 +65,7 @@
-
+
diff --git a/ViewModel/PaneLimpiezaSub4ViewModel.cs b/ViewModel/PaneLimpiezaSub4ViewModel.cs
index f294557..30d8e78 100644
--- a/ViewModel/PaneLimpiezaSub4ViewModel.cs
+++ b/ViewModel/PaneLimpiezaSub4ViewModel.cs
@@ -39,26 +39,38 @@ namespace OliviaAddInPro
//en minutos
private int timeCargDesc;
- public string TimeCargDesc
+ public DateTime TimeCargDesc
{
- get { return PanelGlobal.Hm_int2str(timeCargDesc); }
- set { base.SetProperty(ref timeCargDesc, PanelGlobal.Hm_str2int(value), () => TimeCargDesc); }
+ get { return PanelGlobal.Hm_int2DateTime(timeCargDesc); }
+ set
+ {
+ timeCargDesc = PanelGlobal.Hm_DateTime2int(value);
+ base.NotifyPropertyChanged("TimeCargDesc");
+ }
}
//en minutos
private int timeDespIniFin;
- public int TimeDespIniFin
+ public DateTime TimeDespIniFin
{
- get { return timeDespIniFin; }
- set { base.SetProperty(ref timeDespIniFin, value, () => TimeDespIniFin); }
+ get { return PanelGlobal.Hm_int2DateTime(timeDespIniFin); }
+ set
+ {
+ timeDespIniFin = PanelGlobal.Hm_DateTime2int(value);
+ base.NotifyPropertyChanged("TimeDespIniFin");
+ }
}
//en minutos desde las 00 horas
private int timeIniJornada;
- public int TimeIniJornada
+ public DateTime TimeIniJornada
{
- get { return timeIniJornada; }
- set { base.SetProperty(ref timeIniJornada, value, () => TimeIniJornada); }
+ get { return PanelGlobal.Hm_int2DateTime(timeIniJornada); }
+ set
+ {
+ timeIniJornada = PanelGlobal.Hm_DateTime2int(value);
+ base.NotifyPropertyChanged("TimeIniJornada");
+ }
}
//Tráfico, de 0 a 100
@@ -71,18 +83,26 @@ namespace OliviaAddInPro
//en minutos desde las 00 horas
private int timeJornadaConv;
- public int TimeJornadaConv
+ public DateTime TimeJornadaConv
{
- get { return timeJornadaConv; }
- set { base.SetProperty(ref timeJornadaConv, value, () => TimeJornadaConv); }
+ get { return PanelGlobal.Hm_int2DateTime(timeJornadaConv); }
+ set
+ {
+ timeJornadaConv = PanelGlobal.Hm_DateTime2int(value);
+ base.NotifyPropertyChanged("TimeJornadaConv");
+ }
}
//en minutos
private int timeDescPers;
- public int TimeDescPers
+ public DateTime TimeDescPers
{
- get { return timeDescPers; }
- set { base.SetProperty(ref timeDescPers, value, () => TimeDescPers); }
+ get { return PanelGlobal.Hm_int2DateTime(timeDescPers); }
+ set
+ {
+ timeDescPers = PanelGlobal.Hm_DateTime2int(value);
+ base.NotifyPropertyChanged("TimeDescPers");
+ }
}
#endregion Properties
diff --git a/ViewModel/PanelViewModelBase.cs b/ViewModel/PanelViewModelBase.cs
index 769df33..4e624ec 100644
--- a/ViewModel/PanelViewModelBase.cs
+++ b/ViewModel/PanelViewModelBase.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Text.RegularExpressions;
namespace OliviaAddInPro
{
@@ -30,20 +31,49 @@ namespace OliviaAddInPro
/**
* Dado un tiempo en minutos devuelve las horas modulo 60 y los minutos restantes
*/
- public static string Hm_int2str(double t)
+ /*public static string Hm_int2str(double t)
{
int[] hm = { 0, 0 };
hm[0] = (int)(t / 60);
hm[1] = (int)(t - hm[0] * 60);
- return String.Format("%dd:%dd",hm[0], hm[1]);
+ return String.Format("%dd h %dd m", hm[0], hm[1]);
}
public static int Hm_str2int(string hm)
{
- int t=0;
-
+ int h = 0;
+ int m = 0;
+ int t = 0;
+ Match match = Regex.Match(hm, "^([0-9]+).([0-9]+).([0-9]+) ([0-9]+):([0-9]+):([0-9]+)");
+
+ if (match.Success)
+ {
+ h = int.Parse(match.Groups[4].Value);
+ m = int.Parse(match.Groups[5].Value);
+ t = h * 60 + m;
+ }
+ return t;
+ }*/
+ public static DateTime Hm_int2DateTime(double t)
+ {
+ int[] hm = { 0, 0 };
+
+ hm[0] = (int)(t / 60);
+ hm[1] = (int)(t - hm[0] * 60);
+ DateTime dt=new DateTime(2021, 01, 01, hm[0], hm[1], 0);
+ return dt;
+ }
+ public static int Hm_DateTime2int(DateTime dt)
+ {
+ int h = 0;
+ int m = 0;
+ int t = 0;
+
+ h = dt.Hour;
+ m = dt.Minute;
+ t = h * 60 + m;
return t;
}
}