Continuo prototipo classe e WebForm
This commit is contained in:
@@ -53,6 +53,10 @@
|
||||
_MConnectID = MConnectID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di INIT della classe di comunicazione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public requestStatus init()
|
||||
{
|
||||
// init output
|
||||
@@ -72,7 +76,34 @@
|
||||
};
|
||||
}
|
||||
else
|
||||
{ }
|
||||
{
|
||||
// !!!TBD: test status connessioni, tentativo call su cloud...
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public requestStatus tryAuthorize()
|
||||
{
|
||||
// init output
|
||||
requestStatus answ = new requestStatus();
|
||||
// verifico se sono in modalità testing o in produzione
|
||||
if (_currParam.testMode)
|
||||
{
|
||||
// Fingo che tutto vada bene e di conseguenza setto risposta...
|
||||
answ = new requestStatus
|
||||
{
|
||||
// non sono INIZIALMENTE enrolled...
|
||||
isHmiEnrolled = false,
|
||||
cloudConnection = true,
|
||||
localConnection = true,
|
||||
source = comSource.cloud,
|
||||
callSuccess = true
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// !!!TBD: test status connessioni, tentativo call su cloud...
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+248
-3
@@ -28,13 +28,258 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
|
||||
this.lblClock = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.chkTestMode = new System.Windows.Forms.CheckBox();
|
||||
this.txtMConnectID = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtConnParam = new System.Windows.Forms.TextBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.btnInit = new System.Windows.Forms.Button();
|
||||
this.btnResetParam = new System.Windows.Forms.Button();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(455, 279);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(149, 29);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Background worker";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(623, 279);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(152, 29);
|
||||
this.button2.TabIndex = 1;
|
||||
this.button2.Text = "Task Run";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(455, 329);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(149, 30);
|
||||
this.button3.TabIndex = 2;
|
||||
this.button3.Text = "cancel BW";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(623, 329);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(152, 30);
|
||||
this.button4.TabIndex = 3;
|
||||
this.button4.Text = "cancel TR";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(452, 392);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(20, 17);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "...";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(623, 391);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(20, 17);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "...";
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabel1,
|
||||
this.toolStripProgressBar1,
|
||||
this.lblClock});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 421);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(921, 25);
|
||||
this.statusStrip1.TabIndex = 7;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// toolStripStatusLabel1
|
||||
//
|
||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||
this.toolStripStatusLabel1.Size = new System.Drawing.Size(136, 20);
|
||||
this.toolStripStatusLabel1.Text = "POC MConnectSDK";
|
||||
//
|
||||
// toolStripProgressBar1
|
||||
//
|
||||
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
|
||||
this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 19);
|
||||
this.toolStripProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
//
|
||||
// lblClock
|
||||
//
|
||||
this.lblClock.Name = "lblClock";
|
||||
this.lblClock.Size = new System.Drawing.Size(27, 20);
|
||||
this.lblClock.Text = "---";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.AutoSize = true;
|
||||
this.groupBox1.Controls.Add(this.txtConnParam);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.chkTestMode);
|
||||
this.groupBox1.Controls.Add(this.txtMConnectID);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Location = new System.Drawing.Point(13, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(896, 73);
|
||||
this.groupBox1.TabIndex = 11;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Connection Parameters";
|
||||
//
|
||||
// chkTestMode
|
||||
//
|
||||
this.chkTestMode.AutoSize = true;
|
||||
this.chkTestMode.Location = new System.Drawing.Point(349, 29);
|
||||
this.chkTestMode.Name = "chkTestMode";
|
||||
this.chkTestMode.Size = new System.Drawing.Size(97, 21);
|
||||
this.chkTestMode.TabIndex = 13;
|
||||
this.chkTestMode.Text = "Test Mode";
|
||||
this.chkTestMode.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtMConnectID
|
||||
//
|
||||
this.txtMConnectID.Location = new System.Drawing.Point(103, 30);
|
||||
this.txtMConnectID.Name = "txtMConnectID";
|
||||
this.txtMConnectID.Size = new System.Drawing.Size(221, 22);
|
||||
this.txtMConnectID.TabIndex = 12;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(13, 33);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(84, 17);
|
||||
this.label3.TabIndex = 11;
|
||||
this.label3.Text = "MConnectID";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(452, 33);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(61, 17);
|
||||
this.label4.TabIndex = 14;
|
||||
this.label4.Text = "connPar";
|
||||
//
|
||||
// txtConnParam
|
||||
//
|
||||
this.txtConnParam.Location = new System.Drawing.Point(520, 29);
|
||||
this.txtConnParam.Name = "txtConnParam";
|
||||
this.txtConnParam.Size = new System.Drawing.Size(268, 22);
|
||||
this.txtConnParam.TabIndex = 15;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.btnInit);
|
||||
this.groupBox2.Controls.Add(this.btnResetParam);
|
||||
this.groupBox2.Location = new System.Drawing.Point(13, 91);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(896, 100);
|
||||
this.groupBox2.TabIndex = 14;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Metodi";
|
||||
//
|
||||
// btnInit
|
||||
//
|
||||
this.btnInit.Location = new System.Drawing.Point(147, 32);
|
||||
this.btnInit.Name = "btnInit";
|
||||
this.btnInit.Size = new System.Drawing.Size(118, 49);
|
||||
this.btnInit.TabIndex = 15;
|
||||
this.btnInit.Text = "Init";
|
||||
this.btnInit.UseVisualStyleBackColor = true;
|
||||
this.btnInit.Click += new System.EventHandler(this.btnInit_Click);
|
||||
//
|
||||
// btnResetParam
|
||||
//
|
||||
this.btnResetParam.Location = new System.Drawing.Point(6, 32);
|
||||
this.btnResetParam.Name = "btnResetParam";
|
||||
this.btnResetParam.Size = new System.Drawing.Size(118, 49);
|
||||
this.btnResetParam.TabIndex = 14;
|
||||
this.btnResetParam.Text = "Reset Param";
|
||||
this.btnResetParam.UseVisualStyleBackColor = true;
|
||||
this.btnResetParam.Click += new System.EventHandler(this.btnResetParam_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
this.ClientSize = new System.Drawing.Size(921, 446);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "POC MConnectSDK";
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel lblClock;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.CheckBox chkTestMode;
|
||||
private System.Windows.Forms.TextBox txtMConnectID;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtConnParam;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Button btnInit;
|
||||
private System.Windows.Forms.Button btnResetParam;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+336
-5
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -12,9 +8,344 @@ namespace TestClient
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private BackgroundWorker _bgw;
|
||||
private CancellationTokenSource _cts;
|
||||
|
||||
|
||||
private readonly SynchronizationContext synchronizationContext;
|
||||
private DateTime previousTime = DateTime.Now;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
synchronizationContext = SynchronizationContext.Current;
|
||||
var clockTask = myInitAsync();
|
||||
}
|
||||
|
||||
private async Task myInitAsync()
|
||||
{
|
||||
await updateClockAsync();
|
||||
}
|
||||
|
||||
private async Task updateClockAsync()
|
||||
{
|
||||
#if false
|
||||
var progressHandler = new Progress<string>(value =>
|
||||
{
|
||||
lblClock.Text = value;
|
||||
});
|
||||
var progress = progressHandler as IProgress<string>;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
if (progress != null)
|
||||
{
|
||||
progress.Report(DateTime.Now.ToString("ddd dd.MM.yyyy HH:mm:ss.fff"));
|
||||
}
|
||||
}
|
||||
});
|
||||
#endif
|
||||
await Task.Run(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
UpdateUI();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
var timeNow = DateTime.Now;
|
||||
|
||||
if ((DateTime.Now - previousTime).Milliseconds <= 250)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
lblClock.Text = timeNow.ToString("ddd dd.MM.yyyy HH:mm:ss");
|
||||
}), "");
|
||||
|
||||
previousTime = timeNow;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
procBackgroudWorker();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
await procTask();
|
||||
}
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
cancelBW();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Testing di BackgroundWorker
|
||||
/// </summary>
|
||||
private void procBackgroudWorker()
|
||||
{
|
||||
#if false
|
||||
var bgw = new BackgroundWorker();
|
||||
bgw.DoWork += (_, __) =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
};
|
||||
bgw.RunWorkerCompleted += (_, __) =>
|
||||
{
|
||||
MessageBox.Show("Hi from the UI thread!");
|
||||
};
|
||||
bgw.RunWorkerAsync();
|
||||
#endif
|
||||
|
||||
#if false
|
||||
var bgw = new BackgroundWorker();
|
||||
bgw.DoWork += (_, __) =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
throw new InvalidOperationException("Hi!");
|
||||
};
|
||||
bgw.RunWorkerCompleted += (_, args) =>
|
||||
{
|
||||
if (args.Error != null)
|
||||
{
|
||||
MessageBox.Show(args.Error.Message);
|
||||
}
|
||||
};
|
||||
bgw.RunWorkerAsync();
|
||||
#endif
|
||||
|
||||
#if false
|
||||
var bgw = new BackgroundWorker();
|
||||
bgw.DoWork += (_, args) =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
args.Result = 13;
|
||||
};
|
||||
bgw.RunWorkerCompleted += (_, args) =>
|
||||
{
|
||||
var result = (int)args.Result;
|
||||
MessageBox.Show("Result is " + result);
|
||||
};
|
||||
bgw.RunWorkerAsync();
|
||||
#endif
|
||||
|
||||
#if false
|
||||
_bgw = new BackgroundWorker();
|
||||
var bgw = _bgw;
|
||||
bgw.WorkerSupportsCancellation = true;
|
||||
bgw.DoWork += (_, args) =>
|
||||
{
|
||||
for (int i = 0; i != 100; ++i)
|
||||
{
|
||||
if (bgw.CancellationPending)
|
||||
{
|
||||
args.Cancel = true;
|
||||
return;
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
};
|
||||
bgw.RunWorkerCompleted += (_, args) =>
|
||||
{
|
||||
if (args.Cancelled)
|
||||
{
|
||||
MessageBox.Show("Cancelled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Completed.");
|
||||
}
|
||||
};
|
||||
bgw.RunWorkerAsync();
|
||||
#endif
|
||||
|
||||
#if false
|
||||
var bgw = new BackgroundWorker();
|
||||
bgw.WorkerReportsProgress = true;
|
||||
bgw.DoWork += (_, args) =>
|
||||
{
|
||||
for (int i = 0; i != 100; ++i)
|
||||
{
|
||||
bgw.ReportProgress(i);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
};
|
||||
bgw.ProgressChanged += (_, args) =>
|
||||
{
|
||||
label1.Text = args.ProgressPercentage.ToString();
|
||||
};
|
||||
bgw.RunWorkerCompleted += (_, args) =>
|
||||
{
|
||||
label1.Text = "Completed.";
|
||||
};
|
||||
bgw.RunWorkerAsync();
|
||||
#endif
|
||||
|
||||
var bgw = new BackgroundWorker();
|
||||
bgw.WorkerReportsProgress = true;
|
||||
bgw.DoWork += (_, args) =>
|
||||
{
|
||||
for (int i = 0; i != 100; ++i)
|
||||
{
|
||||
bgw.ReportProgress(0, "Stage " + i);
|
||||
Thread.Sleep(20);
|
||||
}
|
||||
};
|
||||
bgw.ProgressChanged += (_, args) =>
|
||||
{
|
||||
label1.Text = (string)args.UserState;
|
||||
};
|
||||
bgw.RunWorkerCompleted += (_, args) =>
|
||||
{
|
||||
label1.Text = "Completed.";
|
||||
};
|
||||
bgw.RunWorkerAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Testing di TASK
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task procTask()
|
||||
{
|
||||
#if false
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
});
|
||||
MessageBox.Show("Hi from the UI thread!");
|
||||
#endif
|
||||
|
||||
#if false
|
||||
try
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
throw new InvalidOperationException("Hi!");
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if false
|
||||
var result = await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
return 13;
|
||||
});
|
||||
MessageBox.Show("Result is " + result);
|
||||
#endif
|
||||
|
||||
#if false
|
||||
_cts = new CancellationTokenSource();
|
||||
var token = _cts.Token;
|
||||
try
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
for (int i = 0; i != 100; ++i)
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
});
|
||||
MessageBox.Show("Completed.");
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
MessageBox.Show("Cancelled.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if false
|
||||
var progressHandler = new Progress<int>(value =>
|
||||
{
|
||||
label2.Text = value.ToString();
|
||||
});
|
||||
var progress = progressHandler as IProgress<int>;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
for (int i = 0; i != 100; ++i)
|
||||
{
|
||||
if (progress != null)
|
||||
{
|
||||
progress.Report(i);
|
||||
}
|
||||
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
});
|
||||
label2.Text = "Completed.";
|
||||
#endif
|
||||
|
||||
var progressHandler = new Progress<string>(value =>
|
||||
{
|
||||
label2.Text = value;
|
||||
});
|
||||
var progress = progressHandler as IProgress<string>;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
for (int i = 0; i != 100; ++i)
|
||||
{
|
||||
if (progress != null)
|
||||
{
|
||||
progress.Report("Stage " + i);
|
||||
}
|
||||
|
||||
Thread.Sleep(20);
|
||||
}
|
||||
});
|
||||
label2.Text = "Completed.";
|
||||
|
||||
}
|
||||
|
||||
private void cancelBW()
|
||||
{
|
||||
// esegue cancellazione TASK
|
||||
if (_bgw != null)
|
||||
{
|
||||
_bgw.CancelAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_cts != null)
|
||||
{
|
||||
_cts.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnInit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnResetParam_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtMConnectID.Text = "MCID-0000-1234-5678";
|
||||
chkTestMode.Checked = true;
|
||||
txtConnParam.Text = "127.0.0.1,abortConnect=false,ssl=false";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -57,6 +57,9 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
Reference in New Issue
Block a user