Explorar o código

display log in c++ on sysmgrApp

gsp %!s(int64=2) %!d(string=hai) anos
pai
achega
18dccbc5ac

+ 1 - 0
OTSCPP/OTSControl/Bruker/OTSBrukerImpl.cpp

@@ -918,6 +918,7 @@ namespace OTSController {
 			CPoint poi = a_listXrayPois[i]->GetPosition();
 			segmentArray[i].Y = poi.y;
 			segmentArray[i].XStart = poi.x;
+			segmentArray[i].XCount = 1;
 		}
 
 		// ask bruker to collect a set of x ray data

+ 6 - 9
OTSCPP/OTSControl/OTSControl.vcxproj.filters

@@ -24,9 +24,6 @@
     <Filter Include="Base">
       <UniqueIdentifier>{b5a92d79-355e-4974-9f77-184bcf1a1613}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Bruker\DynamicLoad">
-      <UniqueIdentifier>{b6b7f3e7-433f-4db7-9a52-16287b31dac7}</UniqueIdentifier>
-    </Filter>
   </ItemGroup>
   <ItemGroup>
     <Text Include="ReadMe.txt" />
@@ -95,15 +92,15 @@
     <ClCompile Include="OTSSemBase.cpp">
       <Filter>Base</Filter>
     </ClCompile>
-    <ClCompile Include="Bruker\BrukerSPXFileMgr.cpp">
-      <Filter>Bruker\DynamicLoad</Filter>
-    </ClCompile>
     <ClCompile Include="Bruker\Bruker.API.CommonFunctions.cpp">
       <Filter>Bruker</Filter>
     </ClCompile>
     <ClCompile Include="Bruker\Bruker.API.Esprit.cpp">
       <Filter>Bruker</Filter>
     </ClCompile>
+    <ClCompile Include="Bruker\BrukerSPXFileMgr.cpp">
+      <Filter>Bruker</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="OTSControl.h">
@@ -184,9 +181,6 @@
     <ClInclude Include="OTSScanBase.h">
       <Filter>Base</Filter>
     </ClInclude>
-    <ClInclude Include="Bruker\BrukerSPXFileMgr.h">
-      <Filter>Bruker\DynamicLoad</Filter>
-    </ClInclude>
     <ClInclude Include="Bruker\Bruker.API.CommonFunctions.h">
       <Filter>Bruker</Filter>
     </ClInclude>
@@ -196,6 +190,9 @@
     <ClInclude Include="Bruker\Bruker.API.Esprit.h">
       <Filter>Bruker</Filter>
     </ClInclude>
+    <ClInclude Include="Bruker\BrukerSPXFileMgr.h">
+      <Filter>Bruker</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="hardwareClass.cd" />

+ 5 - 0
OTSCPP/OTSLog/COTSUtilityDllFunExport.cpp

@@ -229,6 +229,11 @@ bool SendLogMessageToNlog(LPCTSTR Msg, int postLogLevel)
 				   m_hWnd = hd;
 				   break;
 			   }
+				if (winTxt.Find(_T("SysMgrApp")) > -1)//find the sysmgrApp app mainform
+				{
+					m_hWnd = hd;
+					break;
+				}
 		       hd = GetNextWindow(hd, GW_HWNDNEXT);
 		     }
 

+ 51 - 48
OTSSysMgrApp/OTSSystemManagerForms.Designer.cs

@@ -56,10 +56,10 @@
             this.tabLanguage.Controls.Add(this.pictureBox3);
             this.tabLanguage.Controls.Add(this.rdb_en);
             this.tabLanguage.Controls.Add(this.rdb_ch);
-            this.tabLanguage.Location = new System.Drawing.Point(4, 25);
-            this.tabLanguage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.tabLanguage.Location = new System.Drawing.Point(4, 22);
+            this.tabLanguage.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.tabLanguage.Name = "tabLanguage";
-            this.tabLanguage.Size = new System.Drawing.Size(732, 172);
+            this.tabLanguage.Size = new System.Drawing.Size(545, 127);
             this.tabLanguage.TabIndex = 2;
             this.tabLanguage.Text = "语言";
             this.tabLanguage.UseVisualStyleBackColor = true;
@@ -67,10 +67,10 @@
             // pictureBox3
             // 
             this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
-            this.pictureBox3.Location = new System.Drawing.Point(51, 28);
-            this.pictureBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.pictureBox3.Location = new System.Drawing.Point(38, 22);
+            this.pictureBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.pictureBox3.Name = "pictureBox3";
-            this.pictureBox3.Size = new System.Drawing.Size(89, 82);
+            this.pictureBox3.Size = new System.Drawing.Size(67, 66);
             this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
             this.pictureBox3.TabIndex = 8;
             this.pictureBox3.TabStop = false;
@@ -79,10 +79,10 @@
             // 
             this.rdb_en.AutoSize = true;
             this.rdb_en.Checked = true;
-            this.rdb_en.Location = new System.Drawing.Point(196, 72);
-            this.rdb_en.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.rdb_en.Location = new System.Drawing.Point(147, 58);
+            this.rdb_en.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.rdb_en.Name = "rdb_en";
-            this.rdb_en.Size = new System.Drawing.Size(90, 19);
+            this.rdb_en.Size = new System.Drawing.Size(71, 16);
             this.rdb_en.TabIndex = 0;
             this.rdb_en.TabStop = true;
             this.rdb_en.Text = "英文[EN]";
@@ -92,10 +92,10 @@
             // rdb_ch
             // 
             this.rdb_ch.AutoSize = true;
-            this.rdb_ch.Location = new System.Drawing.Point(196, 31);
-            this.rdb_ch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.rdb_ch.Location = new System.Drawing.Point(147, 25);
+            this.rdb_ch.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.rdb_ch.Name = "rdb_ch";
-            this.rdb_ch.Size = new System.Drawing.Size(90, 19);
+            this.rdb_ch.Size = new System.Drawing.Size(71, 16);
             this.rdb_ch.TabIndex = 0;
             this.rdb_ch.Text = "中文[ZH]";
             this.rdb_ch.UseVisualStyleBackColor = true;
@@ -107,10 +107,10 @@
             this.tabControl1.Controls.Add(this.tabLanguage);
             this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tabControl1.Location = new System.Drawing.Point(0, 0);
-            this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.tabControl1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.tabControl1.Name = "tabControl1";
             this.tabControl1.SelectedIndex = 0;
-            this.tabControl1.Size = new System.Drawing.Size(737, 191);
+            this.tabControl1.Size = new System.Drawing.Size(554, 159);
             this.tabControl1.TabIndex = 0;
             // 
             // tabHardwareSet
@@ -124,11 +124,11 @@
             this.tabHardwareSet.Controls.Add(this.pictureBox2);
             this.tabHardwareSet.Controls.Add(this.button2);
             this.tabHardwareSet.Controls.Add(this.button1);
-            this.tabHardwareSet.Location = new System.Drawing.Point(4, 25);
-            this.tabHardwareSet.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.tabHardwareSet.Location = new System.Drawing.Point(4, 22);
+            this.tabHardwareSet.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.tabHardwareSet.Name = "tabHardwareSet";
-            this.tabHardwareSet.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.tabHardwareSet.Size = new System.Drawing.Size(729, 162);
+            this.tabHardwareSet.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.tabHardwareSet.Size = new System.Drawing.Size(546, 133);
             this.tabHardwareSet.TabIndex = 1;
             this.tabHardwareSet.Text = "硬件";
             this.tabHardwareSet.UseVisualStyleBackColor = true;
@@ -144,10 +144,10 @@
             "ZEISS",
             "Oxford",
             "FEI"});
-            this.CmbSEMController.Location = new System.Drawing.Point(303, 28);
-            this.CmbSEMController.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.CmbSEMController.Location = new System.Drawing.Point(227, 22);
+            this.CmbSEMController.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.CmbSEMController.Name = "CmbSEMController";
-            this.CmbSEMController.Size = new System.Drawing.Size(256, 23);
+            this.CmbSEMController.Size = new System.Drawing.Size(193, 20);
             this.CmbSEMController.TabIndex = 13;
             this.CmbSEMController.SelectedIndexChanged += new System.EventHandler(this.CmbSEMController_SelectedIndexChanged);
             // 
@@ -160,19 +160,19 @@
             "OffLine",
             "Oxford",
             "FEI"});
-            this.CmbEDSController.Location = new System.Drawing.Point(303, 92);
-            this.CmbEDSController.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.CmbEDSController.Location = new System.Drawing.Point(227, 74);
+            this.CmbEDSController.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.CmbEDSController.Name = "CmbEDSController";
-            this.CmbEDSController.Size = new System.Drawing.Size(256, 23);
+            this.CmbEDSController.Size = new System.Drawing.Size(193, 20);
             this.CmbEDSController.TabIndex = 14;
             this.CmbEDSController.SelectedIndexChanged += new System.EventHandler(this.CmbEDSController_SelectedIndexChanged);
             // 
             // btnEDSTest
             // 
-            this.btnEDSTest.Location = new System.Drawing.Point(572, 88);
-            this.btnEDSTest.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.btnEDSTest.Location = new System.Drawing.Point(429, 70);
+            this.btnEDSTest.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.btnEDSTest.Name = "btnEDSTest";
-            this.btnEDSTest.Size = new System.Drawing.Size(103, 30);
+            this.btnEDSTest.Size = new System.Drawing.Size(77, 24);
             this.btnEDSTest.TabIndex = 12;
             this.btnEDSTest.Text = "EDS测试";
             this.btnEDSTest.UseVisualStyleBackColor = true;
@@ -180,10 +180,10 @@
             // 
             // btnSEMTest
             // 
-            this.btnSEMTest.Location = new System.Drawing.Point(572, 25);
-            this.btnSEMTest.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.btnSEMTest.Location = new System.Drawing.Point(429, 20);
+            this.btnSEMTest.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.btnSEMTest.Name = "btnSEMTest";
-            this.btnSEMTest.Size = new System.Drawing.Size(103, 30);
+            this.btnSEMTest.Size = new System.Drawing.Size(77, 24);
             this.btnSEMTest.TabIndex = 10;
             this.btnSEMTest.Text = "SEM测试";
             this.btnSEMTest.UseVisualStyleBackColor = true;
@@ -192,66 +192,69 @@
             // lblHEDSController
             // 
             this.lblHEDSController.AutoSize = true;
-            this.lblHEDSController.Location = new System.Drawing.Point(163, 92);
+            this.lblHEDSController.Location = new System.Drawing.Point(122, 74);
+            this.lblHEDSController.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.lblHEDSController.Name = "lblHEDSController";
-            this.lblHEDSController.Size = new System.Drawing.Size(76, 15);
+            this.lblHEDSController.Size = new System.Drawing.Size(59, 12);
             this.lblHEDSController.TabIndex = 8;
             this.lblHEDSController.Text = "EDS控制器";
             // 
             // lblHSEMController
             // 
             this.lblHSEMController.AutoSize = true;
-            this.lblHSEMController.Location = new System.Drawing.Point(163, 32);
+            this.lblHSEMController.Location = new System.Drawing.Point(122, 26);
+            this.lblHSEMController.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.lblHSEMController.Name = "lblHSEMController";
-            this.lblHSEMController.Size = new System.Drawing.Size(76, 15);
+            this.lblHSEMController.Size = new System.Drawing.Size(59, 12);
             this.lblHSEMController.TabIndex = 9;
             this.lblHSEMController.Text = "SEM控制器";
             // 
             // pictureBox2
             // 
             this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
-            this.pictureBox2.Location = new System.Drawing.Point(51, 28);
-            this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.pictureBox2.Location = new System.Drawing.Point(38, 22);
+            this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.pictureBox2.Name = "pictureBox2";
-            this.pictureBox2.Size = new System.Drawing.Size(89, 82);
+            this.pictureBox2.Size = new System.Drawing.Size(67, 66);
             this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
             this.pictureBox2.TabIndex = 7;
             this.pictureBox2.TabStop = false;
             // 
             // button2
             // 
-            this.button2.Location = new System.Drawing.Point(643, 458);
-            this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.button2.Location = new System.Drawing.Point(482, 366);
+            this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(89, 28);
+            this.button2.Size = new System.Drawing.Size(67, 22);
             this.button2.TabIndex = 2;
             this.button2.Text = "button1";
             this.button2.UseVisualStyleBackColor = true;
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(547, 458);
-            this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.button1.Location = new System.Drawing.Point(410, 366);
+            this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(89, 28);
+            this.button1.Size = new System.Drawing.Size(67, 22);
             this.button1.TabIndex = 2;
             this.button1.Text = "button1";
             this.button1.UseVisualStyleBackColor = true;
             // 
             // OTSSystemManagerForms
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.White;
-            this.ClientSize = new System.Drawing.Size(737, 191);
+            this.ClientSize = new System.Drawing.Size(554, 159);
             this.Controls.Add(this.tabControl1);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
-            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(755, 238);
-            this.MinimumSize = new System.Drawing.Size(755, 238);
+            this.MaximumSize = new System.Drawing.Size(570, 198);
+            this.MinimumSize = new System.Drawing.Size(570, 198);
             this.Name = "OTSSystemManagerForms";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "SysMgrApp";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OTSSystemManagerForms_FormClosing);
             this.Load += new System.EventHandler(this.OTSSystemManagerForms_Load);
             this.tabLanguage.ResumeLayout(false);

+ 59 - 0
OTSSysMgrApp/OTSSystemManagerForms.cs

@@ -11,11 +11,23 @@ using System.IO;
 using System.Windows.Forms;
 using Microsoft.Win32;
 using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace OTSSysMgrApp
 {
+    public struct PostLogMsg
+    {
+        public int logLevel;//1 trace 2 debug 3info 4 warn 5 error 6 fatal
+        [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)200)]
+        public char[] logMessage;
+    };
     public partial class OTSSystemManagerForms : Form
     {
+    
+
+        private PostLogMsg m_LogMsg;
+        public const int MsgID = 0x0464;
+        public const int LogMsgID = 0x0465;
         #region 全部变量声明
         //获取XML 路径
         static string xmlFilePath = string.Empty;// System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
@@ -51,6 +63,53 @@ namespace OTSSysMgrApp
             table = lan.GetNameTable(this.Name);
             rdb_ch.Checked = true;
         }
+        private string GetString(char[] csStr)
+        {
+            int ilen = csStr.Length;
+            string csName = new string(csStr);                //MSTMsg.STMSampleStu.cSName
+            csName.IndexOf('\0');
+            csName = csName.Substring(0, csName.IndexOf('\0'));
+            return csName;
+        }
+        protected override void DefWndProc(ref Message m)
+        {
+            switch (m.Msg)
+            {
+
+                case LogMsgID:
+                    m_LogMsg = new PostLogMsg();
+
+                    m_LogMsg = (PostLogMsg)Marshal.PtrToStructure(m.LParam, typeof(PostLogMsg));
+                    var log = NLog.LogManager.GetCurrentClassLogger();
+                    string s = GetString(m_LogMsg.logMessage);
+                    switch (m_LogMsg.logLevel)
+                    {
+                        case 1:
+                            log.Trace(s);
+                            break;
+                        case 2:
+                            log.Debug(s);
+                            break;
+                        case 3:
+                            log.Info(s);
+                            break;
+                        case 4:
+                            log.Warn(s);
+                            break;
+                        case 5:
+                            log.Error(s);
+                            break;
+                        case 6:
+                            log.Fatal(s);
+                            break;
+                    }
+
+                    break;
+                default:
+                    base.DefWndProc(ref m);
+                    break;
+            }
+        }
         #endregion
 
         #region 保存设置