From e302e8b8529f0d050b4717fbda7b78c2838e9d64 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 26 Sep 2020 16:44:51 +0200 Subject: [PATCH] COmpilazione progetto Iob.Net con apertura UI ext+varie --- IOB-NET.sln | 34 ++++ Iob.Core/ExceptionManager.cs | 172 ++++++++++++++++ Iob.Core/Iob.Core.csproj | 7 +- Iob.Core/packages.config | 4 +- Iob.Model/App_Readme/README_SteamWare.txt | 12 ++ .../SteamWare_demo/example-favicon.ico | Bin 0 -> 31702 bytes Iob.Model/ErrorMessageModel.cs | 20 ++ Iob.Model/Iob.Model.csproj | 19 ++ Iob.Model/packages.config | 5 + Iob.Net.UI/App.config | 42 +++- Iob.Net.UI/Form1.Designer.cs | 40 ---- Iob.Net.UI/Form1.cs | 20 -- Iob.Net.UI/Iob.Net.UI.csproj | 9 +- Iob.Net.UI/IobControlWindow.Designer.cs | 87 +++++++++ Iob.Net.UI/IobControlWindow.cs | 66 +++++++ Iob.Net.UI/IobControlWindow.resx | 120 ++++++++++++ Iob.Net.UI/Program.cs | 2 +- Iob.Net/App.config | 46 +++++ Iob.Net/App_Readme/README_SteamWare.txt | 12 ++ .../SteamWare_demo/example-favicon.ico | Bin 0 -> 31702 bytes Iob.Net/Iob.Net.csproj | 100 ++++++++++ Iob.Net/NLog.config | 80 ++++++++ Iob.Net/Program.cs | 184 ++++++++++++++++++ Iob.Net/Properties/AssemblyInfo.cs | 36 ++++ Iob.Net/Properties/Resources.Designer.cs | 71 +++++++ Iob.Net/Properties/Resources.resx | 117 +++++++++++ Iob.Net/Properties/Settings.Designer.cs | 30 +++ Iob.Net/Properties/Settings.settings | 7 + Iob.Net/logs/.placeholder | 1 + Iob.Net/packages.config | 5 + 30 files changed, 1278 insertions(+), 70 deletions(-) create mode 100644 Iob.Core/ExceptionManager.cs create mode 100644 Iob.Model/App_Readme/README_SteamWare.txt create mode 100644 Iob.Model/App_Readme/SteamWare_demo/example-favicon.ico create mode 100644 Iob.Model/ErrorMessageModel.cs create mode 100644 Iob.Model/packages.config delete mode 100644 Iob.Net.UI/Form1.Designer.cs delete mode 100644 Iob.Net.UI/Form1.cs create mode 100644 Iob.Net.UI/IobControlWindow.Designer.cs create mode 100644 Iob.Net.UI/IobControlWindow.cs create mode 100644 Iob.Net.UI/IobControlWindow.resx create mode 100644 Iob.Net/App.config create mode 100644 Iob.Net/App_Readme/README_SteamWare.txt create mode 100644 Iob.Net/App_Readme/SteamWare_demo/example-favicon.ico create mode 100644 Iob.Net/Iob.Net.csproj create mode 100644 Iob.Net/NLog.config create mode 100644 Iob.Net/Program.cs create mode 100644 Iob.Net/Properties/AssemblyInfo.cs create mode 100644 Iob.Net/Properties/Resources.Designer.cs create mode 100644 Iob.Net/Properties/Resources.resx create mode 100644 Iob.Net/Properties/Settings.Designer.cs create mode 100644 Iob.Net/Properties/Settings.settings create mode 100644 Iob.Net/logs/.placeholder create mode 100644 Iob.Net/packages.config 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 0000000000000000000000000000000000000000..4f0e0ad0a8300d86881040676f2c05f93ec4c1a3 GIT binary patch literal 31702 zcmeHQ33yf2o&P6+ko7Hj*%JxKA_;9>u%!k=XmD$-)>_3C$zrUnyQGky5-OObRw*h7 zBrFODByX{uX}|fp(fQhHXKHI(txjE7YFj(sj3czu5lhUO-~ZfuZqB>!-nWE+XgMDz z|8xG^+1L9&527^6q5Lw@A46S=V}$tqFq@;H++f6 z2RzH)JdP;yZWYg>o5vH~zJzE7>x5qc&wSFYFo5lE8scN>_id&P`!j`Mb{-kWxObWZ529F({4V(8SqrJ;D{0=n8>t)P;oC1iO64wPjHl~(mj7g0Cu<;H z4J5t(+m&F>dq&$2wAkq%<~Y`Y|FW+I2R6~UALcTvvi)ogdF*93<3|+F2MF>!os!$T zo@Tq0|3uvb>T3~~RgbIk+i|Y(J)M;0QhsiKS2>Nwc{pA!nf#>8gR{V&>~-+!S~>-V zN=Dc5DtpT5l!S7N%R=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e z$ea6d%$6;#<(tz`%Ywzu(nND5y{Y-rE)1SIunCyn($Yc|b-b&HaUZF}e+bdsdOg)Q z%>Bf?7&6sy0+}Ts)aTbW#M0+9%%`U2(}+r&o95Tes+(hHsY<8TmL`04yb*0UzqY|! zH(&qcF}Gn3lIP}cyzY{WIrHb9+t6T`F&K*K8a~x@oe^wqg&LYUzwV<(T>dSaw@6i9 zvkGWr`gq-W&1U0&q49$28g&|n=QL>Fh%aevU1VqQX^4wkTd%)LWkqCT$O)|L&O^&9t$%^5n(`ymYGEh*&Z> zJ6iW{+Id;haVN$TX_`t0XJ1|qB&{&$}^gU=iI?M+dLGe!~Kl<+yD zZAZ5F_6m|`ij~{5L~!dk@skJf-UDZe7xeQ2&JC__I&fZi4eb{5rUPw@?4R@}>)>P` z7`r||r_7ADT%Kf$)2UGgr$p5=dG0e^zK^E!Y@?jVM>DE3w6_Jmz_c0JzJQ{W&r@AF zp*rC62gXU9uW&{YO`8!Y@a4&P!E_`yt$Lyo2*~YG@yyA5(adgIdCh6l=#&{Vr&L#A zrkhqXt){djKvQPSm^ou&MNM^Px-SsmeQ#BDRdsb$S&kns6HQlxq6W0x_0i6={}21I BZR`L5 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..4f0e0ad0a8300d86881040676f2c05f93ec4c1a3 GIT binary patch literal 31702 zcmeHQ33yf2o&P6+ko7Hj*%JxKA_;9>u%!k=XmD$-)>_3C$zrUnyQGky5-OObRw*h7 zBrFODByX{uX}|fp(fQhHXKHI(txjE7YFj(sj3czu5lhUO-~ZfuZqB>!-nWE+XgMDz z|8xG^+1L9&527^6q5Lw@A46S=V}$tqFq@;H++f6 z2RzH)JdP;yZWYg>o5vH~zJzE7>x5qc&wSFYFo5lE8scN>_id&P`!j`Mb{-kWxObWZ529F({4V(8SqrJ;D{0=n8>t)P;oC1iO64wPjHl~(mj7g0Cu<;H z4J5t(+m&F>dq&$2wAkq%<~Y`Y|FW+I2R6~UALcTvvi)ogdF*93<3|+F2MF>!os!$T zo@Tq0|3uvb>T3~~RgbIk+i|Y(J)M;0QhsiKS2>Nwc{pA!nf#>8gR{V&>~-+!S~>-V zN=Dc5DtpT5l!S7N%R=6jmEZJCO(eXxpMJWxkA?vMiv7@qiTF=+dU==v1yB1$LB#OI zLC>`(dY;E1f7bdR2>Xu|JY9hDv-gVt!egNS1ET_EeowW%f*+X7k3mK&LfMsi|1Sx7 zZgErl=7W^0=06_)ZhRjAJkQsb^X{B5sUYm#Su&VE+d?`7uEMp!79~ z^Q6aB`R%y4an<$~+)S@K=uImK`Tp#W_};P6I1k6m#VrRiF)BLlLVs_So$o^X2wyE? zb*b@G9P$3M1O0f_LCWbAMSRck9EdsKHaB71dH(@^nD0g1c+@;v70lyLHqsS_a>{t0 zq2ebREDCyl#Q6@G`+&lonbXHAk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U=iI?M+dLGe!~Kl<+yD zZAZ5F_6m|`ij~{5L~!dk@skJf-UDZe7xeQ2&JC__I&fZi4eb{5rUPw@?4R@}>)>P` z7`r||r_7ADT%Kf$)2UGgr$p5=dG0e^zK^E!Y@?jVM>DE3w6_Jmz_c0JzJQ{W&r@AF zp*rC62gXU9uW&{YO`8!Y@a4&P!E_`yt$Lyo2*~YG@yyA5(adgIdCh6l=#&{Vr&L#A zrkhqXt){djKvQPSm^ou&MNM^Px-SsmeQ#BDRdsb$S&kns6HQlxq6W0x_0i6={}21I BZR`L5 literal 0 HcmV?d00001 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