Merge branch 'TestBackgroundWorker' into develop

This commit is contained in:
Samuele E. Locatelli
2019-11-08 10:34:16 +01:00
12 changed files with 651 additions and 331 deletions
+38
View File
@@ -1146,6 +1146,40 @@ namespace IOB_UT
dataType = _dataType;
}
}
/// <summary>
/// Classe che contiene tutte le NUOVE informaizoni da aggiornare sulla form
/// </summary>
public class newDisplayData
{
/// <summary>
/// Dati tipo IN
/// </summary>
public string newInData { get; set; } = "";
/// <summary>
/// Dati tipo Signal
/// </summary>
public string newSignalData { get; set; } = "";
/// <summary>
/// Dati tipo FluxLog
/// </summary>
public string newFLogData { get; set; } = "";
/// <summary>
/// Dati tipo UrlCall
/// </summary>
public string newUrlCallData { get; set; } = "";
/// <summary>
/// Dati tipo LiveLog
/// </summary>
public string newLiveLogData { get; set; } = "";
/// <summary>
/// Stato semaforo IN verso PLC
/// </summary>
public Semaforo semIn { get; set; } = Semaforo.ND;
/// <summary>
/// Stato semaforo OUT verso MES
/// </summary>
public Semaforo semOut { get; set; } = Semaforo.ND;
}
/// <summary>
/// StFlag8: set di 8 bit (1 word) contente semaforo di variabili
@@ -1208,6 +1242,10 @@ namespace IOB_UT
/// </summary>
public enum Semaforo
{
/// <summary>
/// Stato non definito
/// </summary>
ND,
/// <summary>
/// Verde
/// </summary>
+165 -163
View File
@@ -7,6 +7,7 @@
/// </summary>
private System.ComponentModel.IContainer components = null;
#if false
/// <summary>
/// Clean up any resources being used.
/// </summary>
@@ -18,7 +19,8 @@
components.Dispose();
}
base.Dispose(disposing);
}
}
#endif
#region Windows Form Designer generated code
@@ -61,6 +63,18 @@
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.lblLogfile = new System.Windows.Forms.Label();
this.tabPlc = new System.Windows.Forms.TabPage();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.lblTaskLog = new System.Windows.Forms.Label();
this.txtValue = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.cmbParamValues = new System.Windows.Forms.ComboBox();
this.btnSendPLC = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.chkEdit = new System.Windows.Forms.CheckBox();
this.label12 = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.lblBitmap_03 = new System.Windows.Forms.Label();
this.lblBitmap_02 = new System.Windows.Forms.Label();
@@ -71,12 +85,6 @@
this.label18 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.lblTaskLog = new System.Windows.Forms.Label();
this.btnSendPLC = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.chkEdit = new System.Windows.Forms.CheckBox();
this.label12 = new System.Windows.Forms.Label();
this.tabMes = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.label21 = new System.Windows.Forms.Label();
@@ -90,12 +98,6 @@
this.label10 = new System.Windows.Forms.Label();
this.lblDataProc = new System.Windows.Forms.Label();
this.lblQueueLen = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmbParamValues = new System.Windows.Forms.ComboBox();
this.label22 = new System.Windows.Forms.Label();
this.txtValue = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.statusStrip1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabData.SuspendLayout();
@@ -104,15 +106,15 @@
this.tabLog.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.tabPlc.SuspendLayout();
this.panel4.SuspendLayout();
this.panel3.SuspendLayout();
this.tabMes.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.tabMes.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// gather
@@ -522,6 +524,145 @@
this.tabPlc.TabIndex = 4;
this.tabPlc.Text = "PLC <--> IOB";
//
// splitContainer1
//
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(7, 3);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel3);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.panel4);
this.splitContainer1.Size = new System.Drawing.Size(940, 547);
this.splitContainer1.SplitterDistance = 469;
this.splitContainer1.TabIndex = 94;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel3.Controls.Add(this.panel2);
this.panel3.Controls.Add(this.txtValue);
this.panel3.Controls.Add(this.label23);
this.panel3.Controls.Add(this.label22);
this.panel3.Controls.Add(this.cmbParamValues);
this.panel3.Controls.Add(this.btnSendPLC);
this.panel3.Controls.Add(this.label5);
this.panel3.Controls.Add(this.chkEdit);
this.panel3.Controls.Add(this.label12);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Margin = new System.Windows.Forms.Padding(2);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(469, 547);
this.panel3.TabIndex = 91;
//
// panel2
//
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel2.AutoScroll = true;
this.panel2.Controls.Add(this.lblTaskLog);
this.panel2.Location = new System.Drawing.Point(3, 212);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(459, 328);
this.panel2.TabIndex = 86;
//
// lblTaskLog
//
this.lblTaskLog.AutoSize = true;
this.lblTaskLog.Location = new System.Drawing.Point(3, 0);
this.lblTaskLog.Name = "lblTaskLog";
this.lblTaskLog.Size = new System.Drawing.Size(16, 13);
this.lblTaskLog.TabIndex = 81;
this.lblTaskLog.Text = "...";
//
// txtValue
//
this.txtValue.Location = new System.Drawing.Point(95, 91);
this.txtValue.Margin = new System.Windows.Forms.Padding(2);
this.txtValue.Name = "txtValue";
this.txtValue.Size = new System.Drawing.Size(236, 20);
this.txtValue.TabIndex = 85;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(25, 91);
this.label23.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(34, 13);
this.label23.TabIndex = 84;
this.label23.Text = "Value";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(26, 57);
this.label22.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(55, 13);
this.label22.TabIndex = 83;
this.label22.Text = "Parameter";
//
// cmbParamValues
//
this.cmbParamValues.FormattingEnabled = true;
this.cmbParamValues.Location = new System.Drawing.Point(95, 54);
this.cmbParamValues.Name = "cmbParamValues";
this.cmbParamValues.Size = new System.Drawing.Size(236, 21);
this.cmbParamValues.TabIndex = 82;
//
// btnSendPLC
//
this.btnSendPLC.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSendPLC.Location = new System.Drawing.Point(19, 132);
this.btnSendPLC.Margin = new System.Windows.Forms.Padding(2);
this.btnSendPLC.Name = "btnSendPLC";
this.btnSendPLC.Size = new System.Drawing.Size(312, 30);
this.btnSendPLC.TabIndex = 6;
this.btnSendPLC.Text = "SEND --> PLC";
this.btnSendPLC.UseVisualStyleBackColor = true;
this.btnSendPLC.Click += new System.EventHandler(this.BtnSendPLC_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(14, 184);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(115, 25);
this.label5.TabIndex = 1;
this.label5.Text = "TASK LIST";
//
// chkEdit
//
this.chkEdit.AutoSize = true;
this.chkEdit.Location = new System.Drawing.Point(252, 22);
this.chkEdit.Margin = new System.Windows.Forms.Padding(2);
this.chkEdit.Name = "chkEdit";
this.chkEdit.Size = new System.Drawing.Size(79, 17);
this.chkEdit.TabIndex = 8;
this.chkEdit.Text = "SET DATA";
this.chkEdit.UseVisualStyleBackColor = true;
this.chkEdit.Click += new System.EventHandler(this.ChkEdit_CheckedChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label12.Location = new System.Drawing.Point(14, 17);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(131, 25);
this.label12.TabIndex = 1;
this.label12.Text = "MES --> PLC";
//
// panel4
//
this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
@@ -631,78 +772,6 @@
this.label16.TabIndex = 2;
this.label16.Text = "PLC --> MES";
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel3.Controls.Add(this.panel2);
this.panel3.Controls.Add(this.txtValue);
this.panel3.Controls.Add(this.label23);
this.panel3.Controls.Add(this.label22);
this.panel3.Controls.Add(this.cmbParamValues);
this.panel3.Controls.Add(this.btnSendPLC);
this.panel3.Controls.Add(this.label5);
this.panel3.Controls.Add(this.chkEdit);
this.panel3.Controls.Add(this.label12);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Margin = new System.Windows.Forms.Padding(2);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(469, 547);
this.panel3.TabIndex = 91;
//
// lblTaskLog
//
this.lblTaskLog.AutoSize = true;
this.lblTaskLog.Location = new System.Drawing.Point(3, 0);
this.lblTaskLog.Name = "lblTaskLog";
this.lblTaskLog.Size = new System.Drawing.Size(16, 13);
this.lblTaskLog.TabIndex = 81;
this.lblTaskLog.Text = "...";
//
// btnSendPLC
//
this.btnSendPLC.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSendPLC.Location = new System.Drawing.Point(19, 132);
this.btnSendPLC.Margin = new System.Windows.Forms.Padding(2);
this.btnSendPLC.Name = "btnSendPLC";
this.btnSendPLC.Size = new System.Drawing.Size(312, 30);
this.btnSendPLC.TabIndex = 6;
this.btnSendPLC.Text = "SEND --> PLC";
this.btnSendPLC.UseVisualStyleBackColor = true;
this.btnSendPLC.Click += new System.EventHandler(this.BtnSendPLC_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(14, 184);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(115, 25);
this.label5.TabIndex = 1;
this.label5.Text = "TASK LIST";
//
// chkEdit
//
this.chkEdit.AutoSize = true;
this.chkEdit.Location = new System.Drawing.Point(252, 22);
this.chkEdit.Margin = new System.Windows.Forms.Padding(2);
this.chkEdit.Name = "chkEdit";
this.chkEdit.Size = new System.Drawing.Size(79, 17);
this.chkEdit.TabIndex = 8;
this.chkEdit.Text = "SET DATA";
this.chkEdit.UseVisualStyleBackColor = true;
this.chkEdit.Click += new System.EventHandler(this.ChkEdit_CheckedChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label12.Location = new System.Drawing.Point(14, 17);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(131, 25);
this.label12.TabIndex = 1;
this.label12.Text = "MES --> PLC";
//
// tabMes
//
this.tabMes.BackColor = System.Drawing.Color.Transparent;
@@ -839,73 +908,6 @@
this.lblQueueLen.TabIndex = 83;
this.lblQueueLen.Text = "###";
//
// splitContainer1
//
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(7, 3);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel3);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.panel4);
this.splitContainer1.Size = new System.Drawing.Size(940, 547);
this.splitContainer1.SplitterDistance = 469;
this.splitContainer1.TabIndex = 94;
//
// cmbParamValues
//
this.cmbParamValues.FormattingEnabled = true;
this.cmbParamValues.Location = new System.Drawing.Point(95, 54);
this.cmbParamValues.Name = "cmbParamValues";
this.cmbParamValues.Size = new System.Drawing.Size(236, 21);
this.cmbParamValues.TabIndex = 82;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(26, 57);
this.label22.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(55, 13);
this.label22.TabIndex = 83;
this.label22.Text = "Parameter";
//
// txtValue
//
this.txtValue.Location = new System.Drawing.Point(95, 91);
this.txtValue.Margin = new System.Windows.Forms.Padding(2);
this.txtValue.Name = "txtValue";
this.txtValue.Size = new System.Drawing.Size(236, 20);
this.txtValue.TabIndex = 85;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(25, 91);
this.label23.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(34, 13);
this.label23.TabIndex = 84;
this.label23.Text = "Value";
//
// panel2
//
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel2.AutoScroll = true;
this.panel2.Controls.Add(this.lblTaskLog);
this.panel2.Location = new System.Drawing.Point(3, 212);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(459, 328);
this.panel2.TabIndex = 86;
//
// AdapterForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -934,19 +936,19 @@
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.tabPlc.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.tabMes.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.tabMes.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
+169 -4
View File
@@ -4,6 +4,7 @@ using NLog.Config;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
@@ -141,7 +142,9 @@ namespace IOB_WIN
lg.Factory.Configuration.Variables["codIOB"] = this.CurrIOB;
lg.Info(txt2log);
// salvo anche in logwatcher...
logWatcher = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | INFO | {txt2log}";
newDisplayData currDispData = new newDisplayData();
currDispData.newLiveLogData = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | INFO | {txt2log}";
updateFormDisplay(currDispData);
}
/// <summary>
/// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere...
@@ -152,7 +155,9 @@ namespace IOB_WIN
lg.Factory.Configuration.Variables["codIOB"] = this.CurrIOB;
lg.Error(txt2log);
// salvo anche in logwatcher...
logWatcher = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | ERROR | {txt2log}";
newDisplayData currDispData = new newDisplayData();
currDispData.newLiveLogData = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | ERROR | {txt2log}";
updateFormDisplay(currDispData);
}
@@ -503,8 +508,11 @@ namespace IOB_WIN
gather.Enabled = false;
iobObj.tryDisconnect();
}
sIN = Semaforo.SS;
sOUT = Semaforo.SS;
newDisplayData currDispData = new newDisplayData();
currDispData.semIn = Semaforo.SS;
currDispData.semOut = Semaforo.SS;
updateFormDisplay(currDispData);
}
/// <summary>
@@ -628,6 +636,163 @@ namespace IOB_WIN
#endregion
#region Area BackGroundWorker
/// <summary>
/// Effettua update form una volta ricevuto OBJ che contiene le varie innovazioni...
/// </summary>
/// <param name="newData"></param>
public void updateFormDisplay(newDisplayData newData)
{
// ciclo x ogni oggetto x caricare le innovazioni...
if (newData != null)
{
// RealTime display
if (!string.IsNullOrWhiteSpace(newData.newInData))
{
}
if (!string.IsNullOrWhiteSpace(newData.newSignalData))
{
}
if (!string.IsNullOrWhiteSpace(newData.newFLogData))
{
}
if (!string.IsNullOrWhiteSpace(newData.newUrlCallData))
{
}
// LiveLog
if (!string.IsNullOrWhiteSpace(newData.newLiveLogData))
{
logWatcher = newData.newLiveLogData;
}
// semafori
if (newData.semOut != Semaforo.ND)
{
//aggiorno comunque!
sOUT = newData.semOut;
}
if (newData.semIn != Semaforo.ND)
{
//aggiorno comunque!
sIN = newData.semIn;
}
}
}
/// <summary>
/// Worker x azioni VERSO IL SERVER MES su thread separato
/// </summary>
private BackgroundWorker bgWorkerMES;
// Set up the BackgroundWorker object by
// attaching event handlers.
private void InitializeBgWorkerMes()
{
bgWorkerMES.DoWork += BgWorkerMES_DoWork;
bgWorkerMES.RunWorkerCompleted += BgWorkerMES_RunWorkerCompleted;
bgWorkerMES.ProgressChanged += BgWorkerMES_ProgressChanged;
}
private void BgWorkerMES_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
//throw new NotImplementedException();
}
private void BgWorkerMES_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//throw new NotImplementedException();
}
private void BgWorkerMES_DoWork(object sender, DoWorkEventArgs e)
{
//throw new NotImplementedException();
}
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
// chiudo ANCHE background worker
if (bgWorkerMES != null)
{
bgWorkerMES.Dispose();
}
}
base.Dispose(disposing);
}
#if false
//handler for DoWork Event
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
//your background process task
//.
//.
//.
//calculate progress percentage
int progPercentage = 10;
//notify the progress. backGroundWorker_ProgressChanged() will be called
backgroundWorker.ReportProgress(progPercentage);
}
//Handler for Button Click Event
private void btnDoSomeAsyncTask_Click(object sender, EventArgs e)
{
if (backgroundWorker == null)
{
//initialize backgroundworker
backgroundWorker = new BackgroundWorker();
}
else
{
bool start = true;
//check whether operation is already in progress
if (backgroundWorker.IsBusy)
{
if (MessageBox.Show("The requested task already in progress. Abort current process continue with the fresh task?",
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
{
start = false;
}
else //cancel the current operation
{
//for this operation WorkerSupportsCancellation shoulb
backgroundWorker.CancelAsync();
}
}
if (start)
{
#if false
//Call the hooked method backGroundWorker_DoWork() containing object sent in DoWorkEventArgs
backgroundWorker.RunWorkerAsync(objectToBeUsedInAsyncOperation);
#endif
}
}
}
//Handler for progress Changed Event
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
//update the UI here
((MainForm)this.Parent).advProgBar();
#if false
progressBar.Value = e.ProgressPercentage;
#endif
}
//Handler For RunWorkerCompleted event
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//Task to be performed after completion of background task.Like Give some message.
MessageBox.Show("Task Completed");
}
#endif
#endregion
private void mLoadConf_Click(object sender, EventArgs e)
{
// mostro selettore file x leggere adapter..
+6
View File
@@ -0,0 +1,6 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Gli identificatori non devono contenere caratteri di sottolineatura", Justification = "<In sospeso>", Scope = "namespace", Target = "~N:IOB_WIN")]
+22
View File
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.7\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.7\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" />
<Import Project="..\packages\Microsoft.NetFramework.Analyzers.2.9.7\build\Microsoft.NetFramework.Analyzers.props" Condition="Exists('..\packages\Microsoft.NetFramework.Analyzers.2.9.7\build\Microsoft.NetFramework.Analyzers.props')" />
<Import Project="..\packages\Microsoft.NetCore.Analyzers.2.9.7\build\Microsoft.NetCore.Analyzers.props" Condition="Exists('..\packages\Microsoft.NetCore.Analyzers.2.9.7\build\Microsoft.NetCore.Analyzers.props')" />
<Import Project="..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\build\Microsoft.CodeQuality.Analyzers.props" Condition="Exists('..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\build\Microsoft.CodeQuality.Analyzers.props')" />
<Import Project="..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.7\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.7\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -135,6 +140,7 @@
<Compile Include="..\VersGen\VersGen.cs">
<Link>VersGen.cs</Link>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="IobOmron.cs" />
<Compile Include="IobSiemensAt2001.cs" />
<Compile Include="IobSiemensLasco.cs" />
@@ -486,6 +492,17 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.7\analyzers\dotnet\cs\Microsoft.CodeAnalysis.VersionCheckAnalyzer.resources.dll" />
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.7\analyzers\dotnet\Microsoft.CodeAnalysis.VersionCheckAnalyzer.dll" />
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\analyzers\dotnet\cs\Humanizer.dll" />
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\analyzers\dotnet\cs\Microsoft.CodeQuality.CSharp.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.NetCore.Analyzers.2.9.7\analyzers\dotnet\cs\Microsoft.NetCore.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.NetCore.Analyzers.2.9.7\analyzers\dotnet\cs\Microsoft.NetCore.CSharp.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.NetFramework.Analyzers.2.9.7\analyzers\dotnet\cs\Microsoft.NetFramework.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.NetFramework.Analyzers.2.9.7\analyzers\dotnet\cs\Microsoft.NetFramework.CSharp.Analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>"$(ProjectDir)setupTgt.bat" "$(ConfigurationName)" "$(ProjectDir)"</PreBuildEvent>
@@ -507,6 +524,11 @@
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\packages\Selenium.WebDriver.ChromeDriver.77.0.3865.4000\build\Selenium.WebDriver.ChromeDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.ChromeDriver.77.0.3865.4000\build\Selenium.WebDriver.ChromeDriver.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.7\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.7\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\build\Microsoft.CodeQuality.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeQuality.Analyzers.2.9.7\build\Microsoft.CodeQuality.Analyzers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.NetCore.Analyzers.2.9.7\build\Microsoft.NetCore.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NetCore.Analyzers.2.9.7\build\Microsoft.NetCore.Analyzers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.NetFramework.Analyzers.2.9.7\build\Microsoft.NetFramework.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NetFramework.Analyzers.2.9.7\build\Microsoft.NetFramework.Analyzers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.7\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.7\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props'))" />
</Target>
<Import Project="..\packages\Selenium.Firefox.WebDriver.0.24.0\build\Selenium.Firefox.WebDriver.targets" Condition="Exists('..\packages\Selenium.Firefox.WebDriver.0.24.0\build\Selenium.Firefox.WebDriver.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
+5 -1
View File
@@ -519,6 +519,8 @@ namespace IOB_WIN
public override void readSemafori()
{
base.readSemafori();
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
if (verboseLog)
@@ -526,7 +528,7 @@ namespace IOB_WIN
lgInfo("inizio read semafori");
}
parentForm.sIN = Semaforo.SV;
currDispData.semIn = Semaforo.SV;
// inizio letture, SEMPRE DA ZERO (possibile ottimizzazione...)
int memIndex = 0;
// controllo area R: se ha dati (> 0 byte) --> leggo!
@@ -591,7 +593,9 @@ namespace IOB_WIN
{
lgError(string.Format("Eccezione in readSemafori:{0}{1}", Environment.NewLine, exc));
connectionOk = false;
currDispData.semIn = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
+165 -104
View File
@@ -497,7 +497,9 @@ namespace IOB_WIN
/// <param name="message"></param>
protected void sendToLogWatch(string messType, string message)
{
parentForm.logWatcher = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | {messType} | {message}";
newDisplayData currDispData = new newDisplayData();
currDispData.newLiveLogData = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | {messType} | {message}";
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
/// Invia messaggio a logWatcher
@@ -510,7 +512,9 @@ namespace IOB_WIN
try
{
string expString = string.Format(message, args);
parentForm.logWatcher = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | {messType} | {expString}";
newDisplayData currDispData = new newDisplayData();
currDispData.newLiveLogData = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | {messType} | {expString}";
parentForm.updateFormDisplay(currDispData);
}
catch
{ }
@@ -527,7 +531,9 @@ namespace IOB_WIN
try
{
string expString = string.Format(message, args);
parentForm.logWatcher = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | {messType} | {expString}{Environment.NewLine}{exception}";
newDisplayData currDispData = new newDisplayData();
currDispData.newLiveLogData = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} | {messType} | {expString}{Environment.NewLine}{exception}";
parentForm.updateFormDisplay(currDispData);
}
catch
{ }
@@ -1157,46 +1163,56 @@ namespace IOB_WIN
/// </summary>
private void trySendValues()
{
// verifico se risponde il server...
if (checkServerAlive)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
// verifico SE posso inviare dati
if (checkIobEnabled)
// verifico se risponde il server...
if (checkServerAlive)
{
// verificare come gestire il task secondario senza interferenza (chiamate update su FORM da thread secondari danno errori)
if (utils.CRB("sendDataByThread"))
// verifico SE posso inviare dati
if (checkIobEnabled)
{
// invio con thread separato...
Task taskSigIN = TaskEx.Run(() => svuotaCodaSignIN());
Task taskFlog = TaskEx.Run(() => svuotaCodaFLog());
// verificare come gestire il task secondario senza interferenza (chiamate update su FORM da thread secondari danno errori)
if (utils.CRB("sendDataByThread"))
{
// invio con thread separato...
Task taskSigIN = TaskEx.Run(() => svuotaCodaSignIN());
Task taskFlog = TaskEx.Run(() => svuotaCodaFLog());
}
else
{
// gestione queue SignalIN (invio, display)
svuotaCodaSignIN();
// gestione queue FluxLog (invio, display)
svuotaCodaFLog();
}
}
else
{
// gestione queue SignalIN (invio, display)
svuotaCodaSignIN();
// gestione queue FluxLog (invio, display)
svuotaCodaFLog();
// mostro VETO-SEND x invio... GIALLO
currDispData.semOut = Semaforo.SG;
if (periodicLog)
{
lgInfo("IOB - VETO SEND");
}
}
}
else
{
// mostro VETO-SEND x invio... GIALLO
parentForm.sOUT = Semaforo.SG;
// mostro SERVER KO x invio... ROSSO
currDispData.semOut = Semaforo.SR;
if (periodicLog)
{
lgInfo("IOB - VETO SEND");
lgInfo("IOB - SERVER NOT READY");
}
}
}
else
catch (Exception exc)
{
// mostro SERVER KO x invio... ROSSO
parentForm.sOUT = Semaforo.SR;
if (periodicLog)
{
lgInfo("IOB - SERVER NOT READY");
}
currDispData.semOut = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
@@ -2656,23 +2672,33 @@ namespace IOB_WIN
/// </summary>
public virtual void readAllData()
{
if (DemoIn)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
// segnalo che sono in Demo
parentForm.sIN = Semaforo.SV;
}
if (connectionOk)
{
readSemafori();
}
else
{
lgError("Errore connessione mancante x readSemafori");
}
if (DemoIn)
{
// segnalo che sono in Demo
currDispData.semIn = Semaforo.SV;
}
if (connectionOk)
{
readSemafori();
}
else
{
lgError("Errore connessione mancante x readSemafori");
}
nReadIN++;
// aggiorno valore mostrato...
displayRawData();
nReadIN++;
// aggiorno valore mostrato...
displayRawData();
}
catch
{
currDispData.semIn = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
/// Effettua gestioen programma: legge e mostra su display...
@@ -2990,6 +3016,21 @@ namespace IOB_WIN
return answ;
}
/// <summary>
///
/// </summary>
/// <param name="outVal"></param>
/// <param name="valore"></param>
/// <param name="chiave"></param>
/// <returns></returns>
public void saveValue(ref Dictionary<string, string> outVal, double valore, string chiave)
{
bool scaduto = stackVal_TSVC(chiave, valore);
// recupero VC
valore = getVal_TSVC(chiave, scaduto);
if (scaduto) outVal.Add(chiave, $"{valore}");
LastTSVC[chiave] = valore;
}
/// <summary>
/// Recupera la VC x TS, svuotando lista e resettando periodo partenza
/// </summary>
/// <param name="VCName">Nome della VC</param>
@@ -3179,48 +3220,58 @@ namespace IOB_WIN
/// <param name="queueVal"></param>
public void sendDataBlock(urlType tipoUrl, List<string> listQueueVal)
{
// recupero e formatto URL dati da coda...
lastUrl = urlDataBlock(tipoUrl);
// in base al tipo di dato compongo il payload Json da inviare
string payload = jsonPayload(tipoUrl, listQueueVal);
// async a true SE FLog
bool doAsync = tipoUrl == urlType.FLog ? true : false;
// se NON sono in demo effettuo invio!
if (!DemoOut)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
// SE server alive...
if (checkServerAlive)
// recupero e formatto URL dati da coda...
lastUrl = urlDataBlock(tipoUrl);
// in base al tipo di dato compongo il payload Json da inviare
string payload = jsonPayload(tipoUrl, listQueueVal);
// async a true SE FLog
bool doAsync = tipoUrl == urlType.FLog ? true : false;
// se NON sono in demo effettuo invio!
if (!DemoOut)
{
// chiamo URL!
string answ = callUrlWithPayload(lastUrl, payload, doAsync);
// loggo!
lgInfo($"[SEND payload] {listQueueVal.Count} records --> {answ}");
// se "OK" verde, altrimenti errore --> ROSSO
if (answ == "OK")
// SE server alive...
if (checkServerAlive)
{
parentForm.sOUT = Semaforo.SV;
// chiamo URL!
string answ = callUrlWithPayload(lastUrl, payload, doAsync);
// loggo!
lgInfo($"[SEND payload] {listQueueVal.Count} records --> {answ}");
// se "OK" verde, altrimenti errore --> ROSSO
if (answ == "OK")
{
currDispData.semOut = Semaforo.SV;
}
else
{
currDispData.semOut = Semaforo.SR;
}
}
else
{
parentForm.sOUT = Semaforo.SR;
lgInfo($"[SERVER KO] {listQueueVal.Count}");
}
}
else
{
lgInfo($"[SERVER KO] {listQueueVal.Count}");
currDispData.semOut = Semaforo.SV;
// loggo!
lgInfo($"{listQueueVal.Count} records --> [SIM]");
}
nSendOut += listQueueVal.Count;
// riporto cosa inviato
displayOutData();
// aggiorno data ultimo watchdog...
lastWatchDog = DateTime.Now;
}
else
catch
{
parentForm.sOUT = Semaforo.SV;
// loggo!
lgInfo($"{listQueueVal.Count} records --> [SIM]");
currDispData.semOut = Semaforo.SR;
}
nSendOut += listQueueVal.Count;
// riporto cosa inviato
displayOutData();
// aggiorno data ultimo watchdog...
lastWatchDog = DateTime.Now;
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
/// Effettua invio a MoonPro del valore richiesto
@@ -3231,55 +3282,65 @@ namespace IOB_WIN
/// FLog: il valore da trasmettere per il flusso indicato</param>
public void sendToMoonPro(urlType tipoUrl, string queueVal)
{
// recupero e formatto URL dati da coda...
switch (tipoUrl)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
case urlType.FLog:
lastUrl = urlFLog(queueVal);
break;
case urlType.SignIN:
lastUrl = urlInput(queueVal);
break;
default:
lastUrl = "";
break;
}
// se NON sono in demo effettuo invio!
if (!DemoOut)
{
// SE server alive...
if (checkServerAlive)
// recupero e formatto URL dati da coda...
switch (tipoUrl)
{
// chiamo URL!
string answ = callUrl(lastUrl, false);
// loggo!
lgInfo(string.Format("[SEND] {0} -> {1}", queueVal, answ));
// se "OK" verde, altrimenti errore --> ROSSO
if (answ == "OK")
case urlType.FLog:
lastUrl = urlFLog(queueVal);
break;
case urlType.SignIN:
lastUrl = urlInput(queueVal);
break;
default:
lastUrl = "";
break;
}
// se NON sono in demo effettuo invio!
if (!DemoOut)
{
// SE server alive...
if (checkServerAlive)
{
parentForm.sOUT = Semaforo.SV;
// chiamo URL!
string answ = callUrl(lastUrl, false);
// loggo!
lgInfo(string.Format("[SEND] {0} -> {1}", queueVal, answ));
// se "OK" verde, altrimenti errore --> ROSSO
if (answ == "OK")
{
currDispData.semOut = Semaforo.SV;
}
else
{
currDispData.semOut = Semaforo.SR;
}
}
else
{
parentForm.sOUT = Semaforo.SR;
lgInfo(string.Format("[SERVER KO] {0}", queueVal));
}
}
else
{
lgInfo(string.Format("[SERVER KO] {0}", queueVal));
currDispData.semOut = Semaforo.SV;
// loggo!
lgInfo(string.Format("{0} -> [SIM]", queueVal));
}
nSendOut++;
// riporto cosa inviato
displayOutData();
// aggiorno data ultimo watchdog...
lastWatchDog = DateTime.Now;
}
else
catch
{
parentForm.sOUT = Semaforo.SV;
// loggo!
lgInfo(string.Format("{0} -> [SIM]", queueVal));
currDispData.semOut = Semaforo.SR;
}
nSendOut++;
// riporto cosa inviato
displayOutData();
// aggiorno data ultimo watchdog...
lastWatchDog = DateTime.Now;
parentForm.updateFormDisplay(currDispData);
}
#endregion
+22 -13
View File
@@ -799,21 +799,30 @@ namespace IOB_WIN
public override void readSemafori()
{
base.readSemafori();
if (verboseLog)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
lgInfo("inizio read semafori");
if (verboseLog)
{
lgInfo("inizio read semafori");
}
currDispData.semIn = Semaforo.SV;
// effettuo TUTTE le letture
threadOk = commThreadOk;
cStatus = currBitmapStatus;
cSignals = currBitmapSignals;
lastCountCNC = pzCounter;
// decodifica e gestione
decodeToBaseBitmap();
decodeOtherData();
}
parentForm.sIN = Semaforo.SV;
// effettuo TUTTE le letture
threadOk = commThreadOk;
cStatus = currBitmapStatus;
cSignals = currBitmapSignals;
lastCountCNC = pzCounter;
// decodifica e gestione
decodeToBaseBitmap();
decodeOtherData();
catch
{
currDispData.semIn = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
+5 -1
View File
@@ -282,6 +282,8 @@ namespace IOB_WIN
public override void readSemafori()
{
base.readSemafori();
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
if (verboseLog)
@@ -289,7 +291,7 @@ namespace IOB_WIN
lgInfo("inizio read semafori");
}
parentForm.sIN = Semaforo.SV;
currDispData.semIn = Semaforo.SV;
stopwatch.Restart();
// possiamo leggere tutto da qui che contiene tutto: status, mode, last_nc_error
@@ -308,7 +310,9 @@ namespace IOB_WIN
{
lgError(string.Format("Eccezione in readSemafori:{0}{1}", Environment.NewLine, exc));
connectionOk = false;
currDispData.semIn = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
+25 -15
View File
@@ -645,23 +645,33 @@ namespace IOB_WIN
public override void readSemafori()
{
base.readSemafori();
if (verboseLog)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
lgInfo("inizio read semafori");
if (verboseLog)
{
lgInfo("inizio read semafori");
}
currDispData.semIn = Semaforo.SV;
// effettuo TUTTE le letture
OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.CIO, 0, 60, out memReadCIO);
//OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.DM, 0, 8, out memReadDM);
//OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.WR, 0, 8, out memReadWR);
lastCountCNC = pesoRilevato;
// decodifica e gestione
decodeToBaseBitmap();
}
parentForm.sIN = Semaforo.SV;
// effettuo TUTTE le letture
OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.CIO, 0, 60, out memReadCIO);
//OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.DM, 0, 8, out memReadDM);
//OMRON_ref.ReadWords(OmronFinsTCP.Net.PlcMemory.WR, 0, 8, out memReadWR);
lastCountCNC = pesoRilevato;
// decodifica e gestione
decodeToBaseBitmap();
catch
{
currDispData.semIn = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
+24 -30
View File
@@ -377,7 +377,6 @@ namespace IOB_WIN
lgInfo($"Init IOB, con {iobConfSer}");
}
/// <summary>
/// Test connessione CNC
/// </summary>
@@ -810,23 +809,33 @@ namespace IOB_WIN
public override void readSemafori()
{
base.readSemafori();
if (verboseLog)
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
lgInfo("inizio read semafori");
}
currDispData.semIn = Semaforo.SV;
parentForm.sIN = Semaforo.SV;
// leggo TUTTI i byte configurati...
byte[] MemBlock = new byte[parametri.memSizeRead];
bool fatto = S7ReadBB(ref MemBlock);
Buffer.BlockCopy(MemBlock, 0, RawInput, 0, parametri.memSizeRead);
if (verboseLog)
{
lgInfo(string.Format("RawInput[0]: {0}", utils.binaryForm(RawInput[0])));
if (verboseLog)
{
lgInfo("inizio read semafori");
}
// leggo TUTTI i byte configurati...
byte[] MemBlock = new byte[parametri.memSizeRead];
bool fatto = S7ReadBB(ref MemBlock);
Buffer.BlockCopy(MemBlock, 0, RawInput, 0, parametri.memSizeRead);
if (verboseLog)
{
lgInfo(string.Format("RawInput[0]: {0}", utils.binaryForm(RawInput[0])));
}
// salvo il solo BYTE dell'input decifrando il semaforo...
decodeToBaseBitmap();
decodeOtherData();
}
// salvo il solo BYTE dell'input decifrando il semaforo...
decodeToBaseBitmap();
decodeOtherData();
catch
{
currDispData.semIn = Semaforo.SR;
}
parentForm.updateFormDisplay(currDispData);
}
/// <summary>
/// decodifica da bitmap il CURRENT MODE del controllo
@@ -1015,21 +1024,6 @@ namespace IOB_WIN
}
return outVal;
}
/// <summary>
///
/// </summary>
/// <param name="outVal"></param>
/// <param name="valore"></param>
/// <param name="chiave"></param>
/// <returns></returns>
private void saveValue(ref Dictionary<string, string> outVal, double valore, string chiave)
{
bool scaduto = stackVal_TSVC(chiave, valore);
// recupero VC
valore = getVal_TSVC(chiave, scaduto);
if (scaduto) outVal.Add(chiave, $"{valore}");
LastTSVC[chiave] = valore;
}
#endregion
}
+5
View File
@@ -5,6 +5,11 @@
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net40-client" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40-client" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net40-client" />
<package id="Microsoft.CodeAnalysis.FxCopAnalyzers" version="2.9.7" targetFramework="net40-client" developmentDependency="true" />
<package id="Microsoft.CodeAnalysis.VersionCheckAnalyzer" version="2.9.7" targetFramework="net40-client" developmentDependency="true" />
<package id="Microsoft.CodeQuality.Analyzers" version="2.9.7" targetFramework="net40-client" developmentDependency="true" />
<package id="Microsoft.NetCore.Analyzers" version="2.9.7" targetFramework="net40-client" developmentDependency="true" />
<package id="Microsoft.NetFramework.Analyzers" version="2.9.7" targetFramework="net40-client" developmentDependency="true" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.26" targetFramework="net40-client" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net40-client" />
<package id="NLog" version="4.6.7" targetFramework="net40-client" />