Aggiunto progetto gestione TaskScheduler

This commit is contained in:
Samuele E. Locatelli
2020-03-12 11:27:15 +01:00
parent 334127ab89
commit 149d607ad3
10 changed files with 510 additions and 90 deletions
Vendored
+12 -1
View File
@@ -7,7 +7,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=731']) {
withEnv(['NEXT_BUILD_NUMBER=732']) {
// env.versionNumber = VersionNumber(versionNumberString : '4.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '4.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.versionNumberBeta = VersionNumber(versionNumberString : '4.0.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
@@ -52,6 +52,10 @@ pipeline {
// Reports lib
bat "\"${tool 'MSBuild-15.0'}\" SteamWare.Reports\\SteamWare.Reports.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
SCHEDULER: {
// Reports lib
bat "\"${tool 'MSBuild-15.0'}\" Steamware.Scheduler\\SteamWare.Scheduler.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
failFast: false)
}
}
@@ -109,6 +113,12 @@ pipeline {
// creo package NuGet... con version in modo da fare ANCHE le beta
bat "e:\\nuget.exe pack ${WORKSPACE}\\SteamWare.Reports\\SteamWare.Reports.csproj -properties Configuration=${env.config} -Version ${env.packVers}"
},
SCHEDULER: {
// BUILD Reports lib!
bat "\"${tool 'MSBuild-16.0'}\" SteamWare.Scheduler\\SteamWare.Scheduler.csproj -target:Build /p:Configuration=${env.config} /p:Platform=\"Any CPU\" /p:OutputPath=bin/${env.config} /m"
// creo package NuGet... con version in modo da fare ANCHE le beta
bat "e:\\nuget.exe pack ${WORKSPACE}\\SteamWare.Scheduler\\SteamWare.Scheduler.csproj -properties Configuration=${env.config} -Version ${env.packVers}"
},
failFast: false)
}
else
@@ -128,6 +138,7 @@ pipeline {
bat "e:\\nuget.exe push SteamWare.IO.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted"
bat "e:\\nuget.exe push SteamWare.Logger.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted"
bat "e:\\nuget.exe push SteamWare.Reports.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted"
bat "e:\\nuget.exe push SteamWare.Scheduler.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted"
}
}
}
+28 -14
View File
@@ -9,10 +9,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestBench", "TestBench\Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWare.Reports", "SteamWare.Reports\SteamWare.Reports.csproj", "{1792D70C-D854-415B-ACF1-76BBCB8AC6FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWare.Logger", "..\..\..\VisualStudioProject\SteamWare\SteamWare.Logger\SteamWare.Logger.csproj", "{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWare.IO", "SteamWare.IO\SteamWare.IO.csproj", "{62C5B3CE-B2B7-476A-A600-059CE52DAE14}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWare.Logger", "SteamWare.Logger\SteamWare.Logger.csproj", "{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Steamware.Scheduler", "Steamware.Scheduler\Steamware.Scheduler.csproj", "{8901AFAC-987A-40C9-B730-D1FDE0E5170C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -57,18 +59,6 @@ Global
{1792D70C-D854-415B-ACF1-76BBCB8AC6FE}.Release|Any CPU.Build.0 = Release|Any CPU
{1792D70C-D854-415B-ACF1-76BBCB8AC6FE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1792D70C-D854-415B-ACF1-76BBCB8AC6FE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|.NET.ActiveCfg = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|.NET.Build.0 = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|.NET.ActiveCfg = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|.NET.Build.0 = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Any CPU.Build.0 = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{62C5B3CE-B2B7-476A-A600-059CE52DAE14}.Debug|.NET.ActiveCfg = Debug|Any CPU
{62C5B3CE-B2B7-476A-A600-059CE52DAE14}.Debug|.NET.Build.0 = Debug|Any CPU
{62C5B3CE-B2B7-476A-A600-059CE52DAE14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -81,6 +71,30 @@ Global
{62C5B3CE-B2B7-476A-A600-059CE52DAE14}.Release|Any CPU.Build.0 = Release|Any CPU
{62C5B3CE-B2B7-476A-A600-059CE52DAE14}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{62C5B3CE-B2B7-476A-A600-059CE52DAE14}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|.NET.ActiveCfg = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|.NET.Build.0 = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|.NET.ActiveCfg = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|.NET.Build.0 = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Any CPU.Build.0 = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{97A9F482-C173-4F0F-9F8F-7BB41C59CDD6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Debug|.NET.ActiveCfg = Debug|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Debug|.NET.Build.0 = Debug|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Release|.NET.ActiveCfg = Release|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Release|.NET.Build.0 = Release|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Release|Any CPU.Build.0 = Release|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8901AFAC-987A-40C9-B730-D1FDE0E5170C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("Steamware.Scheduler")]
[assembly: AssemblyDescription("Classi utility gestione Scheduler by Steamware")]
[assembly: AssemblyConfiguration("")]
//[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Steamware.Scheduler")]
//[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("8901afac-987a-40c9-b730-d1fde0e5170c")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
+42
View File
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Threading;
namespace Steamware.Scheduler
{
/// <summary>
/// Classe di gestione Scheduler scadenziabili
/// </summary>
public class SchedulerService
{
private static SchedulerService _instance;
private List<Timer> timers = new List<Timer>();
private SchedulerService() { }
public static SchedulerService Instance => _instance ?? (_instance = new SchedulerService());
public void ScheduleTask(int hour, int min, double intervalInHour, Action task)
{
DateTime now = DateTime.Now;
DateTime firstRun = new DateTime(now.Year, now.Month, now.Day, hour, min, 0, 0);
if (now > firstRun)
{
firstRun = firstRun.AddDays(1);
}
TimeSpan timeToGo = firstRun - now;
if (timeToGo <= TimeSpan.Zero)
{
timeToGo = TimeSpan.Zero;
}
var timer = new Timer(x =>
{
task.Invoke();
}, null, timeToGo, TimeSpan.FromHours(intervalInHour));
timers.Add(timer);
}
}
}
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8901AFAC-987A-40C9-B730-D1FDE0E5170C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Steamware.Scheduler</RootNamespace>
<AssemblyName>Steamware.Scheduler</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SteamWareLib\SteamWare.cs">
<Link>SteamWare.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SchedulerService.cs" />
<Compile Include="TaskScheduler.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+30
View File
@@ -0,0 +1,30 @@
using System;
namespace Steamware.Scheduler
{
public static class TaskScheduler
{
public static void IntervalInSeconds(int hour, int sec, double interval, Action task)
{
interval = interval / 3600;
SchedulerService.Instance.ScheduleTask(hour, sec, interval, task);
}
public static void IntervalInMinutes(int hour, int min, double interval, Action task)
{
interval = interval / 60;
SchedulerService.Instance.ScheduleTask(hour, min, interval, task);
}
public static void IntervalInHours(int hour, int min, double interval, Action task)
{
SchedulerService.Instance.ScheduleTask(hour, min, interval, task);
}
public static void IntervalInDays(int hour, int min, double interval, Action task)
{
interval = interval * 24;
SchedulerService.Instance.ScheduleTask(hour, min, interval, task);
}
}
}
+240 -74
View File
@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblOutMessage = new System.Windows.Forms.Label();
this.chkRecursive = new System.Windows.Forms.CheckBox();
@@ -48,16 +49,30 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.btnResetCdv = new System.Windows.Forms.Button();
this.lblRedCDV = new System.Windows.Forms.Label();
this.btnShowCdv = new System.Windows.Forms.Button();
this.btnResetCdv = new System.Windows.Forms.Button();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.btnStartSched = new System.Windows.Forms.Button();
this.txtOre = new System.Windows.Forms.TextBox();
this.lblOre = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.txtMin = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtSec = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.lblStartTimer = new System.Windows.Forms.Label();
this.lblNextSched = new System.Windows.Forms.Label();
this.lblClock = new System.Windows.Forms.Label();
this.clockTimer = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
@@ -72,11 +87,11 @@
this.groupBox1.Controls.Add(this.txtDestDir);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.txtSourceDir);
this.groupBox1.Location = new System.Drawing.Point(5, 5);
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
this.groupBox1.Location = new System.Drawing.Point(7, 6);
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
this.groupBox1.Size = new System.Drawing.Size(740, 79);
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox1.Size = new System.Drawing.Size(987, 103);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "File IO test";
@@ -84,30 +99,29 @@
// lblOutMessage
//
this.lblOutMessage.AutoSize = true;
this.lblOutMessage.Location = new System.Drawing.Point(13, 50);
this.lblOutMessage.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblOutMessage.Location = new System.Drawing.Point(17, 62);
this.lblOutMessage.Name = "lblOutMessage";
this.lblOutMessage.Size = new System.Drawing.Size(16, 13);
this.lblOutMessage.Size = new System.Drawing.Size(20, 17);
this.lblOutMessage.TabIndex = 7;
this.lblOutMessage.Text = "...";
//
// chkRecursive
//
this.chkRecursive.AutoSize = true;
this.chkRecursive.Location = new System.Drawing.Point(400, 17);
this.chkRecursive.Margin = new System.Windows.Forms.Padding(2);
this.chkRecursive.Location = new System.Drawing.Point(533, 21);
this.chkRecursive.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.chkRecursive.Name = "chkRecursive";
this.chkRecursive.Size = new System.Drawing.Size(69, 17);
this.chkRecursive.Size = new System.Drawing.Size(88, 21);
this.chkRecursive.TabIndex = 6;
this.chkRecursive.Text = "recursive";
this.chkRecursive.UseVisualStyleBackColor = true;
//
// btnCopyAll
//
this.btnCopyAll.Location = new System.Drawing.Point(521, 15);
this.btnCopyAll.Margin = new System.Windows.Forms.Padding(2);
this.btnCopyAll.Location = new System.Drawing.Point(695, 18);
this.btnCopyAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnCopyAll.Name = "btnCopyAll";
this.btnCopyAll.Size = new System.Drawing.Size(56, 19);
this.btnCopyAll.Size = new System.Drawing.Size(75, 23);
this.btnCopyAll.TabIndex = 5;
this.btnCopyAll.Text = "Copy All";
this.btnCopyAll.UseVisualStyleBackColor = true;
@@ -116,54 +130,54 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(226, 20);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Location = new System.Drawing.Point(301, 25);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 13);
this.label2.Size = new System.Drawing.Size(64, 17);
this.label2.TabIndex = 4;
this.label2.Text = "Dest DIR";
//
// txtDestDir
//
this.txtDestDir.Location = new System.Drawing.Point(278, 17);
this.txtDestDir.Margin = new System.Windows.Forms.Padding(2);
this.txtDestDir.Location = new System.Drawing.Point(371, 21);
this.txtDestDir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtDestDir.Name = "txtDestDir";
this.txtDestDir.Size = new System.Drawing.Size(118, 20);
this.txtDestDir.Size = new System.Drawing.Size(156, 22);
this.txtDestDir.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 20);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Location = new System.Drawing.Point(17, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(63, 13);
this.label1.Size = new System.Drawing.Size(80, 17);
this.label1.TabIndex = 2;
this.label1.Text = "Source DIR";
//
// txtSourceDir
//
this.txtSourceDir.Location = new System.Drawing.Point(77, 17);
this.txtSourceDir.Margin = new System.Windows.Forms.Padding(2);
this.txtSourceDir.Location = new System.Drawing.Point(103, 21);
this.txtSourceDir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtSourceDir.Name = "txtSourceDir";
this.txtSourceDir.Size = new System.Drawing.Size(118, 20);
this.txtSourceDir.Size = new System.Drawing.Size(156, 22);
this.txtSourceDir.TabIndex = 1;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 16);
this.label3.Location = new System.Drawing.Point(12, 20);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 13);
this.label3.Size = new System.Drawing.Size(79, 17);
this.label3.TabIndex = 2;
this.label3.Text = "HwSw Data";
//
// lblHwSwData
//
this.lblHwSwData.AutoSize = true;
this.lblHwSwData.Location = new System.Drawing.Point(97, 16);
this.lblHwSwData.Location = new System.Drawing.Point(129, 20);
this.lblHwSwData.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblHwSwData.Name = "lblHwSwData";
this.lblHwSwData.Size = new System.Drawing.Size(16, 13);
this.lblHwSwData.Size = new System.Drawing.Size(20, 17);
this.lblHwSwData.TabIndex = 3;
this.lblHwSwData.Text = "...";
//
@@ -172,9 +186,10 @@
this.lblRedis.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblRedis.AutoEllipsis = true;
this.lblRedis.Location = new System.Drawing.Point(8, 39);
this.lblRedis.Location = new System.Drawing.Point(11, 48);
this.lblRedis.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblRedis.Name = "lblRedis";
this.lblRedis.Size = new System.Drawing.Size(372, 293);
this.lblRedis.Size = new System.Drawing.Size(496, 361);
this.lblRedis.TabIndex = 5;
this.lblRedis.Text = "---";
//
@@ -187,17 +202,19 @@
//
// txtMergedName
//
this.txtMergedName.Location = new System.Drawing.Point(92, 14);
this.txtMergedName.Location = new System.Drawing.Point(123, 17);
this.txtMergedName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtMergedName.Name = "txtMergedName";
this.txtMergedName.Size = new System.Drawing.Size(153, 20);
this.txtMergedName.Size = new System.Drawing.Size(203, 22);
this.txtMergedName.TabIndex = 6;
this.txtMergedName.Text = "MergedPdfFile.pdf";
//
// button1
//
this.button1.Location = new System.Drawing.Point(5, 11);
this.button1.Location = new System.Drawing.Point(7, 14);
this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.Size = new System.Drawing.Size(100, 28);
this.button1.TabIndex = 7;
this.button1.Text = "Select PDF";
this.button1.UseVisualStyleBackColor = true;
@@ -206,17 +223,19 @@
// lblNumMerged
//
this.lblNumMerged.AutoSize = true;
this.lblNumMerged.Location = new System.Drawing.Point(300, 20);
this.lblNumMerged.Location = new System.Drawing.Point(400, 25);
this.lblNumMerged.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblNumMerged.Name = "lblNumMerged";
this.lblNumMerged.Size = new System.Drawing.Size(10, 13);
this.lblNumMerged.Size = new System.Drawing.Size(13, 17);
this.lblNumMerged.TabIndex = 8;
this.lblNumMerged.Text = "-";
//
// button2
//
this.button2.Location = new System.Drawing.Point(5, 13);
this.button2.Location = new System.Drawing.Point(7, 16);
this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.Size = new System.Drawing.Size(100, 28);
this.button2.TabIndex = 9;
this.button2.Text = "RedisInfo";
this.button2.UseVisualStyleBackColor = true;
@@ -228,20 +247,23 @@
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabPage5);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(776, 363);
this.tabControl1.Size = new System.Drawing.Size(1035, 447);
this.tabControl1.TabIndex = 10;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(750, 113);
this.tabPage1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabPage1.Size = new System.Drawing.Size(1027, 418);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "File IO test";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -251,10 +273,11 @@
this.tabPage2.Controls.Add(this.lblNumMerged);
this.tabPage2.Controls.Add(this.txtMergedName);
this.tabPage2.Controls.Add(this.button1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(768, 337);
this.tabPage2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabPage2.Size = new System.Drawing.Size(1027, 418);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "PDF test";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -266,62 +289,190 @@
this.tabPage3.Controls.Add(this.btnShowCdv);
this.tabPage3.Controls.Add(this.lblRedis);
this.tabPage3.Controls.Add(this.button2);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(768, 337);
this.tabPage3.Size = new System.Drawing.Size(1027, 418);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Redis test";
this.tabPage3.UseVisualStyleBackColor = true;
//
// tabPage4
// btnResetCdv
//
this.tabPage4.Controls.Add(this.label3);
this.tabPage4.Controls.Add(this.lblHwSwData);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(750, 192);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Hw Sw pages";
this.tabPage4.UseVisualStyleBackColor = true;
this.btnResetCdv.Location = new System.Drawing.Point(660, 16);
this.btnResetCdv.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnResetCdv.Name = "btnResetCdv";
this.btnResetCdv.Size = new System.Drawing.Size(100, 28);
this.btnResetCdv.TabIndex = 13;
this.btnResetCdv.Text = "Reset CDV";
this.btnResetCdv.UseVisualStyleBackColor = true;
this.btnResetCdv.Click += new System.EventHandler(this.btnResetCdv_Click);
//
// lblRedCDV
//
this.lblRedCDV.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblRedCDV.AutoEllipsis = true;
this.lblRedCDV.Location = new System.Drawing.Point(411, 39);
this.lblRedCDV.Location = new System.Drawing.Point(548, 48);
this.lblRedCDV.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblRedCDV.Name = "lblRedCDV";
this.lblRedCDV.Size = new System.Drawing.Size(349, 293);
this.lblRedCDV.Size = new System.Drawing.Size(465, 361);
this.lblRedCDV.TabIndex = 10;
this.lblRedCDV.Text = "---";
//
// btnShowCdv
//
this.btnShowCdv.Location = new System.Drawing.Point(414, 13);
this.btnShowCdv.Location = new System.Drawing.Point(552, 16);
this.btnShowCdv.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnShowCdv.Name = "btnShowCdv";
this.btnShowCdv.Size = new System.Drawing.Size(75, 23);
this.btnShowCdv.Size = new System.Drawing.Size(100, 28);
this.btnShowCdv.TabIndex = 11;
this.btnShowCdv.Text = "Show Config";
this.btnShowCdv.UseVisualStyleBackColor = true;
this.btnShowCdv.Click += new System.EventHandler(this.btnShowCdv_Click);
//
// btnResetCdv
// tabPage4
//
this.btnResetCdv.Location = new System.Drawing.Point(495, 13);
this.btnResetCdv.Name = "btnResetCdv";
this.btnResetCdv.Size = new System.Drawing.Size(75, 23);
this.btnResetCdv.TabIndex = 13;
this.btnResetCdv.Text = "Reset CDV";
this.btnResetCdv.UseVisualStyleBackColor = true;
this.btnResetCdv.Click += new System.EventHandler(this.btnResetCdv_Click);
this.tabPage4.Controls.Add(this.label3);
this.tabPage4.Controls.Add(this.lblHwSwData);
this.tabPage4.Location = new System.Drawing.Point(4, 25);
this.tabPage4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(1027, 418);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Hw Sw pages";
this.tabPage4.UseVisualStyleBackColor = true;
//
// tabPage5
//
this.tabPage5.Controls.Add(this.lblClock);
this.tabPage5.Controls.Add(this.lblNextSched);
this.tabPage5.Controls.Add(this.lblStartTimer);
this.tabPage5.Controls.Add(this.label6);
this.tabPage5.Controls.Add(this.label5);
this.tabPage5.Controls.Add(this.txtSec);
this.tabPage5.Controls.Add(this.label4);
this.tabPage5.Controls.Add(this.txtMin);
this.tabPage5.Controls.Add(this.lblOre);
this.tabPage5.Controls.Add(this.txtOre);
this.tabPage5.Controls.Add(this.btnStartSched);
this.tabPage5.Location = new System.Drawing.Point(4, 25);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
this.tabPage5.Size = new System.Drawing.Size(1027, 418);
this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "Scheduler";
this.tabPage5.UseVisualStyleBackColor = true;
//
// btnStartSched
//
this.btnStartSched.Location = new System.Drawing.Point(21, 23);
this.btnStartSched.Name = "btnStartSched";
this.btnStartSched.Size = new System.Drawing.Size(75, 23);
this.btnStartSched.TabIndex = 0;
this.btnStartSched.Text = "Start Scheduler";
this.btnStartSched.UseVisualStyleBackColor = true;
this.btnStartSched.Click += new System.EventHandler(this.btnStartSched_Click);
//
// txtOre
//
this.txtOre.Location = new System.Drawing.Point(163, 23);
this.txtOre.Name = "txtOre";
this.txtOre.Size = new System.Drawing.Size(39, 22);
this.txtOre.TabIndex = 1;
this.txtOre.Text = "0";
//
// lblOre
//
this.lblOre.AutoSize = true;
this.lblOre.Location = new System.Drawing.Point(133, 26);
this.lblOre.Name = "lblOre";
this.lblOre.Size = new System.Drawing.Size(24, 17);
this.lblOre.TabIndex = 2;
this.lblOre.Text = "hh";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(212, 26);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(30, 17);
this.label4.TabIndex = 4;
this.label4.Text = "min";
//
// txtMin
//
this.txtMin.Location = new System.Drawing.Point(242, 23);
this.txtMin.Name = "txtMin";
this.txtMin.Size = new System.Drawing.Size(39, 22);
this.txtMin.TabIndex = 3;
this.txtMin.Text = "0";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(287, 26);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(30, 17);
this.label5.TabIndex = 6;
this.label5.Text = "sec";
//
// txtSec
//
this.txtSec.Location = new System.Drawing.Point(322, 23);
this.txtSec.Name = "txtSec";
this.txtSec.Size = new System.Drawing.Size(45, 22);
this.txtSec.TabIndex = 5;
this.txtSec.Text = "10";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(27, 62);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(311, 17);
this.label6.TabIndex = 7;
this.label6.Text = "Esecuzione test timer con apertura messagebox";
//
// lblStartTimer
//
this.lblStartTimer.AutoSize = true;
this.lblStartTimer.Location = new System.Drawing.Point(389, 26);
this.lblStartTimer.Name = "lblStartTimer";
this.lblStartTimer.Size = new System.Drawing.Size(23, 17);
this.lblStartTimer.TabIndex = 8;
this.lblStartTimer.Text = "---";
//
// lblNextSched
//
this.lblNextSched.AutoSize = true;
this.lblNextSched.Location = new System.Drawing.Point(389, 62);
this.lblNextSched.Name = "lblNextSched";
this.lblNextSched.Size = new System.Drawing.Size(23, 17);
this.lblNextSched.TabIndex = 9;
this.lblNextSched.Text = "---";
//
// lblClock
//
this.lblClock.AutoSize = true;
this.lblClock.Location = new System.Drawing.Point(792, 26);
this.lblClock.Name = "lblClock";
this.lblClock.Size = new System.Drawing.Size(20, 17);
this.lblClock.TabIndex = 10;
this.lblClock.Text = "...";
//
// clockTimer
//
this.clockTimer.Interval = 500;
this.clockTimer.Tick += new System.EventHandler(this.clockTimer_Tick);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(776, 363);
this.ClientSize = new System.Drawing.Size(1035, 447);
this.Controls.Add(this.tabControl1);
this.Margin = new System.Windows.Forms.Padding(2);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "MainForm";
this.Text = "WinForm library POC";
this.groupBox1.ResumeLayout(false);
@@ -334,6 +485,8 @@
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
this.ResumeLayout(false);
}
@@ -364,6 +517,19 @@
private System.Windows.Forms.Button btnResetCdv;
private System.Windows.Forms.Label lblRedCDV;
private System.Windows.Forms.Button btnShowCdv;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtSec;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtMin;
private System.Windows.Forms.Label lblOre;
private System.Windows.Forms.TextBox txtOre;
private System.Windows.Forms.Button btnStartSched;
private System.Windows.Forms.Label lblNextSched;
private System.Windows.Forms.Label lblStartTimer;
private System.Windows.Forms.Label lblClock;
private System.Windows.Forms.Timer clockTimer;
}
}
+51 -1
View File
@@ -1,4 +1,5 @@
using SteamWare;
using Steamware.Scheduler;
using SteamWare;
using System;
using System.Collections.Generic;
using System.IO;
@@ -95,5 +96,54 @@ namespace TestBench
}
lblRedCDV.Text = sb.ToString();
}
private void btnStartSched_Click(object sender, EventArgs e)
{
// avvia uno scheduler che apre una messagebox secondo programmazione impostata...
// For Interval in Minutes
// This Scheduler will start at 22:00 and call after every 30 Minutes
// IntervalInSeconds(start_hour, start_minute, minutes)
// calcolo istante dal PROSSIMO minuto
DateTime avvio = DateTime.Now;
lblStartTimer.Text = $"Avvio timer: {avvio:ddd yyyy-MM-dd HH:mm:ss}";
avvio = avvio.AddMinutes(1).AddSeconds(-avvio.Second);
lblNextSched.Text = $"Scadenza timer: {avvio:ddd yyyy-MM-dd HH:mm:ss}";
clockTimer.Start();
// calcolo periodo in minuti guardando quanto selezionato
int ore = 0;
int min = 0;
int sec = 0;
int.TryParse(txtOre.Text, out ore);
int.TryParse(txtMin.Text, out min);
int.TryParse(txtSec.Text, out sec);
// calcolo
double intSecondi = ore * 60 * 60 + min * 60 + sec;
TaskScheduler.IntervalInSeconds(avvio.Hour, avvio.Minute, intSecondi,
() =>
{
DateTime adesso = DateTime.Now;
// Initializes the variables to pass to the MessageBox.Show method.
string message = $"E' scattato il timer alle ore {DateTime.Now}.";
string caption = "Timer Elapsed";
MessageBoxButtons buttons = MessageBoxButtons.OK;
DialogResult result;
lblNextSched.Text = $"Scadenza timer: {adesso.AddSeconds(intSecondi):ddd yyyy-MM-dd HH:mm:ss}";
// Displays the MessageBox.
result = MessageBox.Show(message, caption, buttons);
});
}
private void clockTimer_Tick(object sender, EventArgs e)
{
DateTime adesso = DateTime.Now;
lblClock.Text = $"Clock: {adesso:ddd yyyy-MM-dd HH:mm:ss}";
}
}
}
+3
View File
@@ -120,4 +120,7 @@
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="clockTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>184, 17</value>
</metadata>
</root>
+16
View File
@@ -83,6 +83,22 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SteamWare.IO\SteamWare.IO.csproj">
<Project>{62c5b3ce-b2b7-476a-a600-059ce52dae14}</Project>
<Name>SteamWare.IO</Name>
</ProjectReference>
<ProjectReference Include="..\SteamWare.Logger\SteamWare.Logger.csproj">
<Project>{97a9f482-c173-4f0f-9f8f-7bb41c59cdd6}</Project>
<Name>SteamWare.Logger</Name>
</ProjectReference>
<ProjectReference Include="..\SteamWare.Reports\SteamWare.Reports.csproj">
<Project>{1792d70c-d854-415b-acf1-76bbcb8ac6fe}</Project>
<Name>SteamWare.Reports</Name>
</ProjectReference>
<ProjectReference Include="..\Steamware.Scheduler\Steamware.Scheduler.csproj">
<Project>{8901afac-987a-40c9-b730-d1fde0e5170c}</Project>
<Name>Steamware.Scheduler</Name>
</ProjectReference>
<ProjectReference Include="..\SteamWareLib\SteamWare.csproj">
<Project>{2872dcfe-8b46-43b2-baa0-842a816a2dd5}</Project>
<Name>SteamWare</Name>