2022.6.4.0

Added pause automation
Extended automation information
Updated automation checker
This commit is contained in:
Andy
2022-06-04 02:43:46 +03:00
parent 9e87369c9b
commit fbcda1ae75
10 changed files with 59 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

View File

@@ -142,12 +142,27 @@ Namespace DownloadObjects
Private Const Name_ShowNotifications As String = "Notify"
#End Region
#Region "Declarations"
Friend Property Mode As Modes = Modes.None
Private _Mode As Modes = Modes.None
Friend Property Mode As Modes
Get
Return _Mode
End Get
Set(ByVal m As Modes)
_Mode = m
If _Mode = Modes.None Then [Stop]()
End Set
End Property
Friend ReadOnly Property Groups As List(Of String)
Friend Property Timer As Integer = DefaultTimer
Friend Property ShowNotifications As Boolean = True
Friend Property LastDownloadDate As Date = Now.AddYears(-1)
Private ReadOnly DateProvider As New ADateTime(ADateTime.Formats.BaseDateTime)
Friend ReadOnly Property Information As String
Get
Return $"Last download date: {LastDownloadDate.ToStringDate(ADateTime.Formats.BaseDateTime)} " &
$"({IIf(Working, "working", "stopped")}{IIf(Working And Pause, ", paused", String.Empty)})"
End Get
End Property
Private File As SFile = $"Settings\AutoDownload.xml"
Private AThread As Thread
#End Region
@@ -207,6 +222,11 @@ Namespace DownloadObjects
End Sub
#End Region
#Region "Execution"
Private ReadOnly Property Working As Boolean
Get
Return If(AThread?.IsAlive, False)
End Get
End Property
Friend Sub Start()
If Not If(AThread?.IsAlive, False) And Not Mode = Modes.None Then
AThread = New Thread(New ThreadStart(AddressOf Checker))
@@ -215,13 +235,14 @@ Namespace DownloadObjects
End If
End Sub
Private _StopRequested As Boolean = False
Friend Property Pause As Boolean = False
Friend Sub [Stop]()
If If(AThread?.IsAlive, False) Then _StopRequested = True
If Working Then _StopRequested = True
End Sub
Private Sub Checker()
Try
While Not _StopRequested
If LastDownloadDate.AddMinutes(Timer) < Now And Not Downloader.Working Then Download()
While Not _StopRequested Or Downloader.Working
If LastDownloadDate.AddMinutes(Timer) < Now And Not Downloader.Working And Not Pause And Not _StopRequested Then Download()
Thread.Sleep(500)
End While
Catch ex As Exception

View File

@@ -57,7 +57,7 @@ Namespace DownloadObjects
'CONTAINER_MAIN.ContentPanel
'
CONTAINER_MAIN.ContentPanel.Controls.Add(Me.DEF_GROUP)
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(476, 217)
CONTAINER_MAIN.ContentPanel.Size = New System.Drawing.Size(476, 242)
CONTAINER_MAIN.Dock = System.Windows.Forms.DockStyle.Fill
CONTAINER_MAIN.LeftToolStripPanelVisible = False
CONTAINER_MAIN.Location = New System.Drawing.Point(0, 0)
@@ -90,7 +90,7 @@ Namespace DownloadObjects
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25.0!))
Me.DEF_GROUP.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.DEF_GROUP.Size = New System.Drawing.Size(476, 217)
Me.DEF_GROUP.Size = New System.Drawing.Size(476, 242)
Me.DEF_GROUP.TabIndex = 0
'
'TXT_GROUPS
@@ -244,6 +244,7 @@ Namespace DownloadObjects
Me.Controls.Add(CONTAINER_MAIN)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.KeyPreview = True
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(492, 281)
Me.MinimizeBox = False

View File

@@ -61,7 +61,7 @@ Namespace DownloadObjects
If Settings.Groups.Count = 0 Then TXT_GROUPS.Clear() : TXT_GROUPS.Enabled = False
CH_NOTIFY.Checked = .ShowNotifications
TXT_TIMER.Text = .Timer
LBL_LAST_TIME_UP.Text &= .LastDownloadDate.ToStringDate(ADateTime.Formats.BaseDateTime)
LBL_LAST_TIME_UP.Text = .Information
End With
If Not IsControlForm Then
.MyFieldsChecker = New FieldsChecker

View File

@@ -104,6 +104,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
Me.BTT_TRAY_SHOW_HIDE = New System.Windows.Forms.ToolStripMenuItem()
Me.BTT_TRAY_CLOSE = New System.Windows.Forms.ToolStripMenuItem()
Me.BTT_TRAY_CLOSE_NO_SCRIPT = New System.Windows.Forms.ToolStripMenuItem()
Me.BTT_DOWN_AUTOMATION_PAUSE = New System.Windows.Forms.ToolStripMenuItem()
SEP_1 = New System.Windows.Forms.ToolStripSeparator()
SEP_2 = New System.Windows.Forms.ToolStripSeparator()
CONTEXT_SEP_1 = New System.Windows.Forms.ToolStripSeparator()
@@ -312,7 +313,7 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
'MENU_DOWN_ALL
'
Me.MENU_DOWN_ALL.AutoToolTip = False
Me.MENU_DOWN_ALL.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_DOWN_ALL, Me.BTT_DOWN_SITE, MENU_DOWN_ALL_SEP_1, Me.BTT_DOWN_ALL_FULL, Me.BTT_DOWN_SITE_FULL, MENU_DOWN_ALL_SEP_2, Me.BTT_ADD_NEW_GROUP, MENU_DOWN_ALL_SEP_3, Me.BTT_DOWN_AUTOMATION})
Me.MENU_DOWN_ALL.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BTT_DOWN_ALL, Me.BTT_DOWN_SITE, MENU_DOWN_ALL_SEP_1, Me.BTT_DOWN_ALL_FULL, Me.BTT_DOWN_SITE_FULL, MENU_DOWN_ALL_SEP_2, Me.BTT_ADD_NEW_GROUP, MENU_DOWN_ALL_SEP_3, Me.BTT_DOWN_AUTOMATION, Me.BTT_DOWN_AUTOMATION_PAUSE})
Me.MENU_DOWN_ALL.Image = Global.SCrawler.My.Resources.Resources.StartPic_01_Green_16
Me.MENU_DOWN_ALL.ImageTransparentColor = System.Drawing.Color.Magenta
Me.MENU_DOWN_ALL.Name = "MENU_DOWN_ALL"
@@ -765,6 +766,13 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
Me.BTT_TRAY_CLOSE_NO_SCRIPT.ToolTipText = "Close the program without executing the script"
Me.BTT_TRAY_CLOSE_NO_SCRIPT.Visible = False
'
'BTT_DOWN_AUTOMATION_PAUSE
'
Me.BTT_DOWN_AUTOMATION_PAUSE.Image = Global.SCrawler.My.Resources.Resources.Pause_Blue_16
Me.BTT_DOWN_AUTOMATION_PAUSE.Name = "BTT_DOWN_AUTOMATION_PAUSE"
Me.BTT_DOWN_AUTOMATION_PAUSE.Size = New System.Drawing.Size(231, 22)
Me.BTT_DOWN_AUTOMATION_PAUSE.Text = "Pause automation"
'
'MainFrame
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -860,4 +868,5 @@ Partial Public Class MainFrame : Inherits System.Windows.Forms.Form
Friend WithEvents BTT_TRAY_CLOSE_NO_SCRIPT As ToolStripMenuItem
Friend WithEvents TRAY_CONTEXT As ContextMenuStrip
Private WithEvents BTT_DOWN_AUTOMATION As ToolStripMenuItem
Private WithEvents BTT_DOWN_AUTOMATION_PAUSE As ToolStripMenuItem
End Class

View File

@@ -430,6 +430,10 @@ CloseResume:
If f.DialogResult = DialogResult.OK AndAlso Not Settings.Automation.Mode = AutoDownloader.Modes.None Then Settings.Automation.Start()
End Using
End Sub
Private Sub BTT_DOWN_AUTOMATION_PAUSE_Click(sender As Object, e As EventArgs) Handles BTT_DOWN_AUTOMATION_PAUSE.Click
Settings.Automation.Pause = Not Settings.Automation.Pause
BTT_DOWN_AUTOMATION_PAUSE.Checked = Settings.Automation.Pause
End Sub
Private Sub BTT_DOWN_VIDEO_Click(sender As Object, e As EventArgs) Handles BTT_DOWN_VIDEO.Click
DownloadVideoByURL()
End Sub

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2022.6.3.0")>
<Assembly: AssemblyFileVersion("2022.6.3.0")>
<Assembly: AssemblyVersion("2022.6.4.0")>
<Assembly: AssemblyFileVersion("2022.6.4.0")>
<Assembly: NeutralResourcesLanguage("en")>

View File

@@ -170,6 +170,16 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property Pause_Blue_16() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("Pause_Blue_16", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>

View File

@@ -196,4 +196,7 @@
<data name="GroupBy_284" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Content\Icons\GroupBy_284.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Pause_Blue_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Content\Pictures\Pause_Blue_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -410,6 +410,7 @@
<None Include="Content\Pictures\HeartPic_32.png" />
<None Include="Content\Pictures\ScriptPic32.png" />
<None Include="Content\Icons\GroupBy_284.ico" />
<None Include="Content\Pictures\Pause_Blue_16.png" />
<Content Include="ffmpeg.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>