diff --git a/Cs_HMI/AGVCSharp.sln b/Cs_HMI/AGVCSharp.sln
index 3403360..c4910f1 100644
--- a/Cs_HMI/AGVCSharp.sln
+++ b/Cs_HMI/AGVCSharp.sln
@@ -1,41 +1,29 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.9.34714.143
+# Visual Studio Express 15 for Windows Desktop
+VisualStudioVersion = 15.0.28307.1000
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arControl", "SubProject\arCtl\arControl.csproj", "{F31C242C-1B15-4518-9733-48558499FE4B}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sub", "Sub", "{C423C39A-44E7-4F09-B2F7-7943975FF948}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arFrameControl", "SubProject\arFrameControl\arFrameControl.csproj", "{A16C9667-5241-4313-888E-548375F85D29}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateMachine", "StateMachine\StateMachine.csproj", "{BBC9BCCF-6262-4355-9CC2-37FF678AC499}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "agvControl", "SubProject\AGVControl\agvControl.csproj", "{8CB883C0-99C3-4DD4-B017-F9B92010A806}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_NLRF100", "TestProject\Test_NLRF100\Test_NLRF100.csproj", "{2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_PLC", "TestProject\Test_ProPLC\Test_PLC.csproj", "{9C027BF1-289F-4CC8-83F0-CB2B975C39C2}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_BMS", "TestProject\Test_BMS\Test_BMS.csproj", "{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMS", "SubProject\BMS\BMS.csproj", "{7A94C30C-6772-4F71-BF9C-0DF071A1BC70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWPatch", "SubProject\Patch\SWPatch.csproj", "{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emulator", "Emulator\Emulator.csproj", "{00BBEF50-3899-4BF1-82E0-DF065CB2A88C}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NARUMI", "SubProject\AGV\NARUMI.csproj", "{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommData", "SubProject\CommData\CommData.csproj", "{14E8C9A5-013E-49BA-B435-EFEFC77DD623}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Narumi", "TestProject\Test_Narumi\Test_Narumi.csproj", "{EB77976F-4DE4-46A5-8B25-D07226204C32}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "arCommUtil", "SubProject\CommUtil\arCommUtil.csproj", "{14E8C9A5-013E-49BA-B435-FFFFFF7DD623}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ENIGProtocol", "SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENIGProtocol", "SubProject\EnigProtocol\enigprotocol\ENIGProtocol.csproj", "{9365803B-933D-4237-93C7-B502C855A71C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV4", "Project\AGV4.csproj", "{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}"
EndProject
@@ -49,24 +37,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F31C242C-1B15-4518-9733-48558499FE4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Debug|x64.ActiveCfg = Debug|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Debug|x64.Build.0 = Debug|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Release|Any CPU.Build.0 = Release|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Release|x64.ActiveCfg = Release|Any CPU
- {F31C242C-1B15-4518-9733-48558499FE4B}.Release|x86.ActiveCfg = Release|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Debug|x64.Build.0 = Debug|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Debug|x86.ActiveCfg = Debug|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Release|Any CPU.Build.0 = Release|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Release|x64.ActiveCfg = Release|Any CPU
- {A16C9667-5241-4313-888E-548375F85D29}.Release|x86.ActiveCfg = Release|Any CPU
{BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBC9BCCF-6262-4355-9CC2-37FF678AC499}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -91,30 +61,6 @@ Global
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x64.Build.0 = Release|Any CPU
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.ActiveCfg = Release|Any CPU
{8CB883C0-99C3-4DD4-B017-F9B92010A806}.Release|x86.Build.0 = Release|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x64.ActiveCfg = Debug|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x64.Build.0 = Debug|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Debug|x86.Build.0 = Debug|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|Any CPU.Build.0 = Release|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x64.ActiveCfg = Release|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x64.Build.0 = Release|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x86.ActiveCfg = Release|Any CPU
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8}.Release|x86.Build.0 = Release|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x64.ActiveCfg = Debug|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x64.Build.0 = Debug|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x86.ActiveCfg = Debug|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Debug|x86.Build.0 = Debug|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|Any CPU.Build.0 = Release|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x64.ActiveCfg = Release|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x64.Build.0 = Release|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x86.ActiveCfg = Release|Any CPU
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2}.Release|x86.Build.0 = Release|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -151,18 +97,6 @@ Global
{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x64.Build.0 = Release|Any CPU
{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x86.ActiveCfg = Release|Any CPU
{37DC0BAE-50BF-41E4-BAAB-B0E211467AD1}.Release|x86.Build.0 = Release|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x64.ActiveCfg = Debug|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x64.Build.0 = Debug|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x86.ActiveCfg = Debug|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Debug|x86.Build.0 = Debug|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|Any CPU.Build.0 = Release|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x64.ActiveCfg = Release|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x64.Build.0 = Release|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x86.ActiveCfg = Release|Any CPU
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C}.Release|x86.Build.0 = Release|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -199,30 +133,18 @@ Global
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x64.Build.0 = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.ActiveCfg = Release|Any CPU
{EB77976F-4DE4-46A5-8B25-D07226204C32}.Release|x86.Build.0 = Release|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x64.ActiveCfg = Debug|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x64.Build.0 = Debug|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x86.ActiveCfg = Debug|x86
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Debug|x86.Build.0 = Debug|x86
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|Any CPU.Build.0 = Release|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x64.ActiveCfg = Release|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x64.Build.0 = Release|Any CPU
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x86.ActiveCfg = Release|x86
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623}.Release|x86.Build.0 = Release|x86
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x64.ActiveCfg = Debug|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x64.Build.0 = Debug|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x86.ActiveCfg = Debug|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Debug|x86.Build.0 = Debug|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|Any CPU.Build.0 = Release|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x64.ActiveCfg = Release|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x64.Build.0 = Release|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x86.ActiveCfg = Release|Any CPU
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234}.Release|x86.Build.0 = Release|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x64.Build.0 = Debug|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Debug|x86.Build.0 = Debug|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Release|x64.ActiveCfg = Release|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Release|x64.Build.0 = Release|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Release|x86.ActiveCfg = Release|Any CPU
+ {9365803B-933D-4237-93C7-B502C855A71C}.Release|x86.Build.0 = Release|Any CPU
{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6B3880D-7D5C-44E2-B6A5-CF6D881A8A38}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -240,19 +162,13 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {F31C242C-1B15-4518-9733-48558499FE4B} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
- {A16C9667-5241-4313-888E-548375F85D29} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{8CB883C0-99C3-4DD4-B017-F9B92010A806} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
- {2CDAD6D3-2D25-4604-A46C-EDEC0EB308D8} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
- {9C027BF1-289F-4CC8-83F0-CB2B975C39C2} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{CE3FFF9F-6ACA-44BD-B64A-33FF4AD5E82E} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{7A94C30C-6772-4F71-BF9C-0DF071A1BC70} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
- {00BBEF50-3899-4BF1-82E0-DF065CB2A88C} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
{8BAE0EAC-3D25-402F-9A65-2BA1ECFE28B7} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{14E8C9A5-013E-49BA-B435-EFEFC77DD623} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
{EB77976F-4DE4-46A5-8B25-D07226204C32} = {7AF32085-E7A6-4D06-BA6E-C6B1EBAEA99A}
- {14E8C9A5-013E-49BA-B435-FFFFFF7DD623} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
- {BCFD982A-C7BF-42EF-B0D3-0648B0EC5234} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
+ {9365803B-933D-4237-93C7-B502C855A71C} = {C423C39A-44E7-4F09-B2F7-7943975FF948}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B5B1FD72-356F-4840-83E8-B070AC21C8D9}
diff --git a/Cs_HMI/DLL/CarlosAg.ExcelXmlWriter.dll b/Cs_HMI/DLL/CarlosAg.ExcelXmlWriter.dll
new file mode 100644
index 0000000..7760d6d
Binary files /dev/null and b/Cs_HMI/DLL/CarlosAg.ExcelXmlWriter.dll differ
diff --git a/Cs_HMI/DLL/arCommUtil.dll b/Cs_HMI/DLL/arCommUtil.dll
index 8d1e3d1..74cff2c 100644
Binary files a/Cs_HMI/DLL/arCommUtil.dll and b/Cs_HMI/DLL/arCommUtil.dll differ
diff --git a/Cs_HMI/DLL/arControl.Net4.dll b/Cs_HMI/DLL/arControl.Net4.dll
index 65d8279..56ea842 100644
Binary files a/Cs_HMI/DLL/arControl.Net4.dll and b/Cs_HMI/DLL/arControl.Net4.dll differ
diff --git a/Cs_HMI/Project/AGV4.csproj b/Cs_HMI/Project/AGV4.csproj
index 4f340c6..466d5f1 100644
--- a/Cs_HMI/Project/AGV4.csproj
+++ b/Cs_HMI/Project/AGV4.csproj
@@ -99,6 +99,18 @@
Auto
+
+ False
+ ..\DLL\arCommUtil.dll
+
+
+ False
+ ..\DLL\arControl.Net4.dll
+
+
+ False
+ ..\DLL\CarlosAg.ExcelXmlWriter.dll
+
False
C:\Program Files (x86)\Microsoft SDKs\Speech\v11.0\Assembly\Microsoft.Speech.dll
@@ -520,14 +532,6 @@
{8bae0eac-3d25-402f-9a65-2ba1ecfe28b7}
NARUMI
-
- {f31c242c-1b15-4518-9733-48558499fe4b}
- arControl
-
-
- {a16c9667-5241-4313-888e-548375f85d29}
- arFrameControl
-
{7a94c30c-6772-4f71-bf9c-0df071a1bc70}
BMS
@@ -536,10 +540,6 @@
{14e8c9a5-013e-49ba-b435-efefc77dd623}
CommData
-
- {14e8c9a5-013e-49ba-b435-ffffff7dd623}
- arCommUtil
-
{499d8912-4b96-41e5-a70d-cfe797883d65}
ENIGProtocol
diff --git a/Cs_HMI/SubProject/AGV/NARUMI.csproj b/Cs_HMI/SubProject/AGV/NARUMI.csproj
index fd48fe6..b1b1492 100644
--- a/Cs_HMI/SubProject/AGV/NARUMI.csproj
+++ b/Cs_HMI/SubProject/AGV/NARUMI.csproj
@@ -34,6 +34,9 @@
false
+
+ ..\..\DLL\arCommUtil.dll
+
@@ -59,10 +62,6 @@
{14e8c9a5-013e-49ba-b435-efefc77dd623}
CommData
-
- {14e8c9a5-013e-49ba-b435-ffffff7dd623}
- arCommUtil
-
\ No newline at end of file
diff --git a/Cs_HMI/SubProject/arFrameControl/GridView/ColorListItem.cs b/Cs_HMI/SubProject/AGVControl/GridView/ColorListItem.cs
similarity index 96%
rename from Cs_HMI/SubProject/arFrameControl/GridView/ColorListItem.cs
rename to Cs_HMI/SubProject/AGVControl/GridView/ColorListItem.cs
index 08251be..fd70462 100644
--- a/Cs_HMI/SubProject/arFrameControl/GridView/ColorListItem.cs
+++ b/Cs_HMI/SubProject/AGVControl/GridView/ColorListItem.cs
@@ -1,23 +1,23 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-
-namespace arFrame.Control
-{
- [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
- public class ColorListItem
- {
- public System.Drawing.Color BackColor1 { get; set; }
- public System.Drawing.Color BackColor2 { get; set; }
- public string Remark { get; set; }
-
- public ColorListItem()
- {
- BackColor1 = System.Drawing.Color.Transparent;
- BackColor2 = System.Drawing.Color.Transparent;
- Remark = string.Empty;
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+
+namespace arFrame.Control
+{
+ [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
+ public class ColorListItem
+ {
+ public System.Drawing.Color BackColor1 { get; set; }
+ public System.Drawing.Color BackColor2 { get; set; }
+ public string Remark { get; set; }
+
+ public ColorListItem()
+ {
+ BackColor1 = System.Drawing.Color.Transparent;
+ BackColor2 = System.Drawing.Color.Transparent;
+ Remark = string.Empty;
+ }
+ }
+}
diff --git a/Cs_HMI/SubProject/arFrameControl/GridView/GridItem.cs b/Cs_HMI/SubProject/AGVControl/GridView/GridItem.cs
similarity index 97%
rename from Cs_HMI/SubProject/arFrameControl/GridView/GridItem.cs
rename to Cs_HMI/SubProject/AGVControl/GridView/GridItem.cs
index cc6d377..40eddec 100644
--- a/Cs_HMI/SubProject/arFrameControl/GridView/GridItem.cs
+++ b/Cs_HMI/SubProject/AGVControl/GridView/GridItem.cs
@@ -1,50 +1,50 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-
-namespace arFrame.Control
-{
- [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
- public class GridViewItem
- {
- public int row { get; private set; }
- public int col { get; private set; }
-
- public int idx { get; private set; }
- [Category("arFrame"), DisplayName("Tag")]
- public string Tag { get; set; }
- [Category("arFrame"), DisplayName("글자 정렬 방식")]
- public System.Drawing.ContentAlignment TextAlign { get; set; }
- [Category("arFrame"), DisplayName("글자 여백")]
- public System.Windows.Forms.Padding Padding { get; set; }
- [Category("arFrame"), DisplayName("메뉴 사용여부"), Description("활성화시 메뉴의 클릭이벤트가 발생하지 않습니다")]
- public Boolean Enable { get; set; }
-
- public System.Drawing.Color BackColor1 { get; set; }
- public System.Drawing.Color BackColor2 { get; set; }
-
- public Boolean Dirty { get; set; }
-
- public System.Drawing.RectangleF rect { get; set; }
-
- [Category("arFrame"), DisplayName("번호")]
- public int No { get; set; }
-
- public GridViewItem(int idx_,int _r,int _c)
- {
- this.row = _r;
- this.col = _c;
- BackColor1 = System.Drawing.Color.Transparent;
- BackColor2 = System.Drawing.Color.Transparent;
- rect = System.Drawing.RectangleF.Empty;
- Enable = true;
- this.idx = idx_;
- TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
- No = 0;
- this.Dirty = true;
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+
+namespace arFrame.Control
+{
+ [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
+ public class GridViewItem
+ {
+ public int row { get; private set; }
+ public int col { get; private set; }
+
+ public int idx { get; private set; }
+ [Category("arFrame"), DisplayName("Tag")]
+ public string Tag { get; set; }
+ [Category("arFrame"), DisplayName("글자 정렬 방식")]
+ public System.Drawing.ContentAlignment TextAlign { get; set; }
+ [Category("arFrame"), DisplayName("글자 여백")]
+ public System.Windows.Forms.Padding Padding { get; set; }
+ [Category("arFrame"), DisplayName("메뉴 사용여부"), Description("활성화시 메뉴의 클릭이벤트가 발생하지 않습니다")]
+ public Boolean Enable { get; set; }
+
+ public System.Drawing.Color BackColor1 { get; set; }
+ public System.Drawing.Color BackColor2 { get; set; }
+
+ public Boolean Dirty { get; set; }
+
+ public System.Drawing.RectangleF rect { get; set; }
+
+ [Category("arFrame"), DisplayName("번호")]
+ public int No { get; set; }
+
+ public GridViewItem(int idx_,int _r,int _c)
+ {
+ this.row = _r;
+ this.col = _c;
+ BackColor1 = System.Drawing.Color.Transparent;
+ BackColor2 = System.Drawing.Color.Transparent;
+ rect = System.Drawing.RectangleF.Empty;
+ Enable = true;
+ this.idx = idx_;
+ TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
+ No = 0;
+ this.Dirty = true;
+ }
+ }
+}
diff --git a/Cs_HMI/SubProject/arFrameControl/GridView/GridView.Designer.cs b/Cs_HMI/SubProject/AGVControl/GridView/GridView.Designer.cs
similarity index 96%
rename from Cs_HMI/SubProject/arFrameControl/GridView/GridView.Designer.cs
rename to Cs_HMI/SubProject/AGVControl/GridView/GridView.Designer.cs
index 2a9a87e..66613cb 100644
--- a/Cs_HMI/SubProject/arFrameControl/GridView/GridView.Designer.cs
+++ b/Cs_HMI/SubProject/AGVControl/GridView/GridView.Designer.cs
@@ -1,36 +1,36 @@
-namespace arFrame.Control
-{
- partial class GridView
- {
- ///
- /// 필수 디자이너 변수입니다.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// 사용 중인 모든 리소스를 정리합니다.
- ///
- /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region 구성 요소 디자이너에서 생성한 코드
-
- ///
- /// 디자이너 지원에 필요한 메서드입니다.
- /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- }
-
- #endregion
- }
-}
+namespace arFrame.Control
+{
+ partial class GridView
+ {
+ ///
+ /// 필수 디자이너 변수입니다.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 사용 중인 모든 리소스를 정리합니다.
+ ///
+ /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 구성 요소 디자이너에서 생성한 코드
+
+ ///
+ /// 디자이너 지원에 필요한 메서드입니다.
+ /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/Cs_HMI/SubProject/arFrameControl/GridView/GridView.cs b/Cs_HMI/SubProject/AGVControl/GridView/GridView.cs
similarity index 97%
rename from Cs_HMI/SubProject/arFrameControl/GridView/GridView.cs
rename to Cs_HMI/SubProject/AGVControl/GridView/GridView.cs
index 26be37a..0249079 100644
--- a/Cs_HMI/SubProject/arFrameControl/GridView/GridView.cs
+++ b/Cs_HMI/SubProject/AGVControl/GridView/GridView.cs
@@ -1,624 +1,624 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-
-namespace arFrame.Control
-{
- public partial class GridView : System.Windows.Forms.Control
- {
- private int bordersize = 0;
- private int menubordersize = 1;
- private int menugap = 5;
- private System.Windows.Forms.Padding padding = new Padding(3, 3, 3, 3);
- private System.Drawing.Color backcolor = System.Drawing.Color.White;
- private System.Drawing.Color bordercolor = System.Drawing.Color.Black;
- private Boolean textattachtoimage = true;
- private Boolean _showIndexString = true;
-
- private System.Drawing.Color _shadowColor = System.Drawing.Color.Transparent;
- private System.Drawing.Color foreColorPin = System.Drawing.Color.WhiteSmoke;
- private System.Drawing.Font fontPin = new Font("Consolas", 8, FontStyle.Bold);
-
- private Point _matrixsize = new Point(8, 2);
- public Point MatrixSize { get { return _matrixsize; } set { _matrixsize = value; ResetArray(); RemakeChartRect(); } }
-
- [Browsable(false)]
- public int ColumnCount { get { return _matrixsize.X; } }
- [Browsable(false)]
- public int RowCount { get { return _matrixsize.Y; } }
- public int ItemCount { get { return ColumnCount * RowCount; } }
-
- private GridViewItem[] Items;
-
- private UInt16[] _values;
- private string[] _titles;
- private string[] _tags;
- private string[] _names;
- private ColorListItem[] _colorlist;
- public ColorListItem[] ColorList { get { return _colorlist; } set { _colorlist = value; this.Invalidate(); } }
-
- public string[] Names { get { return _names; } set { _names = value; Invalidate(); } }
- public string[] Titles { get { return _titles; } set { _titles = value; Invalidate(); } }
- public UInt16[] Values { get { return _values; } set { _values = value; Invalidate(); } }
- public string[] Tags { get { return _tags; } set { _tags = value; } }
-
- private bool _showdebuginfo = false;
- public Boolean showDebugInfo { get { return _showdebuginfo; } set { _showdebuginfo = value; Invalidate(); } }
-
- public void setNames(string[] value)
- {
- _names = value;
- }
-
- public void setTitle(string[] value)
- {
- List titlerows = new List();
- List tagrows = new List();
-
- for (int i = 0; i < value.Length; i++)
- {
- var r = (int)(Math.Floor((double)(i / ColumnCount)));
- var c = i % ColumnCount;
-
- if (titlerows.Count < r + 1) titlerows.Add(string.Empty);
- if (tagrows.Count < r + 1) tagrows.Add(string.Empty);
-
- var prestr = titlerows[r];
- if (prestr != "") prestr += "|";
- titlerows[r] = prestr + value[i];
-
- var prestr_t = tagrows[r];
- if (prestr_t != "") prestr_t += "|";
- tagrows[r] = prestr_t + "";
-
- if (i < itemCount) this.Items[i].Enable = true;
- }
- this._titles = titlerows.ToArray();
- this._tags = tagrows.ToArray();
- }
-
- public Boolean setTitle(int row, int col, string value, string itemtag = "")
- {
- if (_titles == null) _titles = new string[0];
- if (_tags == null) _tags = new string[0];
-
- if ( row >= _titles.Length) Array.Resize(ref _titles, row + 1);
- if( row >= _tags.Length) Array.Resize(ref _tags, row+1);
-
- if (_titles[row] == null) _titles[row] = string.Empty;
- if (_tags[row] == null) _tags[row] = string.Empty;
-
- var linebuf = _titles[row].Split('|');
- var linebuf_t = _tags[row].Split('|');
-
- if (col >= linebuf.Length) Array.Resize(ref linebuf, col + 1);
- if (col >= linebuf_t.Length) Array.Resize(ref linebuf_t, col + 1);
-
- linebuf[col] = value;
- linebuf_t[col] = itemtag;
-
- _titles[row] = string.Join("|", linebuf);
- _tags[row] = string.Join("|", linebuf_t);
- return true;
- //var idx = row * this.ColumnCount + col;
- //return setTitle(idx, value);
- }
- public Boolean setTitle(int idx, string value)
- {
- if (idx < ColumnCount) return setTitle(0, idx, value);
- else
- {
- //줄값이 필요하다
- var row = (int)(Math.Floor((double)(idx / ColumnCount)));
- var col = idx % ColumnCount;
- return setTitle(row, col, value);
- }
- }
-
-
- public void setValue(bool[] value)
- {
- var v = new UInt16[value.Length];
- for (int i = 0; i < value.Length; i++)
- v[i] = (UInt16)(value[i] ? 1 : 0);
- _values = v;
- }
- public void setValue(UInt16[] value)
- {
- _values = value;
- }
- public Boolean setValue(int idx, ushort value)
- {
- if (this._values == null) _values = new ushort[idx + 1];
- if (idx >= this._values.Length) Array.Resize(ref _values, idx + 1);
- this._values[idx] = value;
- return true;
- }
- public Boolean setTag(string[] value)
- {
- this._tags = value;
- return true;
- }
- public Boolean setTag(int idx, string value)
- {
- if (this._tags == null) Tags = new string[idx + 1];
- if (idx >= this.Tags.Length) Array.Resize(ref _tags, idx + 1);
- this._tags[idx] = value;
- return true;
- }
- public void ClearValue(ushort defaultValue = 0)
- {
- if (_values != null)
- for(int i = 0; i < _values.Length;i++)
- _values[i] = defaultValue;
- }
- public void ClearTitle(string defaultValue = "")
- {
- if (_values != null)
- for (int i = 0; i < _titles.Length; i++)
- _titles[i] = defaultValue;
- }
- public void ClearTag(string defaultValue = "")
- {
- if (_tags != null)
- for (int i = 0; i < _tags.Length; i++)
- _tags[i] = defaultValue;
- }
- public void setValue(ushort value)
- {
- for(int i = 0; i < _values.Length;i++)
- this._values[i] = value;
- }
- public void setItemEnable(int idx, bool value)
- {
- if (idx >= _values.Length || idx >= this.Items.Length) return;
- this.Items[idx].Enable = value;
- }
-
- ///
- /// 지정된 컬러태그값을 입력한다.
- ///
- ///
- ///
- ///
- public Boolean setValue(int idx, string tagString)
- {
- //동일태그값을 찾는다
- if (idx >= _values.Length) return false;
-
- int value = -1;
- for (int i = 0; i < ColorList.Length; i++)
- if (ColorList[i].Remark.ToLower() == tagString.ToLower())
- {
- value = i;
- break;
- }
-
- if (value != -1)
- {
- this._values[idx] = (ushort)value;
- this.Items[idx].Enable = true;
- return true;
- }
- else return false;
-
-
- }
- public Boolean setValue(int idx, bool value)
- {
- return setValue(idx, (ushort)(value ? 1 : 0));
- }
- public Boolean setValue(int row, int col, ushort value)
- {
- var idx = row * this.ColumnCount + col;
- return setValue(idx, value);
- }
- public Boolean setValue(int row, int col, int value)
- {
- var idx = row * this.ColumnCount + col;
- return setValue(idx, (ushort)value);
- }
- public Boolean setValueToggle(int row, int col, ushort value1,ushort value2)
- {
- var idx = row * this.ColumnCount + col;
- if(getValue(idx) == value1) return setValue(idx, value2);
- else return setValue(idx, value1);
- }
- public Boolean setValue(int row, int col, bool value)
- {
- var idx = row * this.ColumnCount + col;
- return setValue(idx, (ushort)(value ? 1 : 0));
- }
- public Boolean setValue(int row, int col, string value)
- {
- var idx = row * this.ColumnCount + col;
- return setValue(idx, value);
- }
-
- public ushort getValue(int idx)
- {
- if (idx >= _values.Length) return 0;
- return _values[idx];
- }
- public ushort getValue(int row, int col)
- {
- var idx = row * this.ColumnCount + col;
- return getValue(idx);
- }
-
- [Category("arFrame")]
- public bool ShowIndexString { get { return _showIndexString; } set { _showIndexString = value; Invalidate(); } }
-
- [Category("arFrame"), DisplayName("테두리 굵기")]
- public int BorderSize { get { return bordersize; } set { this.bordersize = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("메뉴 테두리 굵기")]
- public int MenuBorderSize { get { return menubordersize; } set { this.menubordersize = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("메뉴 간격")]
- public int MenuGap { get { return menugap; } set { this.menugap = value; RemakeChartRect(); Invalidate(); } }
- [Category("arFrame"), DisplayName("글자를 이미지 다음에 표시"), Description("이미지가 있는 경우 해당 이미지 옆에 글자를 붙입니다")]
- public Boolean TextAttachToImage { get { return textattachtoimage; } set { this.textattachtoimage = value; Invalidate(); } }
-
- [Category("arFrame"), DisplayName("색상-테두리")]
- public System.Drawing.Color BorderColor { get { return bordercolor; } set { this.bordercolor = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("내부 여백")]
- public new System.Windows.Forms.Padding Padding { get { return padding; } set { this.padding = value; RemakeChartRect(); Invalidate(); } }
-
- [Category("arFrame"), DisplayName("색상-전체배경색")]
- public override System.Drawing.Color BackColor { get { return backcolor; } set { this.backcolor = value; Invalidate(); } }
-
- [Category("arFrame"), DisplayName("색상-글자(그림자)")]
- public System.Drawing.Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; this.Invalidate(); } }
-
- [Category("arFrame"), DisplayName("색상-글자")]
- public override Color ForeColor { get { return base.ForeColor; } set { base.ForeColor = value; } }
-
- [Category("arFrame"), DisplayName("색상-글자(번호)")]
- public Color ForeColorPin { get { return foreColorPin; } set { foreColorPin = value; } }
-
- [Category("arFrame"), DisplayName("글꼴-번호")]
- public Font FontPin { get { return fontPin; } set { fontPin = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("글꼴-항목")]
- public override Font Font { get { return base.Font; } set { base.Font = value; Invalidate(); } }
-
- private int mouseOverItemIndex = -1;
- public GridView()
- {
- InitializeComponent();
-
- // Set Optimized Double Buffer to reduce flickering
- this.SetStyle(ControlStyles.UserPaint, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
-
- // Redraw when resized
- this.SetStyle(ControlStyles.ResizeRedraw, true);
-
- //값과 이름은 외부의 값을 사용한다
- ResetArray();
-
- if (MinimumSize.Width == 0 || MinimumSize.Height == 0)
- MinimumSize = new Size(100, 50);
- }
-
-
- void ResetArray()
- {
- if (this._values != null) Array.Resize(ref this._values, itemCount);// = new UInt16[itemCount];
- // if (this._titles != null) Array.Resize(ref this._titles, itemCount);//
- // if (this._names != null) Array.Resize(ref this._names, itemCount);//
- }
-
- int itemCount { get { return ColumnCount * RowCount; } }
- protected override void OnSizeChanged(EventArgs e)
- {
- base.OnSizeChanged(e);
- RemakeChartRect();
- }
-
- public event EventHandler ItemClick;
- public class ItemClickEventArgs : EventArgs
- {
- public int idx { get; set; }
- public GridViewItem Item { get; set; }
- public ItemClickEventArgs(int idx_, GridViewItem item)
- {
- this.Item = item;
- this.idx = idx_;
- }
- }
-
- protected override void OnMouseClick(MouseEventArgs e)
- {
- //마우스클릭시 해당 버튼을 찾아서 반환한다.
- if (Items == null || Items.Length < 1) return;
- for (int i = 0; i < Items.Length; i++)
- {
- var rect = Items[i].rect;//[i];
- if (rect.Contains(e.Location))
- {
- var menu = Items[i];
-
- //미사용개체는 이벤트를 아에 발생하지 않는다
- if (menu.Enable == true && ItemClick != null)
- ItemClick(this, new ItemClickEventArgs(i, menu));
- break;
- }
- }
- }
-
- protected override void OnMouseLeave(EventArgs e)
- {
- this.mouseOverItemIndex = -1;
- this.Invalidate();
- }
- protected override void OnMouseMove(MouseEventArgs e)
- {
- if (Items == null || Items.Length < 1)
- {
- this.mouseOverItemIndex = -1;
- return;
- }
-
- for (int i = 0; i < Items.Length; i++)
- {
- var rect = Items[i].rect;// rects[i];
- if (rect.Contains(e.Location))
- {
- if (i != mouseOverItemIndex)
- {
- mouseOverItemIndex = i;
- this.Invalidate();
- }
-
- break;
- }
- }
- }
- public void setItemTextAlign(int row, int col, System.Drawing.ContentAlignment TextAlign)
- {
- var item = this.Items.Where(t => t.row == row && t.col == col).FirstOrDefault();
- if (item != null) item.TextAlign = TextAlign;
- }
- public void setItemTextAlign(System.Drawing.ContentAlignment TextAlign)
- {
- foreach (var item in this.Items)
- item.TextAlign = TextAlign;
- }
-
- protected override void OnPaint(PaintEventArgs pe)
- {
- //배경그리기
- //using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(DisplayRectangle, BackColor, BackColor2On, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
- pe.Graphics.FillRectangle(new SolidBrush(BackColor), DisplayRectangle);
-
- if (Items == null)
- {
- pe.Graphics.DrawString("no items", this.Font, Brushes.Red, 100, 100);
- return;
- }
-
- var items = Items.OrderBy(t => t.No);
- foreach (var menu in items)
- {
- drawItem(menu.idx, pe.Graphics);
- }
-
- //테두리 그리기
- if (BorderSize > 0)
- {
- pe.Graphics.DrawRectangle(new Pen(this.BorderColor, BorderSize),
- this.DisplayRectangle.Left,
- this.DisplayRectangle.Top,
- this.DisplayRectangle.Width - 1,
- this.DisplayRectangle.Height - 1);
- }
- }
-
- public void drawItem(int itemIndex, Graphics g = null)
- {
- if (g == null) g = this.CreateGraphics();
- var menu = this.Items[itemIndex];
-
- if (menu.rect == RectangleF.Empty) return;
-
- var rect = menu.rect;// rects[i];
-
- var diplayText = string.Empty;
-
- //타이틀이 줄번호별로 처리됨
- if (_titles != null && menu.row < _titles.Length && _titles[menu.row] != null )
- {
- var linebif = _titles[menu.row].Split('|');
- if (menu.col < linebif.Length)
- diplayText = linebif[menu.col];
- }
-
- UInt16 Value = 0;
- if (_values != null && menu.idx < _values.Length) Value = _values[menu.idx];
-
- //배경이 투명이 아니라면 그린다.
- var bgColor1 = Color.FromArgb(30, 30, 30);// BackColor1Off;
- var bgColor2 = Color.FromArgb(30, 30, 30);// BackColor2Off;
-
- //해당 값에 따른 컬러값을 읽는다.
- if (ColorList != null && Value < ColorList.Length)
- {
- bgColor1 = this.ColorList[Value].BackColor1;
- bgColor2 = this.ColorList[Value].BackColor2;
- }
-
- using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, bgColor1, bgColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
- g.FillRectangle(sb, rect);
-
- // if (mouseOverItemIndex == menu.idx)
- // this.Cursor = Cursors.Hand;
- // else
- // this.Cursor = Cursors.Arrow;
-
- //테두리를 그리는 속성과 트기가 설정된 경우에만 표시
- //if (mouseOverItemIndex == i)
- // {
- // pe.Graphics.DrawRectangle(new Pen(Color.DeepSkyBlue), rect.Left, rect.Top, rect.Width, rect.Height);
- //}
- //else
- {
- if (MenuBorderSize > 0)
- {
- using (var p = new Pen(BorderColor, MenuBorderSize))
- g.DrawRectangle(p, rect.Left, rect.Top, rect.Width, rect.Height);
- }
- }
-
- //인덱스번호 출력
- if (ShowIndexString && _names != null && menu.idx < _names.Length)
- {
- //표시글자
- var idxstr = string.Format("[{0}] {1}", menu.idx, _names[menu.idx]);
-
- //그림자 추가
- if (ShadowColor != System.Drawing.Color.Transparent)
- g.DrawString(idxstr, FontPin, new SolidBrush(ShadowColor), menu.rect.Left + 4, menu.rect.Top + 4);
-
- //일반글자표시
- g.DrawString(idxstr, FontPin, new SolidBrush(this.ForeColorPin), menu.rect.Left + 3, menu.rect.Top + 3);
- }
-
- if (diplayText != "")
- {
- using (StringFormat sf = new StringFormat(StringFormatFlags.NoClip))
- {
- //글자를 텍스트 이후에 붙이는 거라면?
- if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.BottomLeft ||
- menu.TextAlign == ContentAlignment.BottomRight) sf.LineAlignment = StringAlignment.Far;
- else if (menu.TextAlign == ContentAlignment.MiddleCenter || menu.TextAlign == ContentAlignment.MiddleLeft ||
- menu.TextAlign == ContentAlignment.MiddleRight) sf.LineAlignment = StringAlignment.Center;
- else if (menu.TextAlign == ContentAlignment.TopCenter || menu.TextAlign == ContentAlignment.TopLeft ||
- menu.TextAlign == ContentAlignment.TopRight) sf.LineAlignment = StringAlignment.Near;
-
- if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.MiddleCenter ||
- menu.TextAlign == ContentAlignment.TopCenter) sf.Alignment = StringAlignment.Center;
- else if (menu.TextAlign == ContentAlignment.BottomLeft || menu.TextAlign == ContentAlignment.MiddleLeft ||
- menu.TextAlign == ContentAlignment.TopLeft) sf.Alignment = StringAlignment.Near;
- else if (menu.TextAlign == ContentAlignment.BottomRight || menu.TextAlign == ContentAlignment.MiddleRight ||
- menu.TextAlign == ContentAlignment.TopRight) sf.Alignment = StringAlignment.Far;
-
- //그림자 추가
- if (ShadowColor != System.Drawing.Color.Transparent)
- g.DrawString(diplayText, this.Font, new SolidBrush(ShadowColor),
- new RectangleF((float)(rect.Left + 1f), (float)(rect.Top + 1f), (float)rect.Width, (float)rect.Height), sf);
-
- g.DrawString(diplayText, this.Font, new SolidBrush(ForeColor), rect, sf);
- }
- }
-
- if (showDebugInfo)
- {
- g.DrawString(Value.ToString(), this.fontPin, Brushes.SkyBlue, rect.Left, rect.Top);
- }
-
- }
-
- ///
- /// arFrame 전용 속성값을 복사 합니다
- ///
- ///
- public void copyTo(GridView ctl)
- {
- ctl.backcolor = this.backcolor;
- ctl.menugap = this.menugap;
- ctl.Items = this.Items;
- ctl.menubordersize = this.menubordersize;
- ctl.padding = this.padding;
- ctl.ForeColor = this.ForeColor;
- ctl.Font = this.Font;
- ctl.TextAttachToImage = this.TextAttachToImage;
- ctl.bordercolor = this.bordercolor;
- ctl.bordersize = this.bordersize;
- }
-
- public void RemakeChartRect()
- {
- if (DisplayRectangle == Rectangle.Empty) return;
-
- double x = 0;
- double y = 0;
- double w = DisplayRectangle.Width / (ColumnCount * 1.0);
- double h = DisplayRectangle.Height / (RowCount * 1.0);
-
- if (this.Items == null || itemCount != this.Items.Length)
- {
- //아이템갯수가 달라졌으므로 다시 갱신해야함
- GridViewItem[] item = new GridViewItem[RowCount * ColumnCount];
- for (int r = 0; r < RowCount; r++)
- {
- for (int c = 0; c < ColumnCount; c++)
- {
- int idx = r * ColumnCount + c;
- item[idx] = new GridViewItem(idx, r, c);
- item[idx].Enable = false;
- item[idx].Padding = new Padding(0, 0, 0, 0);
- item[idx].TextAlign = ContentAlignment.MiddleCenter;
- x = (c * w);
- y = (r * h);
- item[idx].rect = new RectangleF((float)x, (float)y, (float)w, (float)h);
- }
- }
-
- this.Items = item;
- }
- else
- {
- //아이템의 갯수는 같으므로 좌표값만 변경해준다.
- for (int r = 0; r < RowCount; r++)
- {
- for (int c = 0; c < ColumnCount; c++)
- {
- int idx = r * ColumnCount + c;
- var item = Items[idx];
- x = (c * w);
- y = (r * h);
- item.Dirty = true;
- item.rect = new RectangleF((float)x, (float)y, (float)w, (float)h);
- }
- }
- }
- this.Invalidate();
-
- //int i = 0;
- //var menuList = this.Items.OrderBy(t => t.No).ToArray();
- //foreach (var menu in menuList)
- //{
- // int x, y, w, h;
- // // var menu = menus[i];
-
- // var mWidth = menuwidth;
- // if (menu.MenuWidth > 0) mWidth = menu.MenuWidth;
-
- // w = mWidth;
- // h = DisplayRectangle.Height - Padding.Top - Padding.Bottom;
-
- // if (menu.isRightMenu)
- // {
- // x = DisplayRectangle.Right - Padding.Right - (rightAcc) - (MenuGap * rightIdx);
- // y = DisplayRectangle.Top + Padding.Top;
- // rightAcc += 0;// = 0;// x;
- // rightIdx += 1;
- // }
- // else
- // {
- // x = DisplayRectangle.Left + Padding.Left + leftAcc + (MenuGap * leftIdx);
- // y = DisplayRectangle.Top + Padding.Top;
- // leftAcc += mWidth;
- // leftIdx += 1;
- // }
- // rects[i] = new Rectangle(x, y, w, h);
- // i += 1;
- //}
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace arFrame.Control
+{
+ public partial class GridView : System.Windows.Forms.Control
+ {
+ private int bordersize = 0;
+ private int menubordersize = 1;
+ private int menugap = 5;
+ private System.Windows.Forms.Padding padding = new Padding(3, 3, 3, 3);
+ private System.Drawing.Color backcolor = System.Drawing.Color.White;
+ private System.Drawing.Color bordercolor = System.Drawing.Color.Black;
+ private Boolean textattachtoimage = true;
+ private Boolean _showIndexString = true;
+
+ private System.Drawing.Color _shadowColor = System.Drawing.Color.Transparent;
+ private System.Drawing.Color foreColorPin = System.Drawing.Color.WhiteSmoke;
+ private System.Drawing.Font fontPin = new Font("Consolas", 8, FontStyle.Bold);
+
+ private Point _matrixsize = new Point(8, 2);
+ public Point MatrixSize { get { return _matrixsize; } set { _matrixsize = value; ResetArray(); RemakeChartRect(); } }
+
+ [Browsable(false)]
+ public int ColumnCount { get { return _matrixsize.X; } }
+ [Browsable(false)]
+ public int RowCount { get { return _matrixsize.Y; } }
+ public int ItemCount { get { return ColumnCount * RowCount; } }
+
+ private GridViewItem[] Items;
+
+ private UInt16[] _values;
+ private string[] _titles;
+ private string[] _tags;
+ private string[] _names;
+ private ColorListItem[] _colorlist;
+ public ColorListItem[] ColorList { get { return _colorlist; } set { _colorlist = value; this.Invalidate(); } }
+
+ public string[] Names { get { return _names; } set { _names = value; Invalidate(); } }
+ public string[] Titles { get { return _titles; } set { _titles = value; Invalidate(); } }
+ public UInt16[] Values { get { return _values; } set { _values = value; Invalidate(); } }
+ public string[] Tags { get { return _tags; } set { _tags = value; } }
+
+ private bool _showdebuginfo = false;
+ public Boolean showDebugInfo { get { return _showdebuginfo; } set { _showdebuginfo = value; Invalidate(); } }
+
+ public void setNames(string[] value)
+ {
+ _names = value;
+ }
+
+ public void setTitle(string[] value)
+ {
+ List titlerows = new List();
+ List tagrows = new List();
+
+ for (int i = 0; i < value.Length; i++)
+ {
+ var r = (int)(Math.Floor((double)(i / ColumnCount)));
+ var c = i % ColumnCount;
+
+ if (titlerows.Count < r + 1) titlerows.Add(string.Empty);
+ if (tagrows.Count < r + 1) tagrows.Add(string.Empty);
+
+ var prestr = titlerows[r];
+ if (prestr != "") prestr += "|";
+ titlerows[r] = prestr + value[i];
+
+ var prestr_t = tagrows[r];
+ if (prestr_t != "") prestr_t += "|";
+ tagrows[r] = prestr_t + "";
+
+ if (i < itemCount) this.Items[i].Enable = true;
+ }
+ this._titles = titlerows.ToArray();
+ this._tags = tagrows.ToArray();
+ }
+
+ public Boolean setTitle(int row, int col, string value, string itemtag = "")
+ {
+ if (_titles == null) _titles = new string[0];
+ if (_tags == null) _tags = new string[0];
+
+ if ( row >= _titles.Length) Array.Resize(ref _titles, row + 1);
+ if( row >= _tags.Length) Array.Resize(ref _tags, row+1);
+
+ if (_titles[row] == null) _titles[row] = string.Empty;
+ if (_tags[row] == null) _tags[row] = string.Empty;
+
+ var linebuf = _titles[row].Split('|');
+ var linebuf_t = _tags[row].Split('|');
+
+ if (col >= linebuf.Length) Array.Resize(ref linebuf, col + 1);
+ if (col >= linebuf_t.Length) Array.Resize(ref linebuf_t, col + 1);
+
+ linebuf[col] = value;
+ linebuf_t[col] = itemtag;
+
+ _titles[row] = string.Join("|", linebuf);
+ _tags[row] = string.Join("|", linebuf_t);
+ return true;
+ //var idx = row * this.ColumnCount + col;
+ //return setTitle(idx, value);
+ }
+ public Boolean setTitle(int idx, string value)
+ {
+ if (idx < ColumnCount) return setTitle(0, idx, value);
+ else
+ {
+ //줄값이 필요하다
+ var row = (int)(Math.Floor((double)(idx / ColumnCount)));
+ var col = idx % ColumnCount;
+ return setTitle(row, col, value);
+ }
+ }
+
+
+ public void setValue(bool[] value)
+ {
+ var v = new UInt16[value.Length];
+ for (int i = 0; i < value.Length; i++)
+ v[i] = (UInt16)(value[i] ? 1 : 0);
+ _values = v;
+ }
+ public void setValue(UInt16[] value)
+ {
+ _values = value;
+ }
+ public Boolean setValue(int idx, ushort value)
+ {
+ if (this._values == null) _values = new ushort[idx + 1];
+ if (idx >= this._values.Length) Array.Resize(ref _values, idx + 1);
+ this._values[idx] = value;
+ return true;
+ }
+ public Boolean setTag(string[] value)
+ {
+ this._tags = value;
+ return true;
+ }
+ public Boolean setTag(int idx, string value)
+ {
+ if (this._tags == null) Tags = new string[idx + 1];
+ if (idx >= this.Tags.Length) Array.Resize(ref _tags, idx + 1);
+ this._tags[idx] = value;
+ return true;
+ }
+ public void ClearValue(ushort defaultValue = 0)
+ {
+ if (_values != null)
+ for(int i = 0; i < _values.Length;i++)
+ _values[i] = defaultValue;
+ }
+ public void ClearTitle(string defaultValue = "")
+ {
+ if (_values != null)
+ for (int i = 0; i < _titles.Length; i++)
+ _titles[i] = defaultValue;
+ }
+ public void ClearTag(string defaultValue = "")
+ {
+ if (_tags != null)
+ for (int i = 0; i < _tags.Length; i++)
+ _tags[i] = defaultValue;
+ }
+ public void setValue(ushort value)
+ {
+ for(int i = 0; i < _values.Length;i++)
+ this._values[i] = value;
+ }
+ public void setItemEnable(int idx, bool value)
+ {
+ if (idx >= _values.Length || idx >= this.Items.Length) return;
+ this.Items[idx].Enable = value;
+ }
+
+ ///
+ /// 지정된 컬러태그값을 입력한다.
+ ///
+ ///
+ ///
+ ///
+ public Boolean setValue(int idx, string tagString)
+ {
+ //동일태그값을 찾는다
+ if (idx >= _values.Length) return false;
+
+ int value = -1;
+ for (int i = 0; i < ColorList.Length; i++)
+ if (ColorList[i].Remark.ToLower() == tagString.ToLower())
+ {
+ value = i;
+ break;
+ }
+
+ if (value != -1)
+ {
+ this._values[idx] = (ushort)value;
+ this.Items[idx].Enable = true;
+ return true;
+ }
+ else return false;
+
+
+ }
+ public Boolean setValue(int idx, bool value)
+ {
+ return setValue(idx, (ushort)(value ? 1 : 0));
+ }
+ public Boolean setValue(int row, int col, ushort value)
+ {
+ var idx = row * this.ColumnCount + col;
+ return setValue(idx, value);
+ }
+ public Boolean setValue(int row, int col, int value)
+ {
+ var idx = row * this.ColumnCount + col;
+ return setValue(idx, (ushort)value);
+ }
+ public Boolean setValueToggle(int row, int col, ushort value1,ushort value2)
+ {
+ var idx = row * this.ColumnCount + col;
+ if(getValue(idx) == value1) return setValue(idx, value2);
+ else return setValue(idx, value1);
+ }
+ public Boolean setValue(int row, int col, bool value)
+ {
+ var idx = row * this.ColumnCount + col;
+ return setValue(idx, (ushort)(value ? 1 : 0));
+ }
+ public Boolean setValue(int row, int col, string value)
+ {
+ var idx = row * this.ColumnCount + col;
+ return setValue(idx, value);
+ }
+
+ public ushort getValue(int idx)
+ {
+ if (idx >= _values.Length) return 0;
+ return _values[idx];
+ }
+ public ushort getValue(int row, int col)
+ {
+ var idx = row * this.ColumnCount + col;
+ return getValue(idx);
+ }
+
+ [Category("arFrame")]
+ public bool ShowIndexString { get { return _showIndexString; } set { _showIndexString = value; Invalidate(); } }
+
+ [Category("arFrame"), DisplayName("테두리 굵기")]
+ public int BorderSize { get { return bordersize; } set { this.bordersize = value; Invalidate(); } }
+ [Category("arFrame"), DisplayName("메뉴 테두리 굵기")]
+ public int MenuBorderSize { get { return menubordersize; } set { this.menubordersize = value; Invalidate(); } }
+ [Category("arFrame"), DisplayName("메뉴 간격")]
+ public int MenuGap { get { return menugap; } set { this.menugap = value; RemakeChartRect(); Invalidate(); } }
+ [Category("arFrame"), DisplayName("글자를 이미지 다음에 표시"), Description("이미지가 있는 경우 해당 이미지 옆에 글자를 붙입니다")]
+ public Boolean TextAttachToImage { get { return textattachtoimage; } set { this.textattachtoimage = value; Invalidate(); } }
+
+ [Category("arFrame"), DisplayName("색상-테두리")]
+ public System.Drawing.Color BorderColor { get { return bordercolor; } set { this.bordercolor = value; Invalidate(); } }
+ [Category("arFrame"), DisplayName("내부 여백")]
+ public new System.Windows.Forms.Padding Padding { get { return padding; } set { this.padding = value; RemakeChartRect(); Invalidate(); } }
+
+ [Category("arFrame"), DisplayName("색상-전체배경색")]
+ public override System.Drawing.Color BackColor { get { return backcolor; } set { this.backcolor = value; Invalidate(); } }
+
+ [Category("arFrame"), DisplayName("색상-글자(그림자)")]
+ public System.Drawing.Color ShadowColor { get { return _shadowColor; } set { _shadowColor = value; this.Invalidate(); } }
+
+ [Category("arFrame"), DisplayName("색상-글자")]
+ public override Color ForeColor { get { return base.ForeColor; } set { base.ForeColor = value; } }
+
+ [Category("arFrame"), DisplayName("색상-글자(번호)")]
+ public Color ForeColorPin { get { return foreColorPin; } set { foreColorPin = value; } }
+
+ [Category("arFrame"), DisplayName("글꼴-번호")]
+ public Font FontPin { get { return fontPin; } set { fontPin = value; Invalidate(); } }
+ [Category("arFrame"), DisplayName("글꼴-항목")]
+ public override Font Font { get { return base.Font; } set { base.Font = value; Invalidate(); } }
+
+ private int mouseOverItemIndex = -1;
+ public GridView()
+ {
+ InitializeComponent();
+
+ // Set Optimized Double Buffer to reduce flickering
+ this.SetStyle(ControlStyles.UserPaint, true);
+ this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
+
+ // Redraw when resized
+ this.SetStyle(ControlStyles.ResizeRedraw, true);
+
+ //값과 이름은 외부의 값을 사용한다
+ ResetArray();
+
+ if (MinimumSize.Width == 0 || MinimumSize.Height == 0)
+ MinimumSize = new Size(100, 50);
+ }
+
+
+ void ResetArray()
+ {
+ if (this._values != null) Array.Resize(ref this._values, itemCount);// = new UInt16[itemCount];
+ // if (this._titles != null) Array.Resize(ref this._titles, itemCount);//
+ // if (this._names != null) Array.Resize(ref this._names, itemCount);//
+ }
+
+ int itemCount { get { return ColumnCount * RowCount; } }
+ protected override void OnSizeChanged(EventArgs e)
+ {
+ base.OnSizeChanged(e);
+ RemakeChartRect();
+ }
+
+ public event EventHandler ItemClick;
+ public class ItemClickEventArgs : EventArgs
+ {
+ public int idx { get; set; }
+ public GridViewItem Item { get; set; }
+ public ItemClickEventArgs(int idx_, GridViewItem item)
+ {
+ this.Item = item;
+ this.idx = idx_;
+ }
+ }
+
+ protected override void OnMouseClick(MouseEventArgs e)
+ {
+ //마우스클릭시 해당 버튼을 찾아서 반환한다.
+ if (Items == null || Items.Length < 1) return;
+ for (int i = 0; i < Items.Length; i++)
+ {
+ var rect = Items[i].rect;//[i];
+ if (rect.Contains(e.Location))
+ {
+ var menu = Items[i];
+
+ //미사용개체는 이벤트를 아에 발생하지 않는다
+ if (menu.Enable == true && ItemClick != null)
+ ItemClick(this, new ItemClickEventArgs(i, menu));
+ break;
+ }
+ }
+ }
+
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ this.mouseOverItemIndex = -1;
+ this.Invalidate();
+ }
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ if (Items == null || Items.Length < 1)
+ {
+ this.mouseOverItemIndex = -1;
+ return;
+ }
+
+ for (int i = 0; i < Items.Length; i++)
+ {
+ var rect = Items[i].rect;// rects[i];
+ if (rect.Contains(e.Location))
+ {
+ if (i != mouseOverItemIndex)
+ {
+ mouseOverItemIndex = i;
+ this.Invalidate();
+ }
+
+ break;
+ }
+ }
+ }
+ public void setItemTextAlign(int row, int col, System.Drawing.ContentAlignment TextAlign)
+ {
+ var item = this.Items.Where(t => t.row == row && t.col == col).FirstOrDefault();
+ if (item != null) item.TextAlign = TextAlign;
+ }
+ public void setItemTextAlign(System.Drawing.ContentAlignment TextAlign)
+ {
+ foreach (var item in this.Items)
+ item.TextAlign = TextAlign;
+ }
+
+ protected override void OnPaint(PaintEventArgs pe)
+ {
+ //배경그리기
+ //using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(DisplayRectangle, BackColor, BackColor2On, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
+ pe.Graphics.FillRectangle(new SolidBrush(BackColor), DisplayRectangle);
+
+ if (Items == null)
+ {
+ pe.Graphics.DrawString("no items", this.Font, Brushes.Red, 100, 100);
+ return;
+ }
+
+ var items = Items.OrderBy(t => t.No);
+ foreach (var menu in items)
+ {
+ drawItem(menu.idx, pe.Graphics);
+ }
+
+ //테두리 그리기
+ if (BorderSize > 0)
+ {
+ pe.Graphics.DrawRectangle(new Pen(this.BorderColor, BorderSize),
+ this.DisplayRectangle.Left,
+ this.DisplayRectangle.Top,
+ this.DisplayRectangle.Width - 1,
+ this.DisplayRectangle.Height - 1);
+ }
+ }
+
+ public void drawItem(int itemIndex, Graphics g = null)
+ {
+ if (g == null) g = this.CreateGraphics();
+ var menu = this.Items[itemIndex];
+
+ if (menu.rect == RectangleF.Empty) return;
+
+ var rect = menu.rect;// rects[i];
+
+ var diplayText = string.Empty;
+
+ //타이틀이 줄번호별로 처리됨
+ if (_titles != null && menu.row < _titles.Length && _titles[menu.row] != null )
+ {
+ var linebif = _titles[menu.row].Split('|');
+ if (menu.col < linebif.Length)
+ diplayText = linebif[menu.col];
+ }
+
+ UInt16 Value = 0;
+ if (_values != null && menu.idx < _values.Length) Value = _values[menu.idx];
+
+ //배경이 투명이 아니라면 그린다.
+ var bgColor1 = Color.FromArgb(30, 30, 30);// BackColor1Off;
+ var bgColor2 = Color.FromArgb(30, 30, 30);// BackColor2Off;
+
+ //해당 값에 따른 컬러값을 읽는다.
+ if (ColorList != null && Value < ColorList.Length)
+ {
+ bgColor1 = this.ColorList[Value].BackColor1;
+ bgColor2 = this.ColorList[Value].BackColor2;
+ }
+
+ using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, bgColor1, bgColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
+ g.FillRectangle(sb, rect);
+
+ // if (mouseOverItemIndex == menu.idx)
+ // this.Cursor = Cursors.Hand;
+ // else
+ // this.Cursor = Cursors.Arrow;
+
+ //테두리를 그리는 속성과 트기가 설정된 경우에만 표시
+ //if (mouseOverItemIndex == i)
+ // {
+ // pe.Graphics.DrawRectangle(new Pen(Color.DeepSkyBlue), rect.Left, rect.Top, rect.Width, rect.Height);
+ //}
+ //else
+ {
+ if (MenuBorderSize > 0)
+ {
+ using (var p = new Pen(BorderColor, MenuBorderSize))
+ g.DrawRectangle(p, rect.Left, rect.Top, rect.Width, rect.Height);
+ }
+ }
+
+ //인덱스번호 출력
+ if (ShowIndexString && _names != null && menu.idx < _names.Length)
+ {
+ //표시글자
+ var idxstr = string.Format("[{0}] {1}", menu.idx, _names[menu.idx]);
+
+ //그림자 추가
+ if (ShadowColor != System.Drawing.Color.Transparent)
+ g.DrawString(idxstr, FontPin, new SolidBrush(ShadowColor), menu.rect.Left + 4, menu.rect.Top + 4);
+
+ //일반글자표시
+ g.DrawString(idxstr, FontPin, new SolidBrush(this.ForeColorPin), menu.rect.Left + 3, menu.rect.Top + 3);
+ }
+
+ if (diplayText != "")
+ {
+ using (StringFormat sf = new StringFormat(StringFormatFlags.NoClip))
+ {
+ //글자를 텍스트 이후에 붙이는 거라면?
+ if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.BottomLeft ||
+ menu.TextAlign == ContentAlignment.BottomRight) sf.LineAlignment = StringAlignment.Far;
+ else if (menu.TextAlign == ContentAlignment.MiddleCenter || menu.TextAlign == ContentAlignment.MiddleLeft ||
+ menu.TextAlign == ContentAlignment.MiddleRight) sf.LineAlignment = StringAlignment.Center;
+ else if (menu.TextAlign == ContentAlignment.TopCenter || menu.TextAlign == ContentAlignment.TopLeft ||
+ menu.TextAlign == ContentAlignment.TopRight) sf.LineAlignment = StringAlignment.Near;
+
+ if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.MiddleCenter ||
+ menu.TextAlign == ContentAlignment.TopCenter) sf.Alignment = StringAlignment.Center;
+ else if (menu.TextAlign == ContentAlignment.BottomLeft || menu.TextAlign == ContentAlignment.MiddleLeft ||
+ menu.TextAlign == ContentAlignment.TopLeft) sf.Alignment = StringAlignment.Near;
+ else if (menu.TextAlign == ContentAlignment.BottomRight || menu.TextAlign == ContentAlignment.MiddleRight ||
+ menu.TextAlign == ContentAlignment.TopRight) sf.Alignment = StringAlignment.Far;
+
+ //그림자 추가
+ if (ShadowColor != System.Drawing.Color.Transparent)
+ g.DrawString(diplayText, this.Font, new SolidBrush(ShadowColor),
+ new RectangleF((float)(rect.Left + 1f), (float)(rect.Top + 1f), (float)rect.Width, (float)rect.Height), sf);
+
+ g.DrawString(diplayText, this.Font, new SolidBrush(ForeColor), rect, sf);
+ }
+ }
+
+ if (showDebugInfo)
+ {
+ g.DrawString(Value.ToString(), this.fontPin, Brushes.SkyBlue, rect.Left, rect.Top);
+ }
+
+ }
+
+ ///
+ /// arFrame 전용 속성값을 복사 합니다
+ ///
+ ///
+ public void copyTo(GridView ctl)
+ {
+ ctl.backcolor = this.backcolor;
+ ctl.menugap = this.menugap;
+ ctl.Items = this.Items;
+ ctl.menubordersize = this.menubordersize;
+ ctl.padding = this.padding;
+ ctl.ForeColor = this.ForeColor;
+ ctl.Font = this.Font;
+ ctl.TextAttachToImage = this.TextAttachToImage;
+ ctl.bordercolor = this.bordercolor;
+ ctl.bordersize = this.bordersize;
+ }
+
+ public void RemakeChartRect()
+ {
+ if (DisplayRectangle == Rectangle.Empty) return;
+
+ double x = 0;
+ double y = 0;
+ double w = DisplayRectangle.Width / (ColumnCount * 1.0);
+ double h = DisplayRectangle.Height / (RowCount * 1.0);
+
+ if (this.Items == null || itemCount != this.Items.Length)
+ {
+ //아이템갯수가 달라졌으므로 다시 갱신해야함
+ GridViewItem[] item = new GridViewItem[RowCount * ColumnCount];
+ for (int r = 0; r < RowCount; r++)
+ {
+ for (int c = 0; c < ColumnCount; c++)
+ {
+ int idx = r * ColumnCount + c;
+ item[idx] = new GridViewItem(idx, r, c);
+ item[idx].Enable = false;
+ item[idx].Padding = new Padding(0, 0, 0, 0);
+ item[idx].TextAlign = ContentAlignment.MiddleCenter;
+ x = (c * w);
+ y = (r * h);
+ item[idx].rect = new RectangleF((float)x, (float)y, (float)w, (float)h);
+ }
+ }
+
+ this.Items = item;
+ }
+ else
+ {
+ //아이템의 갯수는 같으므로 좌표값만 변경해준다.
+ for (int r = 0; r < RowCount; r++)
+ {
+ for (int c = 0; c < ColumnCount; c++)
+ {
+ int idx = r * ColumnCount + c;
+ var item = Items[idx];
+ x = (c * w);
+ y = (r * h);
+ item.Dirty = true;
+ item.rect = new RectangleF((float)x, (float)y, (float)w, (float)h);
+ }
+ }
+ }
+ this.Invalidate();
+
+ //int i = 0;
+ //var menuList = this.Items.OrderBy(t => t.No).ToArray();
+ //foreach (var menu in menuList)
+ //{
+ // int x, y, w, h;
+ // // var menu = menus[i];
+
+ // var mWidth = menuwidth;
+ // if (menu.MenuWidth > 0) mWidth = menu.MenuWidth;
+
+ // w = mWidth;
+ // h = DisplayRectangle.Height - Padding.Top - Padding.Bottom;
+
+ // if (menu.isRightMenu)
+ // {
+ // x = DisplayRectangle.Right - Padding.Right - (rightAcc) - (MenuGap * rightIdx);
+ // y = DisplayRectangle.Top + Padding.Top;
+ // rightAcc += 0;// = 0;// x;
+ // rightIdx += 1;
+ // }
+ // else
+ // {
+ // x = DisplayRectangle.Left + Padding.Left + leftAcc + (MenuGap * leftIdx);
+ // y = DisplayRectangle.Top + Padding.Top;
+ // leftAcc += mWidth;
+ // leftIdx += 1;
+ // }
+ // rects[i] = new Rectangle(x, y, w, h);
+ // i += 1;
+ //}
+ }
+ }
+}
diff --git a/Cs_HMI/SubProject/AGVControl/Properties/Resources.Designer.cs b/Cs_HMI/SubProject/AGVControl/Properties/Resources.Designer.cs
index 97968f8..f1f5a9b 100644
--- a/Cs_HMI/SubProject/AGVControl/Properties/Resources.Designer.cs
+++ b/Cs_HMI/SubProject/AGVControl/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace AGVControl.Properties {
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [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 {
@@ -47,8 +47,8 @@ namespace AGVControl.Properties {
}
///
- /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
- /// 재정의합니다.
+ /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대한 현재 스레드의 CurrentUICulture
+ /// 속성을 재정의합니다.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
diff --git a/Cs_HMI/SubProject/AGVControl/agvControl.csproj b/Cs_HMI/SubProject/AGVControl/agvControl.csproj
index 8790cfe..90480cc 100644
--- a/Cs_HMI/SubProject/AGVControl/agvControl.csproj
+++ b/Cs_HMI/SubProject/AGVControl/agvControl.csproj
@@ -34,6 +34,9 @@
false
+
+ ..\..\DLL\arCommUtil.dll
+
@@ -57,6 +60,14 @@
fPropertyRFIDPoint.cs
+
+
+
+ Component
+
+
+ GridView.cs
+
@@ -134,10 +145,6 @@
{14e8c9a5-013e-49ba-b435-efefc77dd623}
CommData
-
- {14e8c9a5-013e-49ba-b435-ffffff7dd623}
- arCommUtil
-
diff --git a/Cs_HMI/SubProject/BMS/BMS.cs b/Cs_HMI/SubProject/BMS/BMS.cs
index 0ab5815..7bc656e 100644
--- a/Cs_HMI/SubProject/BMS/BMS.cs
+++ b/Cs_HMI/SubProject/BMS/BMS.cs
@@ -91,7 +91,10 @@ namespace arDev
}
bool Recv0 = false;
+ int Recv0Cnt = 0;
bool Recv1 = false;
+ int Recv1Cnt = 0;
+
public event EventHandler ChargeDetect;
public override bool ProcessRecvData(byte[] data)
{
@@ -110,6 +113,13 @@ namespace arDev
}
+ if (VerifyChecksum(data) == false)
+ {
+ RaiseMessage(MessageType.Error, "Checksum error");
+ return false;
+ }
+
+
if (data[1] == 0x03)
{
return ParseBMSInfo();
@@ -123,6 +133,8 @@ namespace arDev
}
bool ParseBMSCellVoltage()
{
+ if (UseCmdLogging == true)
+ RaiseMessage(MessageType.Recv, ByteListToHexString(LastReceiveBuffer.ToList()));
//var i = 0;
var BatteryCell_Checksum = 0xffff;// - (LastReceiveBuffer[i + 3] + LastReceiveBuffer[i + 4] + LastReceiveBuffer[i + 5] + LastReceiveBuffer[i + 6] + LastReceiveBuffer[i + 7] + LastReceiveBuffer[i + 8] + LastReceiveBuffer[i + 9] + LastReceiveBuffer[i + 10] + LastReceiveBuffer[i + 11] + LastReceiveBuffer[i + 12] + LastReceiveBuffer[i + 13] + LastReceiveBuffer[i + 14] + LastReceiveBuffer[i + 15] + LastReceiveBuffer[i + 16] + LastReceiveBuffer[i + 17] + LastReceiveBuffer[i + 18] + LastReceiveBuffer[i + 19])) + 1;
for (int i = 3; i < 20; i++)
@@ -170,8 +182,62 @@ namespace arDev
}
+
+
+
+ public static bool VerifyChecksum(byte[] dataBytes)
+ {
+ // 길이 바이트 (byte[3])
+ byte length = dataBytes[3];
+
+ if (dataBytes[1] == 0x03)
+ {
+
+ // 데이터 바이트 (byte[4] ~ byte[30])
+ byte[] data = dataBytes.Skip(4).Take(27).ToArray();
+
+ // 길이와 데이터의 합을 계산
+ ushort sum = (ushort)(length + data.Sum(b => b));
+
+ // 반전시키고 높은 위치부터 낮은 위치로 더한 후 1을 더함
+ ushort checksum = (ushort)((~sum + 1) & 0xFFFF);
+
+ // 받은 체크섬 (byte[31] ~ byte[32])
+ ushort receivedChecksum = (ushort)((dataBytes[31] << 8) | dataBytes[32]);
+
+ //252 1: 64514
+ // 계산된 체크섬과 받은 체크섬을 비교
+ return checksum == receivedChecksum;
+
+ }
+ else if (dataBytes[1] == 0x04)
+ {
+ // 데이터 바이트 (byte[4] ~ byte[30])
+ byte[] data = dataBytes.Skip(4).Take(16).ToArray();
+
+ // 길이와 데이터의 합을 계산
+ ushort sum = (ushort)(length + data.Sum(b => b));
+
+ // 반전시키고 높은 위치부터 낮은 위치로 더한 후 1을 더함
+ ushort checksum = (ushort)((~sum + 1) & 0xFFFF);
+
+ // 받은 체크섬 (byte[31] ~ byte[32])
+ ushort receivedChecksum = (ushort)((dataBytes[20] << 8) | dataBytes[21]);
+
+ //252 1: 64514
+ // 계산된 체크섬과 받은 체크섬을 비교
+ return checksum == receivedChecksum;
+
+ }
+
+ return false;
+ }
+
bool ParseBMSInfo()
{
+ if(UseCmdLogging == true)
+ RaiseMessage(MessageType.Recv, ByteListToHexString(LastReceiveBuffer.ToList()));
+
//전압확인
UInt16 batH = (UInt16)LastReceiveBuffer[4];
UInt16 batL = (UInt16)LastReceiveBuffer[5];
@@ -361,6 +427,10 @@ namespace arDev
public int QueryIndex { get; set; } = 0;
+ public int CMDOutCnt { get; set; } = 3;
+
+ public bool UseCmdLogging { get; set; } = false;
+
///
/// 상태읽기와 전압읽기명령을 반복합니다
///
@@ -375,8 +445,22 @@ namespace arDev
Recv1 = false;
return true;
}
+ else
+ {
+ if (Recv0Cnt > CMDOutCnt)
+ {
+ Recv0Cnt = 0;
+ RaiseMessage(MessageType.Error, "0 명령 Count Out");
+ QueryIndex = 1;
+ Recv1 = false;
+ return true;
+ }
+ else
+ {
+ return SendQuery_ReadStatue();
+ }
- return SendQuery_ReadStatue();
+ }
}
else
{
@@ -386,29 +470,47 @@ namespace arDev
Recv0 = false;
return true;
}
-
- return SendQuery_ReadCellvoltage();
+ else
+ {
+ if (Recv1Cnt > CMDOutCnt)
+ {
+ Recv1Cnt = 0;
+ RaiseMessage(MessageType.Error, "1 명령 Count Out");
+ QueryIndex = 0;
+ Recv0 = false;
+ return true;
+ }
+ else
+ {
+ return SendQuery_ReadCellvoltage();
+ }
+ }
}
}
public Boolean SendQuery_ReadStatue()
{
+ Recv0Cnt++;
Recv0 = false;
var cmd = new List();
- cmd.Add(0xDD); //stx
- cmd.Add(0xA5); //read
- cmd.Add(0x03); //command
+ cmd.Add(0xDD);
+ cmd.Add(0xA5);
+ cmd.Add(0x03);
cmd.Add(0x00);
cmd.Add(0xFF);
- cmd.Add(0xFD); //checksum1
- cmd.Add(0x77); //checksum2
- cmd.Add(0x0D); //etx
+ cmd.Add(0xFD);
+ cmd.Add(0x77);
+ cmd.Add(0x0D);
+ if (UseCmdLogging == true)
+ RaiseMessage(MessageType.Normal, ByteListToHexString(cmd));
+
return WriteData(cmd.ToArray());
}
public Boolean SendQuery_ReadCellvoltage()
{
+ Recv1Cnt++;
Recv1 = false;
var cmd = new List();
cmd.Add(0xDD);
@@ -419,8 +521,21 @@ namespace arDev
cmd.Add(0xFC);
cmd.Add(0x77);
cmd.Add(0x0D);
+ if (UseCmdLogging == true)
+ RaiseMessage(MessageType.Normal, ByteListToHexString(cmd));
return WriteData(cmd.ToArray());
}
+
+ public string ByteListToHexString(List byteList)
+ {
+ StringBuilder hex = new StringBuilder(byteList.Count * 2);
+ foreach (byte b in byteList)
+ {
+ hex.AppendFormat("{0:X2} ", b);
+ }
+ return hex.ToString();
+ }
+
}
}
diff --git a/Cs_HMI/SubProject/ProPLC/Arduino/EnumStruct.cs b/Cs_HMI/SubProject/ProPLC/Arduino/EnumStruct.cs
deleted file mode 100644
index 6dfda17..0000000
--- a/Cs_HMI/SubProject/ProPLC/Arduino/EnumStruct.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace arDev.Arduino
-{
- public enum IODirection
- {
- Input = 0,
- Output
- }
-
- public enum MessageType
- {
- Normal = 0,
- SendData,
- ReceiveData,
- Message,
- RxIOData,
- RxSetData,
- }
-
-}
diff --git a/Cs_HMI/SubProject/ProPLC/Arduino/EventsIO.cs b/Cs_HMI/SubProject/ProPLC/Arduino/EventsIO.cs
deleted file mode 100644
index 51b572d..0000000
--- a/Cs_HMI/SubProject/ProPLC/Arduino/EventsIO.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace arDev.Arduino
-{
- public partial class DIO
- {
- ///
- /// Digital Input/Output Changed
- ///
- public event EventHandler ValueChanged;
- public event EventHandler FlagChanged;
-
- ///
- /// 마그넷 센서의 값이 변경되었을때 발생 함
- ///
- public event EventHandler PositionChanged;
-
- /////
- ///// Digital Input/Output Message
- /////
- //public event EventHandler Message;
-
- public class FlagValueEventArgs : EventArgs
- {
- private int _arridx;
- private Boolean _oldvalue;
- private Boolean _newvalue;
-
- public int ArrIDX { get { return _arridx; } }
- public Boolean OldValue { get { return _oldvalue; } }
- public Boolean NewValue { get { return _newvalue; } }
-
- public FlagValueEventArgs( int ArrIDX, Boolean oldvalue, Boolean newvalue)
- {
- _arridx = ArrIDX;
- _oldvalue = oldvalue;
- _newvalue = newvalue;
- }
- }
-
- public class IOValueEventArgs : EventArgs
- {
- private int _arridx;
- private Boolean _oldvalue;
- private Boolean _newvalue;
- private IODirection _dir;
-
- public int ArrIDX { get { return _arridx; } }
- public Boolean OldValue { get { return _oldvalue; } }
- public Boolean NewValue { get { return _newvalue; } }
- public IODirection Direction { get { return _dir; } }
-
- public IOValueEventArgs(IODirection dir, int ArrIDX, Boolean oldvalue, Boolean newvalue)
- {
- _arridx = ArrIDX;
- _oldvalue = oldvalue;
- _newvalue = newvalue;
- _dir = dir;
- }
- }
-
- //public class MessageEventArgs : EventArgs
- //{
- // private Boolean _isError = false;
- // public Boolean IsError { get { return _isError; } }
- // private string _message = string.Empty;
- // public string Message { get { return _message; } }
- // private Arduino.MessageType _mtype;
- // public Arduino.MessageType MessageType { get { return _mtype; } }
- // public MessageEventArgs(Arduino.MessageType mType, string Message, Boolean isError)
- // {
- // _isError = isError;
- // _message = Message;
- // this._mtype = mType;
- // }
- //}
-
- }
-}
diff --git a/Cs_HMI/SubProject/ProPLC/Arduino/MemoryAccess.cs b/Cs_HMI/SubProject/ProPLC/Arduino/MemoryAccess.cs
deleted file mode 100644
index 1ba4a7d..0000000
--- a/Cs_HMI/SubProject/ProPLC/Arduino/MemoryAccess.cs
+++ /dev/null
@@ -1,556 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.ComponentModel;
-using System.Reflection;
-using System.Runtime;
-using System.Runtime.InteropServices;
-using System.Collections.Concurrent;
-
-namespace arDev.Arduino
-{
- public partial class DIO : arRS232
- {
- protected object lockobj = new object();
- public struct SetupInfo
- {
- public byte ioInterval;
- public byte ResetCount;
- public byte SpeedH;
- public byte SpeedL;
- public byte SpeedZ;
- public byte pindirRevDILow;
- public byte pindirRevDIHigh;
- public byte UpTime;
- public byte BalanceThd;
- public byte MarkThd;
- public byte SpeedC;
- public byte BalanceThdUp;
-
- public Boolean IsValid;
- public void Clear()
- {
- pindirRevDIHigh = 0;
- pindirRevDILow = 0;
- ioInterval = 0;
- ResetCount = 0;
- SpeedH = 0;
- SpeedL = 0;
- SpeedC = 0;
- BalanceThd = 0;
- BalanceThd = 0;
- UpTime = 0;
- MarkThd = 0;
- SpeedZ = 0;
- IsValid = false;
- }
- }
-
- public SetupInfo setupInfo;
- private Boolean STX11 = false;
- private Boolean STX21 = false;
- //private Boolean ETX11 = false;
- // private byte[] buffer1;
- // readonly List Tempbuffer1 = new List();
- readonly ManualResetEvent mre = new ManualResetEvent(true);
- // protected string errorMessage = string.Empty;
- // readonly System.IO.Ports.SerialPort dev = null;
- private byte LEN1 = 0;
- //private byte CHK1 = 0;
- //private int bufferCount1 = 0;
-
- public DateTime ConnTryTime = DateTime.Now.AddDays(-1);
- protected DateTime[] SetFlagTime = new DateTime[32];
- readonly Boolean[] Flag = new bool[32];
- readonly Boolean[] DIValue = new bool[16];
- readonly Boolean[] DOValue = new bool[16];
- public UInt16[] AIValue = new ushort[3];
- public byte[] AOValue = new byte[3];
- public string ioBinStr = string.Empty;
- public string SetupStr = string.Empty;
- public byte RunTime = 0;
-
- public byte[] MAG_VALUE = new byte[2];
- public byte[] SV_SPEED = new byte[2];
- public Boolean isDisposed = false; //dispose가 호출되었는가?
-
- public string LastMessage { get; set; }
- public DateTime LastMessageTime { get; set; }
-
-
- ///
- /// 생성자
- ///
- public DIO()
- {
- //설정의 값
- setupInfo = new SetupInfo();
- setupInfo.Clear();
-
- SV_SPEED[0] = 0;
- SV_SPEED[1] = 0;
-
- //마그넷 센서(0~100)
- MAG_VALUE[0] = 50;
- MAG_VALUE[1] = 50;
-
- lastRecvTime = DateTime.Parse("1982-11-23");
-
- for (int i = 0; i < Flag.Length; i++)
- Flag[i] = false;
- for (int i = 0; i < DIValue.Length; i++)
- DIValue[i] = false;
- for (int i = 0; i < DOValue.Length; i++)
- DOValue[i] = false;
- for (int i = 0; i < AIValue.Length; i++)
- AIValue[i] = 0;
- for (int i = 0; i < AOValue.Length; i++)
- AOValue[i] = 0;
- for (int i = 0; i < SetFlagTime.Length; i++)
- SetFlagTime[i] = DateTime.Parse("1982-11-23");
-
- }
-
- protected override bool CustomParser(byte[] buf, out byte[] remainBuffer)
- {
- List remain = new List();
-
-
- Boolean bComplete = false;
- for (int i = 0; i < buf.Length; i++)
- {
- var incomByte = buf[i];
- if (bComplete == true)
- {
- remain.Add(incomByte);
- }
- else
- {
- if (STX11 == false)
- {
- if (incomByte != '@')
- {
- STX21 = false;
- // ETX11 = false;
- continue;
- }
- else
- {
- STX11 = true;
- tempBuffer.Clear();
- tempBuffer.Add(incomByte);
- }
- }
- else if (STX21 == false)
- {
- if (tempBuffer.Count != 1 || tempBuffer.Count < 1 || tempBuffer[0] != '@' || incomByte != '@')
- {
- STX11 = false;
- //ETX11 = false;
- continue;
- }
- else
- {
- STX21 = true;
- tempBuffer.Add(incomByte);
- }
- }
- else
- {
- tempBuffer.Add(incomByte);
-
- //여기서부터는무조건 누적한다.
- if (tempBuffer.Count == 3)
- {
- if (tempBuffer[0] != '@' || tempBuffer[1] != '@')
- {
- STX11 = false;
- STX21 = false;
- // ETX11 = false;
- LEN1 = 0;
- tempBuffer.Clear();
- }
- else LEN1 = incomByte; //데이터 길이가온다
- }
- //else if (Tempbuffer1.Count == LEN1 + 5) //ETX1
- //{
- // if (incomingByte != 0x0D)
- // {
- // //ETX가 와야하는데 다른데이터가 왔다
- // STX11 = false;
- // STX21 = false;
- // // ETX11 = false;
-
- // var str = System.Text.Encoding.Default.GetString(Tempbuffer1.ToArray());
- // RaiseMessage(MessageType.ReceiveData, "에러 모두 파기 : " + str, true);
-
- // Tempbuffer1.Clear();
- // }
- //}
- else if (tempBuffer.Count == LEN1 + 6)
- {
- //전체길이를 만족햇다.
- if (incomByte != 0x0A)
- {
- //ETX가 와야하는데 다른데이터가 왔다
- STX11 = false;
- STX21 = false;
- // ETX11 = false;
- //var str = System.Text.Encoding.Default.GetString(Tempbuffer1.ToArray());
- RaiseMessage(MessageType.Error, "에러 모두 파기 : ETX 값 오류");
- tempBuffer.Clear();
- }
- else if (tempBuffer[tempBuffer.Count - 2] != 0x0D)
- {
- //ETX가 와야하는데 다른데이터가 왔다
- STX11 = false;
- STX21 = false;
- // ETX11 = false;
- //var str = System.Text.Encoding.Default.GetString(Tempbuffer1.());
- RaiseMessage(MessageType.Error, "에러 모두 파기 : ETX 값 오류");
- tempBuffer.Clear();
- }
- else
- {
- STX11 = false;
- STX21 = false;
- // ETX11 = false;
- //if (LastReceiveBuffer == null) LastReceiveBuffer = new byte[tempBuffer.Count];
- //else if (LastReceiveBuffer.Length != tempBuffer.Count) Array.Resize(ref LastReceiveBuffer, Tempbuffer1.Count);
- //tempBuffer.CopyTo(LastReceiveBuffer)tempBuffer
- //tempBuffer.Clear();
- bComplete = true;
- }
- }
- }
- }
-
-
-
- }
-
- remainBuffer = remain.ToArray();
- return bComplete;
- }
-
-
- bool Checksum(byte[] buffer, int datalength)
- {
- //체크섬필요 221118
- if (buffer[buffer.Length-3] == '*')
- {
- return true;
- }
- byte checksum = 0;
- for (int i = 3; i < datalength + 3; i++)
- {
- checksum = (byte)(checksum ^ buffer[i]);
- }
- return checksum == buffer[buffer.Length - 3];
- }
-
- public override bool ProcessRecvData(byte[] data)
- {
- var hexString = GetHexString(data);//.gethe
- var len = data[2];
- if (len + 6 != data.Length)
- {
- RaiseMessage(MessageType.Error, string.Format("길이오류 예상:{0},수신:{1},{2}", len + 5, data.Length, hexString));
- }
- else if (data[0] != 0x40 || data[1] != 0x40 || data[data.Length - 2] != 0x0D || data[data.Length - 1] != 0x0A)
- {
- RaiseMessage(MessageType.Error, string.Format("헤더 오류 : {0}", hexString));
- }
- else if (Checksum(data, len) == false) //체크섬 221118
- {
- RaiseMessage(MessageType.Error, string.Format("체크섬 오류 : {0}", hexString));
- }
- else
- {
- //RaiseMessage(MessageType.ReceiveData, hexString);
- lastRecvTime = DateTime.Now;
- var cmd = data[3];
- if (cmd == 'I') //IOData
- {
- if (len != 10)
- RaiseMessage(MessageType.Error, "IO수신길이오류:" + DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString);
- else Parse_IOData(data);
- }
- else if (cmd == 'T')
- {
- // Boolean errorMessage = buffer[4] == 1;
- var message = System.Text.Encoding.Default.GetString(data, 5, len - 2);//데이터타입과 에러여부 제거
- LastMessage = message;
- LastMessageTime = DateTime.Now;
- RaiseMessage(MessageType.Normal, message);
- }
- else if (cmd == 'S') //setup 정보 200310 (홈)
- {
- if (len != 13)
- RaiseMessage(MessageType.Error, "SETUP수신길이오류:" + DateTime.Now.ToString("mm:ss.fff") + " 수신 : " + hexString);
- else Parse_SetupData(data);
- }
- else
- {
- RaiseMessage(MessageType.Normal, "Unknown:" + hexString + "\n" + "Data=" + System.Text.Encoding.Default.GetString(data));
- }
- }
- return true;
- }
-
-
-
-
- void Parse_IOData(byte[] buffer)
- {
- var IOData = BitConverter.ToUInt32(buffer, 4);
-
- //var newMagF = BitConverter.ToUInt16(buffer, 8);
- //va1r newMagB = BitConverter.ToUInt16(buffer, 10);
- //var newAlign = BitConverter.ToUInt16(buffer, 12);
- //if (newMagF != AIValue[0] || newMagB != AIValue[1])
- //{
- // AIValue[0] = newMagF;// BitConverter.ToUInt16(buffer, 8); //마그넷센서 F
- // AIValue[1] = newMagB; //BitConverter.ToUInt16(buffer, 10); //마그넷센서 B
- // PositionChanged?.Invoke(this, null);
- //}
- //AIValue[2] = newAlign;
- //AOValue[0] = buffer[14]; //왼쪽바퀴 속도
- //AOValue[1] = buffer[15]; //오른쪽바퀴 속도
- //AOValue[2] = buffer[16]; //Z축 속도
- //SV_SPEED[0] = buffer[21]; //왼쪽바퀴의 설정속도
- //SV_SPEED[1] = buffer[22]; //오른쪽바퀴의 설정속도
- //MAG_VALUE[0] = buffer[23]; //magnet front
- //MAG_VALUE[1] = buffer[24]; //magnet rear
- RunTime = buffer[12];
-
- //플래그값 확인
- byte[] buf_flag = new byte[4];
- Array.Copy(buffer, 8, buf_flag, 0, 4);
- var baF = new System.Collections.BitArray(buf_flag);
- for (int i = 0; i < 32; i++)
- {
- Boolean val = baF[i];
-
- //입력
- if (this.Flag[i] != val)
- {
- Flag[i] = val;
-
- //변경이벤트 생성
- FlagChanged?.Invoke(this, new FlagValueEventArgs(i, !val, val));
- }
- }
-
- //IO값 확인
- byte[] buf_iodata = new byte[4];
- Array.Copy(buffer, 4, buf_iodata, 0, 4);
- var ba = new System.Collections.BitArray(buf_iodata);
- for (int i = 0; i < 32; i++)
- {
- Boolean val = ba[i];
- if (i >= 16)
- {
- //출력
- if (DOValue[i - 16] != val)
- {
- DOValue[i - 16] = val;
-
- //변경이벤트 생성
- ValueChanged?.Invoke(this, new IOValueEventArgs(IODirection.Output, i - 16, !val, val));
- }
- }
- else
- {
- //입력
- if (DIValue[i] != val)
- {
- DIValue[i] = val;
-
- //변경이벤트 생성
- ValueChanged?.Invoke(this, new IOValueEventArgs(IODirection.Input, i, !val, val));
- }
- }
- }
-
- ioBinStr = Convert.ToString(IOData, 2).PadLeft(32, '0');
- //string msg = string.Format(DateTime.Now.ToString("mm:ss.fff") + " IO:{0},AN={1:0000},{2:0000},FG={3},AO={4},{5}",
- // binstr, An1, An2, FGData, Ao11, Ao12);
- }
- void Parse_SetupData(byte[] buffer)
- {
- setupInfo.ioInterval = buffer[4];
- setupInfo.ResetCount = buffer[5];
- setupInfo.SpeedH = buffer[6];
- setupInfo.SpeedL = buffer[7];
- setupInfo.SpeedZ = buffer[8];
- setupInfo.pindirRevDIHigh = buffer[9];
- setupInfo.pindirRevDILow = buffer[10];
- setupInfo.UpTime = buffer[11];
- setupInfo.BalanceThd = buffer[12];
- setupInfo.MarkThd = buffer[13];
- setupInfo.SpeedC = buffer[14];
- setupInfo.BalanceThdUp = buffer[15];
-
- SetupStr = string.Format("I:{0},R={1},H={2},L={3},Z={4},UP={5},BL={6},MK={7},SPD_C={8},BLUP={9}",
- setupInfo.ioInterval,
- setupInfo.ResetCount,
- setupInfo.SpeedH,
- setupInfo.SpeedL,
- setupInfo.SpeedZ,
- setupInfo.UpTime,
- setupInfo.BalanceThd,
- setupInfo.MarkThd,
- setupInfo.SpeedC,
- setupInfo.BalanceThdUp);
- }
-
- public byte MakeChecksum(byte[] buffer)
- {
- //return 0;
- byte chk = 0;
- foreach (var b in buffer)
- chk = (byte)(chk ^ b);
- return chk;
- }
-
-
-
-
- #region "Method"
-
- protected Boolean Sendcommand(byte cmd, byte p1, byte p2)
- {
- //이번호의 상태를 on/off 해줘야함
- List buffer = new List
- {
- cmd, //command
- p1,
- p2
- };
-
- byte dataLen = (byte)buffer.Count; //데이터길이
- byte checksum = MakeChecksum(buffer.ToArray());
-
- buffer.Insert(0, (byte)'@'); //stx
- buffer.Insert(1, (byte)'@'); //stx
- buffer.Insert(2, dataLen);
- buffer.Add(checksum); //길이를 제외한 실제 데이터 영역만 체크섬
- buffer.Add(0x0D); //etx
- buffer.Add(0x0A); //etx
-
- return WriteData(buffer.ToArray());
- }
-
-
-
-
- ///
- /// 이벤트를 강제 생성합니다.(내부변수값도 변경됩니다)
- ///
- ///
- ///
- ///
- public void RaiseEvent(IODirection dir, int idx, Boolean value)
- {
- if (ValueChanged != null)
- {
- if (!mre.WaitOne(100))
- {
- RaiseMessage( MessageType.Error, "RaiseEvent WaitOne Timeout");
- return;
- }
-
- mre.Reset();
-
- bool curValue;
- if (dir == IODirection.Input)
- {
- curValue = DIValue[idx];
- DIValue[idx] = value;
- }
- else
- {
- curValue = DOValue[idx];
- DOValue[idx] = value;
- }
-
- try
- {
- //이벤트를 할당한곳에서 오류가 나면 이곳에서 에러가 잡힌다.
- ValueChanged(this, new IOValueEventArgs(dir, idx, curValue, value));
- }
- catch (Exception ex)
- {
- RaiseMessage(MessageType.Error, ex.Message);
- }
- finally
- {
- mre.Set();
- }
- }
- }
-
- //public Boolean GetFlag(byte idx)
- //{
- // return Flag[idx];
- //}
-
- public Boolean GetValueI(byte idx)
- {
- if (idx < DIValue.Length) return DIValue[idx];
- else return false;
- }
-
- public Boolean GetValueO(byte idx)
- {
- if (idx < DOValue.Length) return DOValue[idx];
- else return false;
- }
-
-
- //public Boolean SetValueI(int idx,Boolean value)
- //{
- // if (idx < DIValue.Length)
- // {
- // DIValue[idx] = value;
- // return true;
- // }
- // else return false;
- //}
-
- public Boolean SetValue(byte idx, Boolean value)
- {
- byte SET_PINMODE = 3;
- if (value == true) return Sendcommand(SET_PINMODE, idx, 1);
- else return Sendcommand(SET_PINMODE, idx, 0);
- }
-
-
- public Boolean SetToggle(byte idx)
- {
- var curbalue = GetValueO(idx);
- return SetValue(idx, !curbalue);
- }
-
-
-
- public string GetErrorMessage()
- {
- return errorMessage;
- }
-
-
-
-
- #endregion
-
-
-
-
-
-
- }
-}
diff --git a/Cs_HMI/SubProject/ProPLC/FakePLC.cs b/Cs_HMI/SubProject/ProPLC/FakePLC.cs
deleted file mode 100644
index b125593..0000000
--- a/Cs_HMI/SubProject/ProPLC/FakePLC.cs
+++ /dev/null
@@ -1,389 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using arDev.Arduino;
-using COMM;
-using AR;
-
-
-namespace arDev
-{
- public class FakePLC : arDev.Arduino.DIO
- {
-
- private System.Threading.Thread thPLC;
- public bool Shutdown { get; set; } = false;
-
- public FakePLC()
- {
- VAR.Init(128);
- }
-
- ~FakePLC()
- {
-
- System.Threading.Tasks.Task.Run(() =>
- {
- //쓰레드가 살아잇다면 대기한다
- if (thPLC != null && thPLC.IsAlive)
- {
- System.Threading.Thread.Sleep(100);
- }
-
- this.Close();
- });
- }
-
-
- private object lockobjdata = new object();
- public enum eEEPAddress
- {
- EEP_IOINTERVAL = 0,
- EEP_RESETCOUNT,
- EEP_DIREVH,
- EEP_DIREVL,
- EEP_OPTION,
- EEP_UPTIME,
- };
-
- public enum eCommand : byte
- {
- LOAD = 0, //EEPROM 불러오기
- SAVE, //EEPROM 저장
- RESET, //초기화
- PINGCHK,
- SET_PINMODE, //PINMODE 설정
- SET_DOUTPUT, //디지털출력설정(포트번호,값[1,0])
- SET_AOUTPUT, //아날로그출력설정(포트GET_SETTING = 50, //셋팅값 요청
- SET_FLAG,
- SET_EEPROM,
- SET_MANUALSPEED,
- GET_SETTING = 50,
- GUIDE_MOT = 90, //가이드커버(양쪽) 0=멈춤,1=UP,2=DN 아스키코드표 90=Z
- SET_EEP_DIREV,
- };
-
-
- //public enum MotorType
- //{
- // Left = 0,
- // Right
- //}
- //public enum Direction
- //{
- // CW = 0,
- // CCW,
- //}
- //public enum RunType
- //{
- // Stop = 0,
- // Up,
- // Dn
- //}
-
- public enum DIName
- {
- PINI_EMG = 0,
- PINI_BTN_1,
- PINI_BTN_2,
- PINI_BTN_3,
- PINI_BTN_4,
- PINI_OVERLOADL,
- PINI_OVERLOADR,
- PINI_EMPTY_07,
- PINI_EMPTY_08,
- PINI_BTN_ZUP,
- PINI_BTN_ZDN,
- PINI_LIMIT_LU,
- PINI_LIMIT_LD,
- PINI_LIMIT_RU,
- PINI_LIMIT_RD,
- PINI_STOP,
- }
- public enum DIPin
- {
- PINI_EMG = 30,
- PINI_BTN_1,
- PINI_BTN_2,
- PINI_BTN_3,
- PINI_BTN_4,
- PINI_OVERLOADL,
- PINI_OVERLOADR,
- PINI_EMPTY_07,
- PINI_EMPTY_08,
- PINI_BTN_ZUP,
- PINI_BTN_ZDN,
- PINI_LIMIT_LU,
- PINI_LIMIT_LD,
- PINI_LIMIT_RU,
- PINI_LIMIT_RD,
- PINI_STOP,
-
- }
-
- public enum DOName
- {
- PINO_GUIDEMOTOR_LDIR,
- PINO_GUIDEMOTOR_LRUN,
- PINO_GUIDEMOTOR_RDIR,
- PINO_GUIDEMOTOR_RRUN,
- PINO_EMPTY_04,
- PINO_EMPTY_05,
- PINO_EMPTY_06,
- PINO_EMPTY_07,
- }
- public enum DOPin
- {
- PINO_GUIDEMOTOR_LDIR = 22,
- PINO_GUIDEMOTOR_LRUN,
- PINO_GUIDEMOTOR_RDIR,
- PINO_GUIDEMOTOR_RRUN,
- PINO_EMPTY_04,
- PINO_EMPTY_05,
- PINO_EMPTY_06,
- PINO_EMPTY_07,
- }
-
- public enum Rundirection : byte
- {
- Stop = 0,
- Forward,
- Backward,
- Left,
- Right,
- EStop,
- }
-
- public enum ZMotDirection
- {
- Stop = 0,
- Up,
- Down
- }
-
-
- private bool Sendcommand(eCommand cmd, char p1, char p2)
- {
- return Sendcommand(cmd, (byte)p1, (byte)p2);
- }
- private bool Sendcommand(eCommand cmd, char p1, byte p2 = 0)
- {
- return Sendcommand(cmd, (byte)p1, p2);
- }
- private bool Sendcommand(eCommand cmd, byte p1 = 0, byte p2 = 0)
- {
- if (cmd != eCommand.PINGCHK)
- {
- if (cmd == eCommand.SET_FLAG)
- {
- //플래그값은 공용변수로 변경
- var idx = (eVarBool)p1;
- VAR.BOOL[idx] = p2 != 0;
- RaiseMessage(MessageType.Send, string.Format("PLC CMD:{0} [{1}]=>{2}", cmd, (eVarBool)p1, p2));
- }
- else
- RaiseMessage(MessageType.Send, string.Format("PLC CMD:{0}, P1:{1}, P2:{2}", cmd, p1, p2));
- }
- return Sendcommand((byte)cmd, p1, p2);
- }
-
- public Boolean GetValueI(DIName idx)
- {
- return GetValueI((byte)idx);
- }
- public Boolean GetValueO(DOName idx)
- {
- return GetValueO((byte)idx);
- }
- public Boolean GetFlag(int flag)
- {
- return VAR.BOOL[flag];
- }
-
- public Boolean GetFlag(COMM.eVarBool flag)
- {
- return VAR.BOOL[(int)flag];
- }
-
- public Boolean SetFlag(byte idx, Boolean value)
- {
-
- SetFlagTime[(int)idx] = DateTime.Now; //플래그기록을 시도한 시간
-
- if (value == true)
- return Sendcommand(eCommand.SET_FLAG, idx, 1);
- else
- return Sendcommand(eCommand.SET_FLAG, idx, 0);
- }
-
- //public Boolean SetOpt_AD4Invert(Boolean value)
- //{
- // var idx = (byte)PLCFlag.FLAG_ENABLE_AD4INVERT;
- // SetFlagTime[idx] = DateTime.Now; //플래그기록을 시도한 시간
-
- // if (value == true)
- // return Sendcommand(eCommand.SET_FLAG, idx, 1);
- // else
- // return Sendcommand(eCommand.SET_FLAG, idx, 0);
- //}
- //public Boolean SetLog_SpeedControl(Boolean value)
- //{
- // var idx = (byte)PLCFlag.FLAG_ENABLE_LOG_SPEED;
- // SetFlagTime[idx] = DateTime.Now; //플래그기록을 시도한 시간
-
- // if (value == true)
- // return Sendcommand(eCommand.SET_FLAG, idx, 1);
- // else
- // return Sendcommand(eCommand.SET_FLAG, idx, 0);
- //}
-
-
-
- public Boolean SetFlag(eVarBool flag, Boolean value)
- {
- VAR.BOOL[flag] = value;
- return true;
- }
-
- public Boolean SetEEP(eEEPAddress address, byte value)
- {
- RaiseMessage(MessageType.Normal, string.Format("[M] Set EEP Rom Addr={0},Val={1}", address, value));
- return Sendcommand(eCommand.SET_EEPROM, (byte)address, value);
- }
-
- public Boolean SetOutput(byte pinNO, Boolean Value)
- {
- if (Value == true) return Sendcommand(eCommand.SET_DOUTPUT, pinNO, 1);
- else return Sendcommand(eCommand.SET_DOUTPUT, pinNO, 0);
- }
-
- public byte ApplySpeedH = 0;
- public byte ApplySpeedL = 0;
- public byte ApplySpeedC = 0;
- public byte ApplySpeedZ = 0;
-
- public DateTime SaveTime = DateTime.Parse("1982-11-23");
-
-
- public Boolean SetPinReverse(byte High, byte Low)
- {
- RaiseMessage(MessageType.Normal,
- string.Format("Pin Reverse H={0},L={1}", High, Low)
- );
-
- bool b1 = Sendcommand(eCommand.SET_EEPROM, (byte)eEEPAddress.EEP_DIREVH, High);
- bool b2 = Sendcommand(eCommand.SET_EEPROM, (byte)eEEPAddress.EEP_DIREVL, Low);
- return b1 && b2;
- }
- public Boolean SetMotorUpTime(byte value)
- {
- RaiseMessage(MessageType.Normal,
- string.Format("Motor Up Time Value={0}", value)
- );
-
- bool b1 = Sendcommand(eCommand.SET_EEPROM, (byte)eEEPAddress.EEP_UPTIME, value);
- return b1;
- }
-
- public Boolean SaveEEPROM()
- {
- RaiseMessage(MessageType.Normal,
- string.Format("Save EEPROM")
- );
-
- bool b1 = Sendcommand(eCommand.SAVE, 0);
- return b1;
- }
- public Boolean LoadEEPROM()
- {
- RaiseMessage(MessageType.Normal,
- string.Format("Load EEPROM")
- );
-
- bool b1 = Sendcommand(eCommand.LOAD, 0);
- return b1;
- }
-
- //public double ManualSpeed = 0.0;
- //public bool SetManualSpeed(double Percvalue)
- //{
- // var Speed = (byte)((Percvalue / 100.0) * 255.0);
- // ManualSpeed = Percvalue;
- // // datamanager.COMCONTROLLER.Speak($"{Percvalue} 퍼센트 설정");
- // RaiseMessage(MessageType.Normal,
- // string.Format("Convert Speed Hold {0}%->{1}", Percvalue, Speed),
- // false);
-
- // return Sendcommand(eCommand.SET_MANUALSPEED, Speed);
- //}
-
- public DateTime LastPingTime = DateTime.Parse("1982-11-23");
-
-
- public bool SendPing()
- {
- LastPingTime = DateTime.Now;
- return Sendcommand(eCommand.PINGCHK, 0, 0);
- }
-
-
-
-
-
- public bool ZMot(ZMotDirection dir)
- {
- if (dir == ZMotDirection.Up)
- return Sendcommand(eCommand.GUIDE_MOT, 'A', 'P'); //up
- else if (dir == ZMotDirection.Down)
- return Sendcommand(eCommand.GUIDE_MOT, 'A', 'N'); //down
- else if (dir == ZMotDirection.Stop)
- return Sendcommand(eCommand.GUIDE_MOT, 'A', 'S'); //stop
- else return false;
- }
- public bool ZMot_Left(ZMotDirection dir)
- {
- if (dir == ZMotDirection.Up)
- return Sendcommand(eCommand.GUIDE_MOT, 'L', 'P'); //up
- else if (dir == ZMotDirection.Down)
- return Sendcommand(eCommand.GUIDE_MOT, 'L', 'N'); //down
- else if (dir == ZMotDirection.Stop)
- return Sendcommand(eCommand.GUIDE_MOT, 'L', 'S'); //stop
- else return false;
-
- }
- public bool ZMot_Right(ZMotDirection dir)
- {
- if (dir == ZMotDirection.Up)
- return Sendcommand(eCommand.GUIDE_MOT, 'R', 'P'); //up
- else if (dir == ZMotDirection.Down)
- return Sendcommand(eCommand.GUIDE_MOT, 'R', 'N'); //down
- else if (dir == ZMotDirection.Stop)
- return Sendcommand(eCommand.GUIDE_MOT, 'R', 'S'); //stop
- else return false;
- }
-
- ///
- /// 오버로드 또는 L이 활성화되되면 True를 반환함
- ///
- ///
- public Boolean IsOverLoad()
- {
- if (GetValueI(DIName.PINI_OVERLOADL) || GetValueI(DIName.PINI_OVERLOADR)) return true;
- else return false;
- }
- public Boolean IsLimitUp()
- {
- if (GetValueI(DIName.PINI_LIMIT_LU) || GetValueI(DIName.PINI_LIMIT_RU)) return true;
- else return false;
- }
- public Boolean IsLimitDn()
- {
- if (GetValueI(DIName.PINI_LIMIT_LD) || GetValueI(DIName.PINI_LIMIT_RD)) return true;
- else return false;
- }
-
- }
-}
diff --git a/Cs_HMI/SubProject/ProPLC/PLC.Net45.csproj b/Cs_HMI/SubProject/ProPLC/PLC.Net45.csproj
deleted file mode 100644
index 8c8f3d9..0000000
--- a/Cs_HMI/SubProject/ProPLC/PLC.Net45.csproj
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {476C8E64-7B6B-4554-ACA2-04302715750F}
- Library
- Properties
- Device
- Device_PLC
- v4.8
- 512
- true
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {14e8c9a5-013e-49ba-b435-efefc77dd623}
- CommData
-
-
-
-
\ No newline at end of file
diff --git a/Cs_HMI/SubProject/ProPLC/Properties/AssemblyInfo.cs b/Cs_HMI/SubProject/ProPLC/Properties/AssemblyInfo.cs
deleted file mode 100644
index 64e7d13..0000000
--- a/Cs_HMI/SubProject/ProPLC/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
-// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
-// 이러한 특성 값을 변경하세요.
-[assembly: AssemblyTitle("Device_PLC")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Device_PLC")]
-[assembly: AssemblyCopyright("Copyright © 2022")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
-// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
-// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
-[assembly: ComVisible(false)]
-
-// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
-[assembly: Guid("476c8e64-7b6b-4554-aca2-04302715750f")]
-
-// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
-//
-// 주 버전
-// 부 버전
-// 빌드 번호
-// 수정 버전
-//
-// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
-// 기본값으로 할 수 있습니다.
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Cs_HMI/SubProject/arFrameControl/MenuBar/MenuControl.Designer.cs b/Cs_HMI/SubProject/arFrameControl/MenuBar/MenuControl.Designer.cs
deleted file mode 100644
index a535234..0000000
--- a/Cs_HMI/SubProject/arFrameControl/MenuBar/MenuControl.Designer.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-namespace arFrame.Control
-{
- partial class MenuControl
- {
- ///
- /// 필수 디자이너 변수입니다.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// 사용 중인 모든 리소스를 정리합니다.
- ///
- /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region 구성 요소 디자이너에서 생성한 코드
-
- ///
- /// 디자이너 지원에 필요한 메서드입니다.
- /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- }
-
- #endregion
- }
-}
diff --git a/Cs_HMI/SubProject/arFrameControl/MenuBar/MenuControl.cs b/Cs_HMI/SubProject/arFrameControl/MenuBar/MenuControl.cs
deleted file mode 100644
index c089624..0000000
--- a/Cs_HMI/SubProject/arFrameControl/MenuBar/MenuControl.cs
+++ /dev/null
@@ -1,676 +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.Windows.Forms;
-using System.Xml;
-
-namespace arFrame.Control
-{
-
- public partial class MenuControl : System.Windows.Forms.Control
- {
- private int bordersize = 0;
- private int menubordersize = 1;
- private int menuwidth = 100;
- private int menugap = 5;
- private System.Windows.Forms.Padding padding = new Padding(3, 3, 3, 3);
- private System.Drawing.Color backcolor = System.Drawing.Color.White;
- private System.Drawing.Color backcolor2 = System.Drawing.Color.Gainsboro;
- private System.Drawing.Color bordercolor = System.Drawing.Color.Black;
- private Boolean enablemenubakcolor = false;
- private Boolean enablemenuborder = false;
- private Boolean textattachtoimage = true;
-
- [Category("arFrame"), DisplayName("메뉴")]
- public MenuItem[] menus { get; set; }
-
- private Rectangle[] rects = null;
-
- [Category("arFrame"), DisplayName("테두리 굵기")]
- public int BorderSize { get { return bordersize; } set { this.bordersize = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("메뉴 테두리 굵기")]
- public int MenuBorderSize { get { return menubordersize; } set { this.menubordersize = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("메뉴 너비")]
- public int MenuWidth { get { return menuwidth; } set { this.menuwidth = value; RemakeChartRect(); Invalidate(); } }
- [Category("arFrame"), DisplayName("메뉴 간격")]
- public int MenuGap { get { return menugap; } set { this.menugap = value; RemakeChartRect(); Invalidate(); } }
- [Category("arFrame"), DisplayName("기능-메뉴별 배경색")]
- public Boolean EnableMenuBackColor { get { return enablemenubakcolor; } set { this.enablemenubakcolor = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("기능-메뉴별 테두리")]
- public Boolean EnableMenuBorder { get { return enablemenuborder; } set { this.enablemenuborder = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("글자를 이미지 다음에 표시"), Description("이미지가 있는 경우 해당 이미지 옆에 글자를 붙입니다")]
- public Boolean TextAttachToImage { get { return textattachtoimage; } set { this.textattachtoimage = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("이미지 표시 여백(좌,상)")]
- public System.Drawing.Point ImagePadding { get; set; }
- [Category("arFrame"), DisplayName("이미지 표시 크기(너비,높이)")]
- public System.Drawing.Size ImageSize { get; set; }
- [Category("arFrame"), DisplayName("색상-테두리")]
- public System.Drawing.Color BorderColor { get { return bordercolor; } set { this.bordercolor = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("내부 여백")]
- public new System.Windows.Forms.Padding Padding { get { return padding; } set { this.padding = value; RemakeChartRect(); Invalidate(); } }
- [Category("arFrame"), DisplayName("색상-배경1")]
- public override System.Drawing.Color BackColor { get { return backcolor; } set { this.backcolor = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("색상-배경2")]
- public System.Drawing.Color BackColor2 { get { return backcolor2; } set { this.backcolor2 = value; Invalidate(); } }
- [Category("arFrame"), DisplayName("색상-글자")]
- public override Color ForeColor { get { return base.ForeColor; } set { base.ForeColor = value; } }
-
- private int mouseOverItemIndex = -1;
- public MenuControl()
- {
- InitializeComponent();
-
- // Set Optimized Double Buffer to reduce flickering
- this.SetStyle(ControlStyles.UserPaint, true);
- this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
-
- // Redraw when resized
- this.SetStyle(ControlStyles.ResizeRedraw, true);
-
-
- ImagePadding = new System.Drawing.Point(0, 0);
- ImageSize = new System.Drawing.Size(24, 24);
-
-
- if (MinimumSize.Width == 0 || MinimumSize.Height == 0)
- MinimumSize = new Size(100, 50);
-
- }
- protected override void OnSizeChanged(EventArgs e)
- {
- base.OnSizeChanged(e);
- RemakeChartRect();
- }
-
-
- public event EventHandler ItemClick;
- public class MenuEventArgs : EventArgs
- {
- public string Command { get; set; }
- public int idx { get; set; }
- public MenuEventArgs(string cmd_, int idx_)
- {
- this.Command = cmd_;
- this.idx = idx_;
- }
- }
-
- protected override void OnMouseClick(MouseEventArgs e)
- {
- // if(DesignMode)
- // {
- // if(e.Button == System.Windows.Forms.MouseButtons.Right)
- // {
- // System.Windows.Forms.MessageBox.Show("Sdf");
-
- // }
- // }
- // else
- {
- //마우스클릭시 해당 버튼을 찾아서 반환한다.
- if (menus == null || menus.Length < 1) return;
- for (int i = 0; i < menus.Length; i++)
- {
- var rect = rects[i];
- if (rect.Contains(e.Location))
- {
- var menu = menus[i];
-
- //미사용개체는 이벤트를 아에 발생하지 않는다
- if (menu.Enable == true && ItemClick != null)
- ItemClick(this, new MenuEventArgs(menu.Command, i));
- break;
- }
- }
- }
-
- }
- protected override void OnMouseLeave(EventArgs e)
- {
- this.mouseOverItemIndex = -1;
- this.Invalidate();
- }
- protected override void OnMouseMove(MouseEventArgs e)
- {
- if (menus == null || menus.Length < 1)
- {
- this.mouseOverItemIndex = -1;
- return;
- }
- for (int i = 0; i < menus.Length; i++)
- {
- var rect = rects[i];
- if (rect.Contains(e.Location))
- {
- if (i != mouseOverItemIndex)
- {
- mouseOverItemIndex = i;
- this.Invalidate();
- }
-
- break;
- }
- }
- }
-
- protected override void OnPaint(PaintEventArgs pe)
- {
-
-
- // if(DesignMode)
- // {
- // pe.Graphics.FillRectangle(Brushes.Red, this.DisplayRectangle);
- // }
- //else
- {
- //배경그리기
- using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(DisplayRectangle, BackColor, BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
- pe.Graphics.FillRectangle(sb, DisplayRectangle);
- }
-
- //테두리 그리기
- if (BorderSize > 0)
- {
- pe.Graphics.DrawRectangle(new Pen(this.BorderColor, BorderSize),
- this.DisplayRectangle.Left,
- this.DisplayRectangle.Top,
- this.DisplayRectangle.Width - 1,
- this.DisplayRectangle.Height - 1);
- }
-
- //커서모양
- if (mouseOverItemIndex == -1) this.Cursor = Cursors.Arrow;
- else this.Cursor = Cursors.Hand;
-
- if (rects == null) RemakeChartRect();
- if (rects != null && rects.Length > 0)
- {
- StringFormat sf = new StringFormat(StringFormatFlags.NoClip);
- var items = menus.OrderBy(t => t.No);
- int i = 0;
- foreach (var menu in items)
- {
- var rect = rects[i];
-
- //배경이 투명이 아니라면 그린다.
- if (mouseOverItemIndex == i)
- {
- //마우스오버된놈이다.
- using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, Color.FromArgb(100, Color.LightSkyBlue), Color.FromArgb(100, Color.DeepSkyBlue), System.Drawing.Drawing2D.LinearGradientMode.Vertical))
- pe.Graphics.FillRectangle(sb, rect);
- }
- else
- {
- if (this.enablemenubakcolor == true && menu.BackColor != System.Drawing.Color.Transparent && menu.BackColor2 != System.Drawing.Color.Transparent)
- {
- using (var sb = new System.Drawing.Drawing2D.LinearGradientBrush(rect, menu.BackColor, menu.BackColor2, System.Drawing.Drawing2D.LinearGradientMode.Vertical))
- pe.Graphics.FillRectangle(sb, rect);
- }
-
- }
-
- //이미지표시
- int ix, iy, iw, ih;
- ix = iy = iw = ih = 0;
- if (menu.Image != null)
- {
- ix = rect.Left;
- iy = rect.Top;
- iw = ImageSize.Width;
- ih = ImageSize.Height;
-
- if (menu.ImageAlign == ContentAlignment.BottomCenter || menu.ImageAlign == ContentAlignment.BottomLeft ||
- menu.ImageAlign == ContentAlignment.BottomRight) iy += DisplayRectangle.Bottom - ih;
- else if (menu.ImageAlign == ContentAlignment.MiddleCenter || menu.ImageAlign == ContentAlignment.MiddleLeft ||
- menu.ImageAlign == ContentAlignment.MiddleRight) iy += (int)(DisplayRectangle.Top + ((rect.Height - ih) / 2.0));
- else if (menu.ImageAlign == ContentAlignment.TopCenter || menu.ImageAlign == ContentAlignment.TopLeft ||
- menu.ImageAlign == ContentAlignment.TopRight) iy += DisplayRectangle.Top;
-
- if (menu.ImageAlign == ContentAlignment.BottomCenter || menu.ImageAlign == ContentAlignment.MiddleCenter ||
- menu.ImageAlign == ContentAlignment.TopCenter) ix += (int)(DisplayRectangle.Left + ((rect.Width - iw) / 2.0));
- else if (menu.ImageAlign == ContentAlignment.BottomLeft || menu.ImageAlign == ContentAlignment.MiddleLeft ||
- menu.ImageAlign == ContentAlignment.TopLeft) ix += DisplayRectangle.Left;
- else if (menu.ImageAlign == ContentAlignment.BottomRight || menu.ImageAlign == ContentAlignment.MiddleRight ||
- menu.ImageAlign == ContentAlignment.TopRight) ix += DisplayRectangle.Right - iw;
-
- if (menu.ImagePadding.X != 0 || menu.ImagePadding.Y != 0)
- {
- ix += menu.ImagePadding.X;
- iy += menu.ImagePadding.Y;
- }
- else
- {
- ix += ImagePadding.X;
- iy += ImagePadding.Y;
- }
- if (menu.ImageSize.Width != 0 && menu.ImageSize.Height != 0)
- {
- iw = menu.ImageSize.Width;
- ih = menu.ImageSize.Height;
- }
-
- pe.Graphics.DrawImage(menu.Image,
- new Rectangle(ix, iy, iw, ih));
- }
-
- //테두리를 그리는 속성과 트기가 설정된 경우에만 표시
- if (mouseOverItemIndex == i)
- {
- pe.Graphics.DrawRectangle(new Pen(Color.DeepSkyBlue), rect);
- }
- else
- {
- if (EnableMenuBorder && MenuBorderSize > 0)
- {
- using (var p = new Pen(menu.BorderColor, MenuBorderSize))
- pe.Graphics.DrawRectangle(p, rect);
- }
- }
-
-
- //글자를 텍스트 이후에 붙이는 거라면?
- if (menu.Image != null && TextAttachToImage)
- {
- var fsize = pe.Graphics.MeasureString(menu.Text, this.Font);
- pe.Graphics.DrawString(menu.Text, this.Font, new SolidBrush(menu.ForeColor),
- (float)(ix + iw + 1),
- (float)(iy + ((ih - fsize.Height) / 2.0)));
- }
- else
- {
- if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.BottomLeft ||
- menu.TextAlign == ContentAlignment.BottomRight) sf.LineAlignment = StringAlignment.Far;
- else if (menu.TextAlign == ContentAlignment.MiddleCenter || menu.TextAlign == ContentAlignment.MiddleLeft ||
- menu.TextAlign == ContentAlignment.MiddleRight) sf.LineAlignment = StringAlignment.Center;
- else if (menu.TextAlign == ContentAlignment.TopCenter || menu.TextAlign == ContentAlignment.TopLeft ||
- menu.TextAlign == ContentAlignment.TopRight) sf.LineAlignment = StringAlignment.Near;
-
- if (menu.TextAlign == ContentAlignment.BottomCenter || menu.TextAlign == ContentAlignment.MiddleCenter ||
- menu.TextAlign == ContentAlignment.TopCenter) sf.Alignment = StringAlignment.Center;
- else if (menu.TextAlign == ContentAlignment.BottomLeft || menu.TextAlign == ContentAlignment.MiddleLeft ||
- menu.TextAlign == ContentAlignment.TopLeft) sf.Alignment = StringAlignment.Near;
- else if (menu.TextAlign == ContentAlignment.BottomRight || menu.TextAlign == ContentAlignment.MiddleRight ||
- menu.TextAlign == ContentAlignment.TopRight) sf.Alignment = StringAlignment.Far;
-
- pe.Graphics.DrawString(menu.Text, this.Font, new SolidBrush(menu.ForeColor), rect, sf);
- }
- i += 1;
- }
- sf.Dispose();
- }
- //if(DesignMode)
- //{
- // pe.Graphics.DrawString("deisgn", this.Font, Brushes.Red, 1, 1);
- //}
- }
-
- ///
- /// arFrame 전용 속성값을 복사 합니다
- ///
- ///
- public void copyTo(MenuControl ctl)
- {
- ctl.backcolor = this.backcolor;
- ctl.backcolor2 = this.BackColor2;
- ctl.MenuWidth = this.menuwidth;
- ctl.menugap = this.menugap;
- ctl.menus = this.menus;
- ctl.menubordersize = this.menubordersize;
- ctl.padding = this.padding;
- ctl.ForeColor = this.ForeColor;
- ctl.Font = this.Font;
- ctl.EnableMenuBackColor = this.EnableMenuBackColor;
- ctl.EnableMenuBorder = this.EnableMenuBorder;
- ctl.ImagePadding = this.ImagePadding;
- ctl.ImageSize = this.ImageSize;
- ctl.TextAttachToImage = this.TextAttachToImage;
- ctl.bordercolor = this.bordercolor;
- ctl.bordersize = this.bordersize;
- }
-
- public void Save(string File)
- {
- //xml로 데이터를 저장자
- System.Text.StringBuilder NewXml = new System.Text.StringBuilder();
- NewXml.AppendLine("");
- NewXml.AppendLine(" ");
- NewXml.AppendLine("");
-
- if (System.IO.File.Exists(File)) System.IO.File.Delete(File);
- System.IO.File.WriteAllText(File, NewXml.ToString().Replace('\'', '\"'), System.Text.Encoding.UTF8);
- var vDocu = new XmlDocument();
- vDocu.Load(File);
- //var nsmgr = new XmlNamespaceManager(new System.Xml.NameTable());
- //nsmgr.AddNamespace("x", "http://tindevil.com");
- var Root = vDocu.DocumentElement;
-
- //저장하려는 속성목록을 먼저 생성한다
- //미사용 목록이 너무 많아서 그렇게 함
- foreach (var m in this.GetType().GetMethods())
- {
- var mName = m.Name.ToLower();
- if (mName.StartsWith("get_") == false || mName == "get_menus") continue;
-
- var pt = this.GetType().GetProperty(m.Name.Substring(4));
- if (pt != null)
- {
- var categoryName = GetCategoryName(pt);
- if (categoryName.ToLower() != "arframe") continue;
-
- //자료형에따라서 그값을 변경한다
- var value = m.Invoke(this, null);
- var newNode = vDocu.CreateElement(pt.Name);// m.Name.Substring(4));
- newNode.InnerText = getValueString(m, value);
- Root.AppendChild(newNode);
- }
- }
-
-
- foreach (var item in this.menus.OrderBy(t => t.No))
- {
- var node = vDocu.CreateElement("Item");
- var attNo = vDocu.CreateAttribute("No");
- attNo.Value = item.No.ToString();
- node.Attributes.Append(attNo);
-
- foreach (var m in item.GetType().GetMethods())
- {
- var mName = m.Name.ToLower();
- if (mName.StartsWith("get_") == false || mName == "get_no") continue;
-
- var value = m.Invoke(item, null);
- var sNode = vDocu.CreateElement(m.Name.Substring(4));
- sNode.InnerText = getValueString(m, value);
- node.AppendChild(sNode);
- }
- Root.AppendChild(node);
- }
- vDocu.Save(File);
- }
-
- public void Load(string File)
- {
- if (System.IO.File.Exists(File) == false) return;
-
- List