Changing WorkingHours

This commit is contained in:
Digital Data - Marlon Schreiber 2017-11-09 11:30:52 +01:00
parent f8bf313d71
commit 0574ac1682
4 changed files with 36 additions and 5 deletions

View File

@ -1,7 +1,7 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' Dieser Code wurde von einem Tool generiert. ' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.36366 ' Laufzeitversion:4.0.30319.42000
' '
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird. ' der Code erneut generiert wird.
@ -15,21 +15,21 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "Funktion zum automatischen Speichern von My.Settings" #Region "Automatische My.Settings-Speicherfunktion"
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then If My.Application.SaveMySettingsOnExit Then
My.Settings.Save() My.Settings.Save()
End If End If
@ -898,6 +898,15 @@ Namespace My
Return CType(Me("Sleep_End"),String) Return CType(Me("Sleep_End"),String)
End Get End Get
End Property End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("16;17;18;19;20")> _
Public ReadOnly Property NI_WORKING_HOURS() As String
Get
Return CType(Me("NI_WORKING_HOURS"),String)
End Get
End Property
End Class End Class
End Namespace End Namespace

View File

@ -233,5 +233,8 @@
<Setting Name="Sleep_End" Type="System.String" Scope="Application"> <Setting Name="Sleep_End" Type="System.String" Scope="Application">
<Value Profile="(Default)">0</Value> <Value Profile="(Default)">0</Value>
</Setting> </Setting>
<Setting Name="NI_WORKING_HOURS" Type="System.String" Scope="Application">
<Value Profile="(Default)">16;17;18;19;20</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -249,6 +249,9 @@
<setting name="Sleep_End" serializeAs="String"> <setting name="Sleep_End" serializeAs="String">
<value>0</value> <value>0</value>
</setting> </setting>
<setting name="NI_WORKING_HOURS" serializeAs="String">
<value>16;17;18;19;20</value>
</setting>
</ToolCollection.My.MySettings> </ToolCollection.My.MySettings>
</applicationSettings> </applicationSettings>
<startup> <startup>

View File

@ -531,11 +531,27 @@ Public Class frmNIHauptseite
ClassLoggerNI.Add(" ", False) ClassLoggerNI.Add(" ", False)
If My.Settings.Sleep_Begin > 0 And My.Settings.Sleep_End > 0 Then If My.Settings.Sleep_Begin > 0 And My.Settings.Sleep_End > 0 Then
If Now.Hour >= CInt(My.Settings.Sleep_Begin) And Now.Hour <= CInt(My.Settings.Sleep_End) Then If Now.Hour >= CInt(My.Settings.Sleep_Begin) And Now.Hour <= CInt(My.Settings.Sleep_End) Then
clsLogger.Add(String.Format(">> ToolCollection is in SleepMode - {0}-{1}-{2}", Now.Hour.ToString, My.Settings.Sleep_Begin.ToString, My.Settings.Sleep_End.ToString), False) ClassLoggerNI.Add(String.Format(">> ToolCollection is in SleepMode - {0}-{1}-{2}", Now.Hour.ToString, My.Settings.Sleep_Begin.ToString, My.Settings.Sleep_End.ToString), False)
lblStatus.Text = "In SleepMode" lblStatus.Text = "In SleepMode"
Exit Sub Exit Sub
End If End If
End If End If
Dim IsWorking_Hour = False
If My.Settings.NI_WORKING_HOURS <> "" Then
Dim hourarray As String() = My.Settings.NI_WORKING_HOURS.Split(";")
For Each _hour As String In hourarray
If Now.Hour = _hour Then
IsWorking_Hour = True
End If
Next
If IsWorking_Hour = False Then
ClassLoggerNI.Add(String.Format(">> ToolCollection is not in WorkingMode - NowHour: {0} - Working hours are: {1}", Now.Hour.ToString, My.Settings.NI_WORKING_HOURS), False)
lblStatus.Text = "No Working-Hour - Working hours are: " & My.Settings.NI_WORKING_HOURS
Exit Sub
End If
Else
IsWorking_Hour = True
End If
If _windreamNI.Init() = False Then If _windreamNI.Init() = False Then
email.Send_EMail("Die Windream-Klasse konnte nicht initialisiert werden. Windream-Client unvollständig gestartert.") email.Send_EMail("Die Windream-Klasse konnte nicht initialisiert werden. Windream-Client unvollständig gestartert.")
MsgBox("Die Windream-Klasse konnte nicht initialisiert werden. Windream-Client unvollständig gestartert.", MsgBoxStyle.Critical) MsgBox("Die Windream-Klasse konnte nicht initialisiert werden. Windream-Client unvollständig gestartert.", MsgBoxStyle.Critical)