Solucionado TimePickers
parent
34108e7ec3
commit
9327b6cd7e
|
|
@ -24,7 +24,7 @@
|
|||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Carga y Descarga" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=timeCargDesc, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeCargDesc, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Desplazamiento ini/fin" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=timeDespIniFin, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeDespIniFin, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Hora inicio jornada" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=timeIniJornada, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeIniJornada, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Reducción por tráfico (%)" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<TextBox Grid.Column="1" Height="20" Margin="10,8,32,7" PreviewTextInput="TextBox_PreviewTextInput" Text="{Binding Path=TextPercentTrafico, Mode = TwoWay}" TextAlignment="Right" MaxLength="3"/>
|
||||
<TextBox Grid.Column="1" Height="20" Margin="10,8,15,7" PreviewTextInput="TextBox_PreviewTextInput" Text="{Binding Path=TextPercentTrafico, Mode = TwoWay}" TextAlignment="Right" MaxLength="3"/>
|
||||
</Grid>
|
||||
<Label Margin="15,5,0,0" Content="Tiempos del convenio" FontWeight="DemiBold"/>
|
||||
<Grid Margin="0,0,0,0">
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Jornada" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=timeJornadaConv, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeJornadaConv, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Descanso personal" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=timeDescPers, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeDescPers, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue