Permalink
Browse files

Update HomiWpf

Meilleure gestion perte liaison serveur
Correction requete sur widget chart
Ajout du zoom jour/heure sur widget chart
Ajout thermometre (ajout jptools )
Ajout message si url camera erroné
Correction bug sur prise en compte heure serveur (config)
Prise en compte d'une seule décimale widget meteo
  • Loading branch information...
jphomi committed Jul 9, 2017
1 parent 2bf63b8 commit db65d2f4f1656b9c3c725e957588b7ed5552271f
@@ -25,7 +25,8 @@ Public Class uCamera
_mjpeg.ParseStream(New Uri(_URL))
End If
Catch ex As Exception
lbl.Text = "Erreur: " & ex.Message
' lbl.Text = "Erreur: " & ex.Message
AfficheMessageAndLog(FctLog.TypeLog.ERREUR, "Erreur uCamera.URL : " & _URL & vbCr & ex.Message, "Erreur", "uCamera.URL")
lbl.Visibility = Windows.Visibility.Visible
End Try
End Set
@@ -17,7 +17,7 @@
<Label Name="LblMax" Content="##" Foreground="LightGray" MaxWidth="100" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
</StackPanel>

<Label Name="LblTemp" DockPanel.Dock="Right" HorizontalContentAlignment="Center" Foreground=" White" FontSize="24" Content="##°" Width="50"/>
<Label Name="LblTemp" DockPanel.Dock="Right" HorizontalContentAlignment="Center" Foreground=" White" FontSize="24" Content="##.#°" Width="68"/>

</DockPanel >
<StackPanel Orientation="Horizontal" Margin="0,80,0,0">
@@ -35,17 +35,28 @@ Public Class uWMeteo
If x IsNot Nothing Then

LblVille.Content = x.Name
LblTemp.Content = x.TemperatureActuel & "°"
LblMin.Content = "Min: " & x.MinToday & "°"
LblMinJ1.Content = x.MinToday & "°"
LblMinJ2.Content = x.MinJ1 & "°"
LblMinJ3.Content = x.MinJ2 & "°"
LblMinJ4.Content = x.MinJ3 & "°"
LblMax.Content = "Max: " & x.MaxToday & "°"
LblMaxJ1.Content = x.MaxToday & "°"
LblMaxJ2.Content = x.MaxJ1 & "°"
LblMaxJ3.Content = x.MaxJ2 & "°"
LblMaxJ4.Content = x.MaxJ3 & "°"
'LblTemp.Content = x.TemperatureActuel & "°"
LblTemp.Content = Format(Val(x.TemperatureActuel), "#0.0") & "°"
'LblMin.Content = "Min: " & x.MinToday & "°"
LblMin.Content = "Min: " & Format(Val(x.MinToday), "#0.0") & "°"
'LblMinJ1.Content = x.MinToday & "°"
LblMinJ1.Content = Format(Val(x.MinToday), "#0.0") & "°"
'LblMinJ2.Content = x.MinJ1 & "°"
LblMinJ2.Content = Format(Val(x.MinJ1), "#0.0") & "°"
'LblMinJ3.Content = x.MinJ2 & "°"
LblMinJ3.Content = Format(Val(x.MinJ2), "#0.0") & "°"
'LblMinJ4.Content = x.MinJ3 & "°"
LblMinJ4.Content = Format(Val(x.MinJ3), "#0.0") & "°"
'LblMax.Content = "Max: " & x.MaxToday & "°"
LblMax.Content = "Max: " & Format(Val(x.MaxToday), "#0.0") & "°"
'LblMaxJ1.Content = x.MaxToday & "°"
LblMaxJ1.Content = Format(Val(x.MaxToday), "#0.0") & "°"
'LblMaxJ2.Content = x.MaxJ1 & "°"
LblMaxJ2.Content = Format(Val(x.MaxJ1), "#0.0") & "°"
'LblMaxJ3.Content = x.MaxJ2 & "°"
LblMaxJ3.Content = Format(Val(x.MaxJ2), "#0.0") & "°"
'LblMaxJ4.Content = x.MaxJ3 & "°"
LblMaxJ4.Content = Format(Val(x.MaxJ3), "#0.0") & "°"
LblJ1.Content = x.JourToday
LblJ2.Content = x.JourJ1
LblJ3.Content = x.JourJ2
@@ -5,32 +5,37 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
d:DesignHeight="300" Width="460">
<Grid Margin="0,0,-39,0">
<StackPanel >
<StackPanel Orientation="Horizontal" >
<Button Height="40" Margin="2,2,5,2" x:Name="BtnJour" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" >
<Button Height="40" Margin="2,2,5,2" x:Name="BtnJour" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" ToolTip="Affichage par Jour" >
<Image Source="/HoMIWpF;component/Images/calendar-day-512.png" />
</Button>
<Button Height="40" Margin="2,2,5,2" x:Name="BtnMois" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" >
<Image Source="/HoMIWpF;component/Images/calendar-month-512.png" />
<Image Source="/HoMIWpF;component/Images/calendar-month-512.png" ToolTip="Affichage par Mois" />
</Button>
<Button Height="40" Margin="2,2,5,2" x:Name="BtnAnnee" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" >
<Image Source="/HoMIWpF;component/Images/Calendar-year-512.png" />
<Image Source="/HoMIWpF;component/Images/Calendar-year-512.png" ToolTip="Affichage par Année" />
</Button>
<Button Height="40" Margin="20,2,5,2" x:Name="BtnBar" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" >
<Image Source="bar-chart-icon-30633.png" />
<Image Source="/HoMIWpF;component/Images/bar-chart-icon-30633.png" ToolTip="Bar Horizontal" />
</Button>
<Button Height="40" Margin="2,2,5,2" x:Name="BtnColumn" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" >
<Image Source="/HoMIWpF;component/Images/bar_chart.png" />
<Image Source="/HoMIWpF;component/Images/bar_chart.png" ToolTip="Bar Vertical" />
</Button>
<Button Height="40" Margin="2,2,5,2" x:Name="BtnLine" Width="40" VerticalAlignment="Top" Foreground="#FFFFFFFF" Template="{DynamicResource GlassButton}" HorizontalAlignment="Right" >
<Image Source="/HoMIWpF;component/Images/line_chart.png" />
<Image Source="/HoMIWpF;component/Images/line_chart.png" ToolTip="Ligne" />
</Button>
</StackPanel>
<StackPanel Name="StkChart">

</StackPanel>
</StackPanel>
</StackPanel>
<Label Content="Moyenne : " Foreground="Black" VerticalAlignment="Center" Margin="308,8,115,266" />
<ComboBox VerticalAlignment="Center" BorderBrush="White" BorderThickness="2" x:Name="ComboBoxMoyenne" SelectedIndex="1" Margin="370,10,10,268" IsReadOnly="True" Width="82">
<ComboBoxItem Content="Heure" />
<ComboBoxItem Content="Jour" />
</ComboBox>
</Grid>
</UserControl>
@@ -205,29 +205,28 @@ Public Class uChart
Dim datestart As String = String.Empty
Dim dateend As String = String.Empty
Dim myData As New List(Of HoMIDom.HoMIDom.Historisation)

Try

SeriesLine = New SeriesCollection
SeriesColumn = New SeriesCollection
SeriesBar = New SeriesCollection
AxisX = New Axis

Select Case Periode
Select Case Periode
Case Periodes.Jour
datestart = Format(Now.Date, "yyyy/MM/dd") & " 0:0:0"
dateend = Format(Now.Date, "yyyy/MM/dd") & " 23:59:59"
myData = myService.GetHistoDeviceSource(IdSrv, _ID, "Value", datestart, dateend, "HEURE")
datestart = Format(Now.Date, "yyyy-MM-dd") ' & " 0:0:0"
dateend = Format(Now.Date.AddDays(1), "yyyy-MM-dd") ' & " 23:59:59"
myData = myService.GetHistoDeviceSource(IdSrv, _ID, "Value", datestart, dateend, ComboBoxMoyenne.Text) '"HEURE")
Case Periodes.Mois
datestart = Format(Now.Date.AddDays(-31), "yyyy/MM/dd") & " 0:0:0"
dateend = Format(Now.Date, "yyyy/MM/dd") & " 23:59:59"
myData = myService.GetHistoDeviceSource(IdSrv, _ID, "Value", datestart, dateend, "JOUR")
datestart = Format(Now.Date.AddDays(-31), "yyyy-MM-dd") ' & " 0:0:0"
dateend = Format(Now.Date, "yyyy-MM-dd") ' & " 23:59:59"
myData = myService.GetHistoDeviceSource(IdSrv, _ID, "Value", datestart, dateend, ComboBoxMoyenne.Text) '"JOUR")
Case Periodes.Annee
datestart = (Now.Year - 1).ToString & "-" & Now.Month & "-" & Now.Day & " 0:0:0" 'Format(Now.Date.AddYears(-1), "yyyy/MM/dd") & " 0:0:0"
dateend = Format(Now.Date, "yyyy/MM/dd") & " 23:59:59"
datestart = (Now.Year - 1).ToString & "-" & Now.Month & "-" & Now.Day ' & " 0:0:0" 'Format(Now.Date.AddYears(-1), "yyyy/MM/dd") & " 0:0:0"
dateend = Format(Now.Date, "yyyy-MM-dd") ' & " 23:59:59"
myData = myService.GetHistoDeviceSource(IdSrv, _ID, "Value", datestart, dateend, "JOUR")
End Select

''Dim datas As System.Data.DataTable = myService.RequeteSqLHisto(IdSrv, "Select * from historiques where device_id='" & _ID & "'")
''If datas IsNot Nothing Then
'' MessageBox.Show(datas.Rows.Count)
@@ -370,14 +369,23 @@ Public Class uChart
MessageBox.Show("Erreur:" & ex.Message, "Erreur", MessageBoxButton.OK, MessageBoxImage.Error)
End Try
End Sub

Private Sub ComboBoxMoyenne_SelectionChanged(sender As Object, e As RoutedEventArgs) Handles ComboBoxMoyenne.SelectionChanged
Try
If ComboBoxMoyenne.Text = "Jour" Then
ComboBoxMoyenne.Text = "Heure"
Else
ComboBoxMoyenne.Text = "Jour"
End If
GetData()
Redraw()
Catch ex As Exception
MessageBox.Show("Erreur:" & ex.Message, "Erreur", MessageBoxButton.OK, MessageBoxImage.Error)
End Try
End Sub

#End Region



End Class

Public Class Dataclass
Implements INotifyPropertyChanged

@@ -0,0 +1,23 @@
<UserControl x:Class="uThermostat"
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"
mc:Ignorable="d" Width="131" Height="198">
<Grid>
<StackPanel Orientation="Horizontal" Margin="0,0,1,0" >
<ProgressBar x:Name="ProgressBar1" Orientation="Vertical" Width="22" Foreground="Red" SmallChange="10" Margin="22,21,0,0" Height="123" VerticalAlignment="Top" Background="#FF636060" BorderBrush="#FF636060" Value="60" />
<StackPanel Width="60" RenderTransformOrigin="0.842,0.446" Margin="25,21,0,0" >
<Button Template="{DynamicResource GlassButton}" x:Name="BtnUp" Height="67" Margin="12,0,7,0">
<Image Source="/HoMIWpF;component/Images/bullet-fleche-vers-le-haut-32.png" />
</Button>
<Button Template="{DynamicResource GlassButton}" x:Name="BtnDown" Height="67" Margin="12,28,7,20">
<Image Source="/HoMIWpF;component/Images/bullet-fleche-vers-le-bas-32.png" RenderTransformOrigin="0.269,2.923" />
</Button>
</StackPanel>
</StackPanel>
<Image HorizontalAlignment="Left" Height="198" Margin="-12,10,0,0" VerticalAlignment="Top" Width="92" Source="/HoMIWpF;component/Images/thermostat.png" RenderTransformOrigin="-2.781,0.109"/>
<Label Content="20" x:Name="Temp" Height="43" Margin="14,139,0,0" VerticalAlignment="Top" Width="41" RenderTransformOrigin="0.5,0.5" FontSize="24" FontWeight="Bold" Foreground="White" HorizontalAlignment="Left" BorderThickness="0"/>

</Grid>
</UserControl>
Oops, something went wrong.

0 comments on commit db65d2f

Please sign in to comment.