diff --git a/IOB-NET.sln b/IOB-NET.sln
index c9dcae92..366fa4c4 100644
--- a/IOB-NET.sln
+++ b/IOB-NET.sln
@@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iob.Model", "Iob.Model\Iob.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iob.Net.UI", "Iob.Net.UI\Iob.Net.UI.csproj", "{4E796675-57FF-49EE-B722-DBF4747F786A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iob.Net", "Iob.Net\Iob.Net.csproj", "{D06820DD-5A07-4A8F-B7C5-D731B71B3F52}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CMS-FANUC|Any CPU = CMS-FANUC|Any CPU
@@ -300,6 +302,38 @@ Global
{4E796675-57FF-49EE-B722-DBF4747F786A}.SIEMENS|Any CPU.Build.0 = Release|Any CPU
{4E796675-57FF-49EE-B722-DBF4747F786A}.SIEMENS|x86.ActiveCfg = Release|Any CPU
{4E796675-57FF-49EE-B722-DBF4747F786A}.SIEMENS|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-FANUC|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-FANUC|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-OSAI|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-OSAI|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-OSAI|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-SIEMENS|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-SIEMENS|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.CMS-SIEMENS|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Debug|x86.Build.0 = Debug|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.FANUC|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.FANUC|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.FANUC|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.FANUC|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Release|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.Release|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SCM-ESA|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SCM-ESA|x86.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SIEMENS|Any CPU.Build.0 = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SIEMENS|x86.ActiveCfg = Release|Any CPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}.SIEMENS|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Iob.Core/ExceptionManager.cs b/Iob.Core/ExceptionManager.cs
new file mode 100644
index 00000000..afa00843
--- /dev/null
+++ b/Iob.Core/ExceptionManager.cs
@@ -0,0 +1,172 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using static SteamWare.Logger.Logging;
+using static SteamWare.Logger.Constants;
+using Iob.Model;
+
+namespace Iob.Core
+{
+ public static class ExceptionManager
+ {
+ #region Private Fields
+
+ private static bool MessageBoxShow = false;
+
+ #endregion Private Fields
+
+
+
+ #region Public Methods
+
+ public static string GetExceptionMethodName(Exception ex)
+ {
+ var s = new StackTrace(ex, true);
+ var thisasm = Assembly.GetExecutingAssembly();
+
+ Console.WriteLine(s.GetFrames().Count());
+ foreach (var a in s.GetFrames())
+ {
+ var d = a.GetMethod();
+ Console.WriteLine(d.Name);
+ }
+
+ return s.GetFrames().FirstOrDefault()?.GetMethod().Name;
+ }
+
+ public static void ManageError(ERROR_LEVEL errorLevel, string message, bool beforeFormReady = false)
+ {
+ switch (errorLevel)
+ {
+ case ERROR_LEVEL.INFO:
+ {
+ // Log
+ LogInfo(message);
+ // Notify users
+ NotifyUsers(CreateMessageModel("Info!", message, ERROR_LEVEL.INFO));
+ }
+ break;
+
+ case ERROR_LEVEL.WARNING:
+ {
+ LogWarning(message);
+ NotifyUsers(CreateMessageModel("Warning!", message, ERROR_LEVEL.WARNING));
+ }
+ break;
+
+ case ERROR_LEVEL.ERROR:
+ {
+ LogError(message);
+ NotifyUsersAndClose(CreateMessageModel("Error!", message, ERROR_LEVEL.ERROR));
+ }
+ break;
+
+ case ERROR_LEVEL.FATAL:
+ {
+ LogFatal(message);
+ if (!MessageBoxShow)
+ {
+ MessageBoxShow = true;
+ NotifyUsersAndClose(CreateMessageModel("Fatal Error!", message, ERROR_LEVEL.FATAL), beforeFormReady);
+ // Check if the server form is ready (if not i have to close manually)
+ if (beforeFormReady)
+ // Close the application
+ Environment.Exit(1);
+ }
+ }
+ break;
+
+ default:
+ {
+ LogFatal(message);
+ if (!MessageBoxShow)
+ {
+ MessageBoxShow = true;
+ NotifyUsersAndClose(CreateMessageModel("Generic Error!", message, ERROR_LEVEL.FATAL), beforeFormReady);
+ }
+ }
+ break;
+ }
+ }
+
+ public static void ManageException(ERROR_LEVEL errorLevel, Exception exception)
+ {
+ string message = exception.Message;
+ if (exception.InnerException != null)
+ {
+ // Add inner exception message (if exists)
+ message += " | " + exception.InnerException.Message;
+ }
+
+ // Add method name
+ message += " | " + GetExceptionMethodName(exception);
+
+ ManageError(errorLevel, message);
+ }
+
+ #endregion Public Methods
+
+
+
+ #region Private Methods
+
+ private static ErrorMessageModel CreateMessageModel(string title, string message, ERROR_LEVEL level, string methodName = "")
+ {
+ if (methodName != "")
+ message = message + " | " + methodName;
+
+ return new ErrorMessageModel()
+ {
+ Title = title,
+ Message = message,
+ ErrorLevel = level
+ };
+ }
+
+ private static void LogAndNotifyUsers(ErrorMessageModel error)
+ {
+ // Log
+ LogMessage(error.Message, (ERROR_LEVEL)error.ErrorLevel);
+ NotifyUsersAndClose(error);
+ }
+
+ private static void NotifyUsers(ErrorMessageModel error, bool beforeFormReady = false)
+ {
+#if false
+ if (beforeFormReady)
+ {
+ MessageBox.Show(new Form { TopMost = true }, error.Message, error.Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ else
+ {
+ MessageServices.Current.Publish(SEND_MESSAGE, null, error);
+ }
+#endif
+ }
+
+ private static void NotifyUsersAndClose(ErrorMessageModel error, bool beforeFormReady = false)
+ {
+#if false
+ if (beforeFormReady)
+ {
+ // Notify user
+ MessageServices.Current.Publish(SEND_STOP_THREADS);
+ MessageBox.Show(new Form { TopMost = true }, error.Message, error.Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageServices.Current.Publish(SEND_STOP_SERVER);
+ }
+ else
+ {
+ // Notify user
+ //MessageServices.Current.Publish(SEND_STOP_THREADS);
+ MessageServices.Current.Publish(SEND_MESSAGE, null, error);
+ }
+#endif
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/Iob.Core/Iob.Core.csproj b/Iob.Core/Iob.Core.csproj
index f2c1c146..f068497f 100644
--- a/Iob.Core/Iob.Core.csproj
+++ b/Iob.Core/Iob.Core.csproj
@@ -76,10 +76,10 @@
..\packages\StackExchange.Redis.2.1.58\lib\net461\StackExchange.Redis.dll
- ..\packages\SteamWare.IO.4.9.2009.739\lib\net462\SteamWare.IO.dll
+ ..\packages\SteamWare.IO.4.9.2009.740\lib\net462\SteamWare.IO.dll
-
- ..\packages\SteamWare.Logger.4.9.2009.739\lib\net462\SteamWare.Logger.dll
+
+ ..\packages\SteamWare.Logger.4.9.2009.740\lib\net462\SteamWare.Logger.dll
@@ -145,6 +145,7 @@
VersGen.cs
+
diff --git a/Iob.Core/packages.config b/Iob.Core/packages.config
index a65686fd..6554bf54 100644
--- a/Iob.Core/packages.config
+++ b/Iob.Core/packages.config
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/Iob.Model/App_Readme/README_SteamWare.txt b/Iob.Model/App_Readme/README_SteamWare.txt
new file mode 100644
index 00000000..bf60ed18
--- /dev/null
+++ b/Iob.Model/App_Readme/README_SteamWare.txt
@@ -0,0 +1,12 @@
+---------------------------------------------------------------
+------- SteamWareLib SDK -------
+---------------------------------------------------------------
+
+Libreria di utility base di SteamWare.
+
+Le dipendenze inserite sono necessarie al funzionamento dell'SDK.
+
+Sono inclusi a titolo di esempio vari files di conf:
+ * example-NLog.config
+
+Attenzione a configurare correttamente il file NLog.xml includendo il rule per la classe, vedere ad esempio il file example-NLog.config allegato.
\ No newline at end of file
diff --git a/Iob.Model/App_Readme/SteamWare_demo/example-favicon.ico b/Iob.Model/App_Readme/SteamWare_demo/example-favicon.ico
new file mode 100644
index 00000000..4f0e0ad0
Binary files /dev/null and b/Iob.Model/App_Readme/SteamWare_demo/example-favicon.ico differ
diff --git a/Iob.Model/ErrorMessageModel.cs b/Iob.Model/ErrorMessageModel.cs
new file mode 100644
index 00000000..e6e86ac2
--- /dev/null
+++ b/Iob.Model/ErrorMessageModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static SteamWare.Logger.Constants;
+
+namespace Iob.Model
+{
+ public class ErrorMessageModel
+ {
+ #region Public Properties
+
+ public ERROR_LEVEL ErrorLevel { get; set; }
+ public string Message { get; set; }
+ public string Title { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/Iob.Model/Iob.Model.csproj b/Iob.Model/Iob.Model.csproj
index b289f98a..3ecbaf8a 100644
--- a/Iob.Model/Iob.Model.csproj
+++ b/Iob.Model/Iob.Model.csproj
@@ -31,8 +31,19 @@
4
+
+ ..\packages\NLog.4.7.4\lib\net45\NLog.dll
+
+
+ ..\packages\SteamWare.Logger.4.9.2009.740\lib\net462\SteamWare.Logger.dll
+
+
+
+
+
+
@@ -41,11 +52,19 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Iob.Model/packages.config b/Iob.Model/packages.config
new file mode 100644
index 00000000..b270f0f1
--- /dev/null
+++ b/Iob.Model/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Iob.Net.UI/App.config b/Iob.Net.UI/App.config
index b50c74f3..8216d940 100644
--- a/Iob.Net.UI/App.config
+++ b/Iob.Net.UI/App.config
@@ -1,6 +1,46 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Iob.Net.UI/Form1.Designer.cs b/Iob.Net.UI/Form1.Designer.cs
deleted file mode 100644
index f84bfe72..00000000
--- a/Iob.Net.UI/Form1.Designer.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace Iob.Net.UI
-{
- partial class Form1
- {
- ///
- /// Variabile di progettazione necessaria.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Pulire le risorse in uso.
- ///
- /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Codice generato da Progettazione Windows Form
-
- ///
- /// Metodo necessario per il supporto della finestra di progettazione. Non modificare
- /// il contenuto del metodo con l'editor di codice.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
-
diff --git a/Iob.Net.UI/Form1.cs b/Iob.Net.UI/Form1.cs
deleted file mode 100644
index e98ef90d..00000000
--- a/Iob.Net.UI/Form1.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Iob.Net.UI
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/Iob.Net.UI/Iob.Net.UI.csproj b/Iob.Net.UI/Iob.Net.UI.csproj
index 65e41a10..83574964 100644
--- a/Iob.Net.UI/Iob.Net.UI.csproj
+++ b/Iob.Net.UI/Iob.Net.UI.csproj
@@ -49,14 +49,17 @@
VersGen.cs
-
+
Form
-
- Form1.cs
+
+ IobControlWindow.cs
+
+ IobControlWindow.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/Iob.Net.UI/IobControlWindow.Designer.cs b/Iob.Net.UI/IobControlWindow.Designer.cs
new file mode 100644
index 00000000..6862fbd6
--- /dev/null
+++ b/Iob.Net.UI/IobControlWindow.Designer.cs
@@ -0,0 +1,87 @@
+namespace Iob.Net.UI
+{
+ partial class IobControlWindow
+ {
+ ///
+ /// Variabile di progettazione necessaria.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Pulire le risorse in uso.
+ ///
+ /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Codice generato da Progettazione Windows Form
+
+ ///
+ /// Metodo necessario per il supporto della finestra di progettazione. Non modificare
+ /// il contenuto del metodo con l'editor di codice.
+ ///
+ private void InitializeComponent()
+ {
+ this.tabControl1 = new System.Windows.Forms.TabControl();
+ this.tabPage1 = new System.Windows.Forms.TabPage();
+ this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.tabControl1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tabControl1
+ //
+ this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Controls.Add(this.tabPage2);
+ this.tabControl1.Location = new System.Drawing.Point(12, 48);
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size(776, 395);
+ this.tabControl1.TabIndex = 0;
+ //
+ // tabPage1
+ //
+ this.tabPage1.Location = new System.Drawing.Point(4, 25);
+ this.tabPage1.Name = "tabPage1";
+ this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage1.Size = new System.Drawing.Size(768, 366);
+ this.tabPage1.TabIndex = 0;
+ this.tabPage1.Text = "tabPage1";
+ this.tabPage1.UseVisualStyleBackColor = true;
+ //
+ // tabPage2
+ //
+ this.tabPage2.Location = new System.Drawing.Point(4, 25);
+ this.tabPage2.Name = "tabPage2";
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage2.Size = new System.Drawing.Size(192, 71);
+ this.tabPage2.TabIndex = 1;
+ this.tabPage2.Text = "tabPage2";
+ this.tabPage2.UseVisualStyleBackColor = true;
+ //
+ // IobControlWindow
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.tabControl1);
+ this.Name = "IobControlWindow";
+ this.Text = "Iob.Net";
+ this.tabControl1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.TabPage tabPage1;
+ private System.Windows.Forms.TabPage tabPage2;
+ }
+}
+
diff --git a/Iob.Net.UI/IobControlWindow.cs b/Iob.Net.UI/IobControlWindow.cs
new file mode 100644
index 00000000..c93f34ed
--- /dev/null
+++ b/Iob.Net.UI/IobControlWindow.cs
@@ -0,0 +1,66 @@
+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;
+
+namespace Iob.Net.UI
+{
+ public partial class IobControlWindow : Form
+ {
+ #region Private Fields
+
+ private static IobControlWindow ctrlwindow = null;
+
+ private bool _closing = false;
+
+ #endregion Private Fields
+
+ #region Public Constructors
+
+ public IobControlWindow()
+ {
+ InitializeComponent();
+ }
+
+ #endregion Public Constructors
+
+
+
+ #region Public Methods
+
+ public static void Start()
+ { // Open WinForm
+ Thread th = new Thread(() =>
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ ctrlwindow = new IobControlWindow();
+ Application.Run(ctrlwindow);
+ });
+
+ th.SetApartmentState(ApartmentState.STA);
+ th.Start();
+ }
+
+ public static void Stop()
+ { // Close WinForm
+ if (ctrlwindow != null)
+ {
+ ctrlwindow.Invoke((ThreadStart)delegate ()
+ {
+ ctrlwindow._closing = true;
+ ctrlwindow.Close();
+ ctrlwindow = null;
+ });
+ }
+ }
+
+ #endregion Public Methods
+ }
+}
\ No newline at end of file
diff --git a/Iob.Net.UI/IobControlWindow.resx b/Iob.Net.UI/IobControlWindow.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/Iob.Net.UI/IobControlWindow.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Iob.Net.UI/Program.cs b/Iob.Net.UI/Program.cs
index 2744f459..7e0b34bc 100644
--- a/Iob.Net.UI/Program.cs
+++ b/Iob.Net.UI/Program.cs
@@ -16,7 +16,7 @@ namespace Iob.Net.UI
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
+ Application.Run(new IobControlWindow());
}
}
}
diff --git a/Iob.Net/App.config b/Iob.Net/App.config
new file mode 100644
index 00000000..40fe857b
--- /dev/null
+++ b/Iob.Net/App.config
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Iob.Net/App_Readme/README_SteamWare.txt b/Iob.Net/App_Readme/README_SteamWare.txt
new file mode 100644
index 00000000..bf60ed18
--- /dev/null
+++ b/Iob.Net/App_Readme/README_SteamWare.txt
@@ -0,0 +1,12 @@
+---------------------------------------------------------------
+------- SteamWareLib SDK -------
+---------------------------------------------------------------
+
+Libreria di utility base di SteamWare.
+
+Le dipendenze inserite sono necessarie al funzionamento dell'SDK.
+
+Sono inclusi a titolo di esempio vari files di conf:
+ * example-NLog.config
+
+Attenzione a configurare correttamente il file NLog.xml includendo il rule per la classe, vedere ad esempio il file example-NLog.config allegato.
\ No newline at end of file
diff --git a/Iob.Net/App_Readme/SteamWare_demo/example-favicon.ico b/Iob.Net/App_Readme/SteamWare_demo/example-favicon.ico
new file mode 100644
index 00000000..4f0e0ad0
Binary files /dev/null and b/Iob.Net/App_Readme/SteamWare_demo/example-favicon.ico differ
diff --git a/Iob.Net/Iob.Net.csproj b/Iob.Net/Iob.Net.csproj
new file mode 100644
index 00000000..60a1991d
--- /dev/null
+++ b/Iob.Net/Iob.Net.csproj
@@ -0,0 +1,100 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {D06820DD-5A07-4A8F-B7C5-D731B71B3F52}
+ WinExe
+ Iob.Net
+ Iob.Net
+ v4.6.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\NLog.4.7.4\lib\net45\NLog.dll
+
+
+ ..\packages\SteamWare.Logger.4.9.2009.740\lib\net462\SteamWare.Logger.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ Always
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+ {4e796675-57ff-49ee-b722-dbf4747f786a}
+ Iob.Net.UI
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Iob.Net/NLog.config b/Iob.Net/NLog.config
new file mode 100644
index 00000000..483529dd
--- /dev/null
+++ b/Iob.Net/NLog.config
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Iob.Net/Program.cs b/Iob.Net/Program.cs
new file mode 100644
index 00000000..17e0f14d
--- /dev/null
+++ b/Iob.Net/Program.cs
@@ -0,0 +1,184 @@
+using Iob.Net.UI;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using static SteamWare.Logger.Logging;
+using static SteamWare.Logger.Constants;
+
+namespace Iob.Net
+{
+ internal static class Program
+ {
+ #region Public Methods
+
+ public static void Main()
+ {
+ LogInfo("Application started");
+
+ //Check if is already running an instance of this application
+ string AppName = System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location);
+ if (System.Diagnostics.Process.GetProcessesByName(AppName).Length > 1)
+ {
+ MessageBox.Show("Only one istance of " + AppName + " can be executed!", AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ // Create unhandled exception handler
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
+
+ // Create directories if they don't exist
+ CreateDirectories();
+
+#if false
+ // Read config
+ ServerConfigController.ReadStartupConfig();
+#endif
+
+ // Start WinForm
+ IobControlWindow.Start();
+
+#if false
+ bool databaseStatus = DatabaseContext.SetUpDbConnectionAndDbConfig();
+
+ // Register listener to "close application" messages
+ MessageServices.Current.Subscribe(SEND_STOP_SERVER, (a, b) =>
+ {
+ StopRequest.Set();
+ if (NcConfig.NcVendor.ToUpper() == NC_VENDOR.SIEMENS)
+ ThreadSiemensHmi.StopThread();
+ });
+
+ // Stop threads and disconnect from NC
+ MessageServices.Current.Subscribe(SEND_STOP_THREADS, (a, b) =>
+ {
+ using (NcAdapter ncAdapter = new NcAdapter())
+ ncAdapter.Disconnect();
+
+ // Stop Threads
+ ThreadsHandler.Close();
+ // Stop messageservice listeners
+ ListenersHandler.Stop();
+ });
+#endif
+
+#if false
+ // Start server services
+ if (!ValidateAddress(ServerStartupConfig.ServerAddress))
+ ExceptionManager.ManageError(ERROR_LEVEL.FATAL, "IP Address not valid (must be one configured in Windows-OS)!");
+
+ StartOptions opt = new StartOptions();
+ opt.Urls.Add("http://localhost:" + ServerStartupConfig.ServerPort.ToString());
+ opt.Urls.Add("http://127.0.0.1:" + ServerStartupConfig.ServerPort.ToString());
+
+ if (!string.IsNullOrWhiteSpace(ServerStartupConfig.ServerAddress.ToString()))
+ opt.Urls.Add("http://" + ServerStartupConfig.ServerAddress.ToString() + ":" + ServerStartupConfig.ServerPort.ToString());
+
+ // read and save last CURRENT RECIPE data...
+ NcFileAdapter.ReadLastRecipe();
+ RecipeController.WriteCurrentRecipeToPlc();
+#endif
+
+#if false
+ //starts threads
+ using (WebApp.Start(opt))
+ {
+ if (databaseStatus)
+ {
+ // Start Threads
+ ThreadsHandler.Start();
+ // Start listeners
+ ListenersHandler.Start();
+ }
+
+ // Wait interrupt from client
+ StopRequest.WaitOne();
+
+ using (NcAdapter ncAdapter = new NcAdapter())
+ ncAdapter.Disconnect();
+
+ LogInfo("Application closed");
+ }
+#endif
+
+#if false
+ // Stop Threads
+ ThreadsHandler.Close();
+ // Stop messageservice listeners
+ ListenersHandler.Stop();
+ // Close WinForm
+ ServerControlWindow.Stop();
+#endif
+ }
+
+ #endregion Public Methods
+
+
+
+ #region Private Methods
+
+ private static void CreateDirectories()
+ {
+#if false
+ if (!Directory.Exists(MAINTENANCE_ATTACHMENT_PATH))
+ Directory.CreateDirectory(MAINTENANCE_ATTACHMENT_PATH);
+ if (!Directory.Exists(ALARM_ATTACHMENT_PATH))
+ Directory.CreateDirectory(ALARM_ATTACHMENT_PATH);
+
+ if (!Directory.Exists(TEMP_PP_FOLDER))
+ Directory.CreateDirectory(TEMP_PP_FOLDER);
+
+ if (!Directory.Exists(PART_PRG_IMAGES))
+ Directory.CreateDirectory(PART_PRG_IMAGES);
+
+ if (!Directory.Exists(JOB_TMP_DIRECTORY))
+ Directory.CreateDirectory(JOB_TMP_DIRECTORY);
+
+ if (!Directory.Exists(QUEUE_TMP_FOLDER))
+ Directory.CreateDirectory(QUEUE_TMP_FOLDER);
+
+ if (!Directory.Exists(SCADA_DIRECTORY))
+ Directory.CreateDirectory(SCADA_DIRECTORY);
+#endif
+ }
+
+ private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
+ {
+#if false
+ using (NcAdapter ncAdapter = new NcAdapter())
+ {
+ if (ncAdapter.numericalControl.NC_IsConnected())
+ {
+ ncAdapter.Disconnect();
+ }
+ }
+
+ var exc = (Exception)args.ExceptionObject;
+
+ ManageException(ERROR_LEVEL.FATAL, exc);
+#endif
+ }
+
+ private static bool ValidateAddress(string Addr)
+ {
+ //If is an asterisk is OK
+ if (string.IsNullOrWhiteSpace(Addr) || Addr == "*")
+ return true;
+
+#if false
+ //Find an IP Address
+ foreach (IPAddress ipAddr in Array.FindAll(Dns.GetHostEntry(string.Empty).AddressList, a => a.AddressFamily == AddressFamily.InterNetwork))
+ {
+ if (ipAddr.ToString() == Addr)
+ return true;
+ }
+#endif
+
+ return false;
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/Iob.Net/Properties/AssemblyInfo.cs b/Iob.Net/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..21a3830d
--- /dev/null
+++ b/Iob.Net/Properties/AssemblyInfo.cs
@@ -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("Iob.Net")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Iob.Net")]
+[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("d06820dd-5a07-4a8f-b7c5-d731b71b3f52")]
+
+// 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")]
diff --git a/Iob.Net/Properties/Resources.Designer.cs b/Iob.Net/Properties/Resources.Designer.cs
new file mode 100644
index 00000000..2f4f6959
--- /dev/null
+++ b/Iob.Net/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// Codice generato da uno strumento.
+// Versione runtime:4.0.30319.42000
+//
+// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
+// il codice viene rigenerato.
+//
+//------------------------------------------------------------------------------
+
+namespace Iob.Net.Properties
+{
+
+
+ ///
+ /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
+ ///
+ // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
+ // tramite uno strumento quale ResGen o Visual Studio.
+ // Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
+ // con l'opzione /str oppure ricompilare il progetto VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Iob.Net.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
+ /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Iob.Net/Properties/Resources.resx b/Iob.Net/Properties/Resources.resx
new file mode 100644
index 00000000..af7dbebb
--- /dev/null
+++ b/Iob.Net/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Iob.Net/Properties/Settings.Designer.cs b/Iob.Net/Properties/Settings.Designer.cs
new file mode 100644
index 00000000..de80b761
--- /dev/null
+++ b/Iob.Net/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Iob.Net.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Iob.Net/Properties/Settings.settings b/Iob.Net/Properties/Settings.settings
new file mode 100644
index 00000000..39645652
--- /dev/null
+++ b/Iob.Net/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Iob.Net/logs/.placeholder b/Iob.Net/logs/.placeholder
new file mode 100644
index 00000000..5f282702
--- /dev/null
+++ b/Iob.Net/logs/.placeholder
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Iob.Net/packages.config b/Iob.Net/packages.config
new file mode 100644
index 00000000..b270f0f1
--- /dev/null
+++ b/Iob.Net/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file