├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── VISAInstrument.sln └── VISAInstrument ├── Configuration └── VisaInformation.cs ├── FrmMain.Designer.cs ├── FrmMain.cs ├── FrmMain.resx ├── Ports ├── GpibPortOperator.cs ├── IPortOperator.cs ├── IPortType.cs ├── LanPortOperator.cs ├── PortEventArgs.cs ├── PortOperatorBase.cs ├── SerialDataReceivedEventArgs.cs ├── UsbPortOperator.cs └── VISAInstrument.Port.cs ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── Utility ├── Extension │ ├── ByteEx.cs │ ├── RegexEx.cs │ ├── StringEx.cs │ └── UI │ │ ├── ComboBoxEx.cs │ │ ├── Pair.cs │ │ ├── Pair2.cs │ │ ├── PairCollection.cs │ │ └── TextBoxEx.cs ├── PortHelper.cs ├── PortType.cs ├── UninstallInfo.cs ├── UninstallInfoHelper.cs └── UninstallInfoOption.cs ├── VISAInstrument.csproj └── logo.ico /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VISAInstrument 2 | 基于NI-VISA的仪器编程,支持RS232、USB、GPIB及LAN 3 | 4 | ## 条件 5 | 运行或开发软件时,必须安装NI-VISA运行时(其他VISA版本不支持,如Keysight VISA等)。 6 | ### Release版本 7 | 运行条件: 8 | 若需运行在Win7及以上系统(最高支持Win11系统),请安装15.5版本或以上的运行时,下载链接如下: 9 | https://download.ni.com/support/softlib/visa/NI-VISA/15.5/Windows/NIVISA1550runtime.zip 10 | 11 | 若需运行在Win7及以上系统(最高支持Win11系统),请安装16.0~21.5版本的运行时,18.5版本的下载链接如下: 12 | https://download.ni.com/support/softlib/visa/NI-VISA/18.5/Windows/NIVISA1850runtime.zip 13 | 14 | ### 开发版本 15 | 为了最佳的开发效果,开发时请使用本软件的对应的开发版本(21.0.0)[目前最新版本为21.5],下载链接如下: 16 | https://download.ni.com/support/nipkg/products/ni-v/ni-visa/21.0/offline/ni-visa_21.0.0_offline.iso 17 | 18 | ## RS232 19 | 支持常见的RS232串口编程,一般地址为“ASRL1::INSTR” 20 | 21 | ## USB 22 | 支持常见的USB接口编程,一般地址类似为“USB0::0x2A8D::0x0101::MY57501899::INSTR” 23 | 24 | ## GPIB 25 | 支持常见的USB接口编程,一般地址类似为“GPIB0::0x2A8D::0x0101::MY57501899::INSTR” 26 | 此处要求安装GPIB卡驱动程序,推荐使用NI-GPIB卡(需要驱动程序,驱动程序可以从NI官方网站下载) 27 | 28 | ## LAN 29 | 支持常见的LAN接口编程,一般地址类似为“TCPIP0::34465A-01899::inst0::INSTR”或“TCPIP0::192.168.0.26::INSTR” 30 | 31 | ## 运行界面 32 | ![image](https://github.com/cnxy/VISAInstrument/blob/master/VISAInstrument/pic.png) 33 | -------------------------------------------------------------------------------- /VISAInstrument.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2008 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VISAInstrument", "VISAInstrument\VISAInstrument.csproj", "{7FA82266-0999-4572-AD46-AA79ED2E9CAC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7FA82266-0999-4572-AD46-AA79ED2E9CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7FA82266-0999-4572-AD46-AA79ED2E9CAC}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7FA82266-0999-4572-AD46-AA79ED2E9CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7FA82266-0999-4572-AD46-AA79ED2E9CAC}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {2FFCA02A-00FB-4DFB-B270-ABB05E9DEE74} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /VISAInstrument/Configuration/VisaInformation.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Configuration 2 | { 3 | internal class VisaInformation 4 | { 5 | public static string[] VisaSharedComponent { get; set; } 6 | public static string[] NiVisaRuntime { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /VISAInstrument/FrmMain.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument 2 | { 3 | partial class FrmMain 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows 窗体设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要修改 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); 33 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 34 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 35 | this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); 36 | this.btnWrite = new System.Windows.Forms.Button(); 37 | this.btnRead = new System.Windows.Forms.Button(); 38 | this.btnQuery = new System.Windows.Forms.Button(); 39 | this.btnCycle = new System.Windows.Forms.Button(); 40 | this.txtCommand = new System.Windows.Forms.TextBox(); 41 | this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel(); 42 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 43 | this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); 44 | this.rdoAscii = new System.Windows.Forms.RadioButton(); 45 | this.rdoByte = new System.Windows.Forms.RadioButton(); 46 | this.label1 = new System.Windows.Forms.Label(); 47 | this.chkAppendNewLine = new System.Windows.Forms.CheckBox(); 48 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 49 | this.flowLayoutPanel8 = new System.Windows.Forms.FlowLayoutPanel(); 50 | this.rdoUntilNewLine = new System.Windows.Forms.RadioButton(); 51 | this.rdoSpecifiedCount = new System.Windows.Forms.RadioButton(); 52 | this.nudSpecifiedCount = new System.Windows.Forms.NumericUpDown(); 53 | this.chkRealTimeReceive = new System.Windows.Forms.CheckBox(); 54 | this.groupBox3 = new System.Windows.Forms.GroupBox(); 55 | this.flowLayoutPanel9 = new System.Windows.Forms.FlowLayoutPanel(); 56 | this.chkStartCycle = new System.Windows.Forms.CheckBox(); 57 | this.flowLayoutPanel10 = new System.Windows.Forms.FlowLayoutPanel(); 58 | this.rdoSend = new System.Windows.Forms.RadioButton(); 59 | this.rdoSendRead = new System.Windows.Forms.RadioButton(); 60 | this.label2 = new System.Windows.Forms.Label(); 61 | this.nudCycleCount = new System.Windows.Forms.NumericUpDown(); 62 | this.label3 = new System.Windows.Forms.Label(); 63 | this.nudInterval = new System.Windows.Forms.NumericUpDown(); 64 | this.label4 = new System.Windows.Forms.Label(); 65 | this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); 66 | this.rbtRS232 = new System.Windows.Forms.RadioButton(); 67 | this.cboRS232 = new System.Windows.Forms.ComboBox(); 68 | this.rbtUSB = new System.Windows.Forms.RadioButton(); 69 | this.cboUSB = new System.Windows.Forms.ComboBox(); 70 | this.rbtGPIB = new System.Windows.Forms.RadioButton(); 71 | this.cboGPIB = new System.Windows.Forms.ComboBox(); 72 | this.rbtLAN = new System.Windows.Forms.RadioButton(); 73 | this.cboLAN = new System.Windows.Forms.ComboBox(); 74 | this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); 75 | this.lblBaudRate = new System.Windows.Forms.Label(); 76 | this.cboBaudRate = new System.Windows.Forms.ComboBox(); 77 | this.lblParity = new System.Windows.Forms.Label(); 78 | this.cboParity = new System.Windows.Forms.ComboBox(); 79 | this.lblStopBits = new System.Windows.Forms.Label(); 80 | this.cboStopBits = new System.Windows.Forms.ComboBox(); 81 | this.lblDataBits = new System.Windows.Forms.Label(); 82 | this.cboDataBits = new System.Windows.Forms.ComboBox(); 83 | this.lblFlowControl = new System.Windows.Forms.Label(); 84 | this.cboFlowControl = new System.Windows.Forms.ComboBox(); 85 | this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); 86 | this.btnRefresh = new System.Windows.Forms.Button(); 87 | this.btnOpen = new System.Windows.Forms.Button(); 88 | this.groupBoxDisplay = new System.Windows.Forms.GroupBox(); 89 | this.txtDisplay = new System.Windows.Forms.TextBox(); 90 | this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 91 | this.清除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 92 | this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); 93 | this.全选ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 94 | this.复制ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 95 | this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); 96 | this.lblIP = new System.Windows.Forms.Label(); 97 | this.txtIPAddress = new System.Windows.Forms.TextBox(); 98 | this.btnCheckIP = new System.Windows.Forms.Button(); 99 | this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 100 | this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 101 | this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); 102 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 103 | this.githubToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 104 | this.blogToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 105 | this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); 106 | this.byCNXYToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 107 | this.时间ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 108 | this.flowLayoutPanel11 = new System.Windows.Forms.FlowLayoutPanel(); 109 | this.lblOverTime = new System.Windows.Forms.Label(); 110 | this.nudTimeout = new System.Windows.Forms.NumericUpDown(); 111 | this.lblTimeout = new System.Windows.Forms.Label(); 112 | this.cmsCommand = new System.Windows.Forms.ContextMenuStrip(this.components); 113 | this.全选ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 114 | this.复制ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 115 | this.粘贴ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 116 | this.tableLayoutPanel.SuspendLayout(); 117 | this.tableLayoutPanel1.SuspendLayout(); 118 | this.flowLayoutPanel6.SuspendLayout(); 119 | this.flowLayoutPanel7.SuspendLayout(); 120 | this.groupBox1.SuspendLayout(); 121 | this.flowLayoutPanel3.SuspendLayout(); 122 | this.groupBox2.SuspendLayout(); 123 | this.flowLayoutPanel8.SuspendLayout(); 124 | ((System.ComponentModel.ISupportInitialize)(this.nudSpecifiedCount)).BeginInit(); 125 | this.groupBox3.SuspendLayout(); 126 | this.flowLayoutPanel9.SuspendLayout(); 127 | this.flowLayoutPanel10.SuspendLayout(); 128 | ((System.ComponentModel.ISupportInitialize)(this.nudCycleCount)).BeginInit(); 129 | ((System.ComponentModel.ISupportInitialize)(this.nudInterval)).BeginInit(); 130 | this.flowLayoutPanel1.SuspendLayout(); 131 | this.flowLayoutPanel2.SuspendLayout(); 132 | this.flowLayoutPanel4.SuspendLayout(); 133 | this.groupBoxDisplay.SuspendLayout(); 134 | this.contextMenuStrip.SuspendLayout(); 135 | this.flowLayoutPanel5.SuspendLayout(); 136 | this.menuStrip1.SuspendLayout(); 137 | this.flowLayoutPanel11.SuspendLayout(); 138 | ((System.ComponentModel.ISupportInitialize)(this.nudTimeout)).BeginInit(); 139 | this.cmsCommand.SuspendLayout(); 140 | this.SuspendLayout(); 141 | // 142 | // tableLayoutPanel 143 | // 144 | this.tableLayoutPanel.ColumnCount = 2; 145 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 675F)); 146 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 105F)); 147 | this.tableLayoutPanel.Controls.Add(this.tableLayoutPanel1, 0, 5); 148 | this.tableLayoutPanel.Controls.Add(this.flowLayoutPanel1, 0, 1); 149 | this.tableLayoutPanel.Controls.Add(this.flowLayoutPanel2, 0, 2); 150 | this.tableLayoutPanel.Controls.Add(this.flowLayoutPanel4, 1, 1); 151 | this.tableLayoutPanel.Controls.Add(this.groupBoxDisplay, 0, 6); 152 | this.tableLayoutPanel.Controls.Add(this.flowLayoutPanel5, 0, 3); 153 | this.tableLayoutPanel.Controls.Add(this.menuStrip1, 0, 7); 154 | this.tableLayoutPanel.Controls.Add(this.flowLayoutPanel11, 0, 4); 155 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 156 | this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0); 157 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 158 | this.tableLayoutPanel.RowCount = 8; 159 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); 160 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); 161 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F)); 162 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F)); 163 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 37F)); 164 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 202F)); 165 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 166 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); 167 | this.tableLayoutPanel.Size = new System.Drawing.Size(780, 626); 168 | this.tableLayoutPanel.TabIndex = 0; 169 | // 170 | // tableLayoutPanel1 171 | // 172 | this.tableLayoutPanel1.ColumnCount = 2; 173 | this.tableLayoutPanel.SetColumnSpan(this.tableLayoutPanel1, 2); 174 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75.5814F)); 175 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 24.4186F)); 176 | this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel6, 1, 1); 177 | this.tableLayoutPanel1.Controls.Add(this.txtCommand, 0, 1); 178 | this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel7, 0, 0); 179 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 180 | this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 180); 181 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 182 | this.tableLayoutPanel1.RowCount = 2; 183 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 116F)); 184 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 185 | this.tableLayoutPanel1.Size = new System.Drawing.Size(774, 196); 186 | this.tableLayoutPanel1.TabIndex = 9; 187 | // 188 | // flowLayoutPanel6 189 | // 190 | this.flowLayoutPanel6.Controls.Add(this.btnWrite); 191 | this.flowLayoutPanel6.Controls.Add(this.btnRead); 192 | this.flowLayoutPanel6.Controls.Add(this.btnQuery); 193 | this.flowLayoutPanel6.Controls.Add(this.btnCycle); 194 | this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill; 195 | this.flowLayoutPanel6.Location = new System.Drawing.Point(588, 119); 196 | this.flowLayoutPanel6.Name = "flowLayoutPanel6"; 197 | this.flowLayoutPanel6.Size = new System.Drawing.Size(183, 74); 198 | this.flowLayoutPanel6.TabIndex = 9; 199 | // 200 | // btnWrite 201 | // 202 | this.btnWrite.Anchor = System.Windows.Forms.AnchorStyles.Left; 203 | this.btnWrite.Location = new System.Drawing.Point(3, 3); 204 | this.btnWrite.Name = "btnWrite"; 205 | this.btnWrite.Size = new System.Drawing.Size(53, 23); 206 | this.btnWrite.TabIndex = 2; 207 | this.btnWrite.Text = "发送"; 208 | this.btnWrite.UseVisualStyleBackColor = true; 209 | this.btnWrite.Click += new System.EventHandler(this.btnWrite_Click); 210 | // 211 | // btnRead 212 | // 213 | this.btnRead.Anchor = System.Windows.Forms.AnchorStyles.Left; 214 | this.btnRead.Location = new System.Drawing.Point(62, 3); 215 | this.btnRead.Name = "btnRead"; 216 | this.btnRead.Size = new System.Drawing.Size(53, 23); 217 | this.btnRead.TabIndex = 3; 218 | this.btnRead.Text = "读取"; 219 | this.btnRead.UseVisualStyleBackColor = true; 220 | this.btnRead.Click += new System.EventHandler(this.btnRead_Click); 221 | // 222 | // btnQuery 223 | // 224 | this.btnQuery.Anchor = System.Windows.Forms.AnchorStyles.Left; 225 | this.btnQuery.Location = new System.Drawing.Point(121, 3); 226 | this.btnQuery.Name = "btnQuery"; 227 | this.btnQuery.Size = new System.Drawing.Size(53, 23); 228 | this.btnQuery.TabIndex = 4; 229 | this.btnQuery.Text = "询问"; 230 | this.btnQuery.UseVisualStyleBackColor = true; 231 | this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click); 232 | // 233 | // btnCycle 234 | // 235 | this.btnCycle.Anchor = System.Windows.Forms.AnchorStyles.Left; 236 | this.btnCycle.Enabled = false; 237 | this.btnCycle.Location = new System.Drawing.Point(3, 32); 238 | this.btnCycle.Name = "btnCycle"; 239 | this.btnCycle.Size = new System.Drawing.Size(174, 23); 240 | this.btnCycle.TabIndex = 5; 241 | this.btnCycle.Text = "循环发送"; 242 | this.btnCycle.UseVisualStyleBackColor = true; 243 | this.btnCycle.Click += new System.EventHandler(this.btnCycle_Click); 244 | // 245 | // txtCommand 246 | // 247 | this.txtCommand.Dock = System.Windows.Forms.DockStyle.Fill; 248 | this.txtCommand.ImeMode = System.Windows.Forms.ImeMode.Disable; 249 | this.txtCommand.Location = new System.Drawing.Point(3, 119); 250 | this.txtCommand.Multiline = true; 251 | this.txtCommand.Name = "txtCommand"; 252 | this.txtCommand.ScrollBars = System.Windows.Forms.ScrollBars.Both; 253 | this.txtCommand.Size = new System.Drawing.Size(579, 74); 254 | this.txtCommand.TabIndex = 8; 255 | // 256 | // flowLayoutPanel7 257 | // 258 | this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel7, 2); 259 | this.flowLayoutPanel7.Controls.Add(this.groupBox1); 260 | this.flowLayoutPanel7.Controls.Add(this.groupBox2); 261 | this.flowLayoutPanel7.Controls.Add(this.groupBox3); 262 | this.flowLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill; 263 | this.flowLayoutPanel7.Location = new System.Drawing.Point(3, 3); 264 | this.flowLayoutPanel7.Name = "flowLayoutPanel7"; 265 | this.flowLayoutPanel7.Size = new System.Drawing.Size(768, 110); 266 | this.flowLayoutPanel7.TabIndex = 10; 267 | // 268 | // groupBox1 269 | // 270 | this.groupBox1.Controls.Add(this.flowLayoutPanel3); 271 | this.groupBox1.Location = new System.Drawing.Point(3, 3); 272 | this.groupBox1.Name = "groupBox1"; 273 | this.groupBox1.Size = new System.Drawing.Size(235, 50); 274 | this.groupBox1.TabIndex = 8; 275 | this.groupBox1.TabStop = false; 276 | this.groupBox1.Text = "发送"; 277 | // 278 | // flowLayoutPanel3 279 | // 280 | this.flowLayoutPanel3.Controls.Add(this.rdoAscii); 281 | this.flowLayoutPanel3.Controls.Add(this.rdoByte); 282 | this.flowLayoutPanel3.Controls.Add(this.label1); 283 | this.flowLayoutPanel3.Controls.Add(this.chkAppendNewLine); 284 | this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; 285 | this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 17); 286 | this.flowLayoutPanel3.Name = "flowLayoutPanel3"; 287 | this.flowLayoutPanel3.Size = new System.Drawing.Size(229, 30); 288 | this.flowLayoutPanel3.TabIndex = 0; 289 | // 290 | // rdoAscii 291 | // 292 | this.rdoAscii.Anchor = System.Windows.Forms.AnchorStyles.None; 293 | this.rdoAscii.AutoSize = true; 294 | this.rdoAscii.Checked = true; 295 | this.rdoAscii.Location = new System.Drawing.Point(3, 3); 296 | this.rdoAscii.Name = "rdoAscii"; 297 | this.rdoAscii.Size = new System.Drawing.Size(53, 16); 298 | this.rdoAscii.TabIndex = 0; 299 | this.rdoAscii.TabStop = true; 300 | this.rdoAscii.Text = "ASCII"; 301 | this.rdoAscii.UseVisualStyleBackColor = true; 302 | this.rdoAscii.CheckedChanged += new System.EventHandler(this.rdoAsciiByte_CheckedChanged); 303 | // 304 | // rdoByte 305 | // 306 | this.rdoByte.Anchor = System.Windows.Forms.AnchorStyles.None; 307 | this.rdoByte.AutoSize = true; 308 | this.rdoByte.Location = new System.Drawing.Point(62, 3); 309 | this.rdoByte.Name = "rdoByte"; 310 | this.rdoByte.Size = new System.Drawing.Size(41, 16); 311 | this.rdoByte.TabIndex = 1; 312 | this.rdoByte.Text = "HEX"; 313 | this.rdoByte.UseVisualStyleBackColor = true; 314 | this.rdoByte.CheckedChanged += new System.EventHandler(this.rdoAsciiByte_CheckedChanged); 315 | // 316 | // label1 317 | // 318 | this.label1.Anchor = System.Windows.Forms.AnchorStyles.None; 319 | this.label1.AutoSize = true; 320 | this.label1.Location = new System.Drawing.Point(109, 5); 321 | this.label1.Name = "label1"; 322 | this.label1.Size = new System.Drawing.Size(11, 12); 323 | this.label1.TabIndex = 2; 324 | this.label1.Text = "|"; 325 | // 326 | // chkAppendNewLine 327 | // 328 | this.chkAppendNewLine.Anchor = System.Windows.Forms.AnchorStyles.None; 329 | this.chkAppendNewLine.AutoSize = true; 330 | this.chkAppendNewLine.Checked = true; 331 | this.chkAppendNewLine.CheckState = System.Windows.Forms.CheckState.Checked; 332 | this.chkAppendNewLine.Location = new System.Drawing.Point(126, 3); 333 | this.chkAppendNewLine.Name = "chkAppendNewLine"; 334 | this.chkAppendNewLine.Size = new System.Drawing.Size(84, 16); 335 | this.chkAppendNewLine.TabIndex = 3; 336 | this.chkAppendNewLine.Text = "添加换行符"; 337 | this.chkAppendNewLine.UseVisualStyleBackColor = true; 338 | // 339 | // groupBox2 340 | // 341 | this.groupBox2.Controls.Add(this.flowLayoutPanel8); 342 | this.groupBox2.Location = new System.Drawing.Point(244, 3); 343 | this.groupBox2.Name = "groupBox2"; 344 | this.groupBox2.Size = new System.Drawing.Size(502, 50); 345 | this.groupBox2.TabIndex = 9; 346 | this.groupBox2.TabStop = false; 347 | this.groupBox2.Text = "接收"; 348 | // 349 | // flowLayoutPanel8 350 | // 351 | this.flowLayoutPanel8.Controls.Add(this.rdoUntilNewLine); 352 | this.flowLayoutPanel8.Controls.Add(this.rdoSpecifiedCount); 353 | this.flowLayoutPanel8.Controls.Add(this.nudSpecifiedCount); 354 | this.flowLayoutPanel8.Controls.Add(this.chkRealTimeReceive); 355 | this.flowLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill; 356 | this.flowLayoutPanel8.Location = new System.Drawing.Point(3, 17); 357 | this.flowLayoutPanel8.Name = "flowLayoutPanel8"; 358 | this.flowLayoutPanel8.Size = new System.Drawing.Size(496, 30); 359 | this.flowLayoutPanel8.TabIndex = 0; 360 | // 361 | // rdoUntilNewLine 362 | // 363 | this.rdoUntilNewLine.Anchor = System.Windows.Forms.AnchorStyles.None; 364 | this.rdoUntilNewLine.AutoSize = true; 365 | this.rdoUntilNewLine.Checked = true; 366 | this.rdoUntilNewLine.Location = new System.Drawing.Point(3, 5); 367 | this.rdoUntilNewLine.Name = "rdoUntilNewLine"; 368 | this.rdoUntilNewLine.Size = new System.Drawing.Size(131, 16); 369 | this.rdoUntilNewLine.TabIndex = 1; 370 | this.rdoUntilNewLine.TabStop = true; 371 | this.rdoUntilNewLine.Text = "读取直到收到换行符"; 372 | this.rdoUntilNewLine.UseVisualStyleBackColor = true; 373 | this.rdoUntilNewLine.CheckedChanged += new System.EventHandler(this.rdoUntilNewLineSpecifiedCount_CheckedChanged); 374 | // 375 | // rdoSpecifiedCount 376 | // 377 | this.rdoSpecifiedCount.Anchor = System.Windows.Forms.AnchorStyles.None; 378 | this.rdoSpecifiedCount.AutoSize = true; 379 | this.rdoSpecifiedCount.Location = new System.Drawing.Point(140, 5); 380 | this.rdoSpecifiedCount.Name = "rdoSpecifiedCount"; 381 | this.rdoSpecifiedCount.Size = new System.Drawing.Size(119, 16); 382 | this.rdoSpecifiedCount.TabIndex = 2; 383 | this.rdoSpecifiedCount.Text = "读取指定字节数量"; 384 | this.rdoSpecifiedCount.UseVisualStyleBackColor = true; 385 | this.rdoSpecifiedCount.CheckedChanged += new System.EventHandler(this.rdoUntilNewLineSpecifiedCount_CheckedChanged); 386 | // 387 | // nudSpecifiedCount 388 | // 389 | this.nudSpecifiedCount.Enabled = false; 390 | this.nudSpecifiedCount.Location = new System.Drawing.Point(265, 3); 391 | this.nudSpecifiedCount.Maximum = new decimal(new int[] { 392 | 10000, 393 | 0, 394 | 0, 395 | 0}); 396 | this.nudSpecifiedCount.Minimum = new decimal(new int[] { 397 | 1, 398 | 0, 399 | 0, 400 | 0}); 401 | this.nudSpecifiedCount.Name = "nudSpecifiedCount"; 402 | this.nudSpecifiedCount.Size = new System.Drawing.Size(69, 21); 403 | this.nudSpecifiedCount.TabIndex = 3; 404 | this.nudSpecifiedCount.Value = new decimal(new int[] { 405 | 10, 406 | 0, 407 | 0, 408 | 0}); 409 | // 410 | // chkRealTimeReceive 411 | // 412 | this.chkRealTimeReceive.Anchor = System.Windows.Forms.AnchorStyles.None; 413 | this.chkRealTimeReceive.AutoSize = true; 414 | this.chkRealTimeReceive.Location = new System.Drawing.Point(339, 5); 415 | this.chkRealTimeReceive.Margin = new System.Windows.Forms.Padding(2); 416 | this.chkRealTimeReceive.Name = "chkRealTimeReceive"; 417 | this.chkRealTimeReceive.Padding = new System.Windows.Forms.Padding(20, 0, 0, 0); 418 | this.chkRealTimeReceive.Size = new System.Drawing.Size(92, 16); 419 | this.chkRealTimeReceive.TabIndex = 10; 420 | this.chkRealTimeReceive.Text = "实时接收"; 421 | this.chkRealTimeReceive.UseVisualStyleBackColor = true; 422 | this.chkRealTimeReceive.CheckedChanged += new System.EventHandler(this.chkRealTimeReceive_CheckedChanged); 423 | // 424 | // groupBox3 425 | // 426 | this.groupBox3.Controls.Add(this.flowLayoutPanel9); 427 | this.groupBox3.Location = new System.Drawing.Point(3, 59); 428 | this.groupBox3.Name = "groupBox3"; 429 | this.groupBox3.Size = new System.Drawing.Size(743, 50); 430 | this.groupBox3.TabIndex = 9; 431 | this.groupBox3.TabStop = false; 432 | this.groupBox3.Text = "循环"; 433 | // 434 | // flowLayoutPanel9 435 | // 436 | this.flowLayoutPanel9.Controls.Add(this.chkStartCycle); 437 | this.flowLayoutPanel9.Controls.Add(this.flowLayoutPanel10); 438 | this.flowLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill; 439 | this.flowLayoutPanel9.Location = new System.Drawing.Point(3, 17); 440 | this.flowLayoutPanel9.Name = "flowLayoutPanel9"; 441 | this.flowLayoutPanel9.Size = new System.Drawing.Size(737, 30); 442 | this.flowLayoutPanel9.TabIndex = 0; 443 | // 444 | // chkStartCycle 445 | // 446 | this.chkStartCycle.Anchor = System.Windows.Forms.AnchorStyles.None; 447 | this.chkStartCycle.AutoSize = true; 448 | this.chkStartCycle.Location = new System.Drawing.Point(3, 7); 449 | this.chkStartCycle.Name = "chkStartCycle"; 450 | this.chkStartCycle.Size = new System.Drawing.Size(96, 16); 451 | this.chkStartCycle.TabIndex = 4; 452 | this.chkStartCycle.Text = "开启循环功能"; 453 | this.chkStartCycle.UseVisualStyleBackColor = true; 454 | this.chkStartCycle.CheckedChanged += new System.EventHandler(this.chkStartCycle_CheckedChanged); 455 | // 456 | // flowLayoutPanel10 457 | // 458 | this.flowLayoutPanel10.Controls.Add(this.rdoSend); 459 | this.flowLayoutPanel10.Controls.Add(this.rdoSendRead); 460 | this.flowLayoutPanel10.Controls.Add(this.label2); 461 | this.flowLayoutPanel10.Controls.Add(this.nudCycleCount); 462 | this.flowLayoutPanel10.Controls.Add(this.label3); 463 | this.flowLayoutPanel10.Controls.Add(this.nudInterval); 464 | this.flowLayoutPanel10.Controls.Add(this.label4); 465 | this.flowLayoutPanel10.Enabled = false; 466 | this.flowLayoutPanel10.Location = new System.Drawing.Point(104, 2); 467 | this.flowLayoutPanel10.Margin = new System.Windows.Forms.Padding(2); 468 | this.flowLayoutPanel10.Name = "flowLayoutPanel10"; 469 | this.flowLayoutPanel10.Size = new System.Drawing.Size(471, 27); 470 | this.flowLayoutPanel10.TabIndex = 5; 471 | // 472 | // rdoSend 473 | // 474 | this.rdoSend.Anchor = System.Windows.Forms.AnchorStyles.None; 475 | this.rdoSend.AutoSize = true; 476 | this.rdoSend.Checked = true; 477 | this.rdoSend.Location = new System.Drawing.Point(3, 4); 478 | this.rdoSend.Name = "rdoSend"; 479 | this.rdoSend.Size = new System.Drawing.Size(71, 16); 480 | this.rdoSend.TabIndex = 0; 481 | this.rdoSend.TabStop = true; 482 | this.rdoSend.Text = "循环发送"; 483 | this.rdoSend.UseVisualStyleBackColor = true; 484 | this.rdoSend.CheckedChanged += new System.EventHandler(this.rdoSend_CheckedChanged); 485 | // 486 | // rdoSendRead 487 | // 488 | this.rdoSendRead.Anchor = System.Windows.Forms.AnchorStyles.None; 489 | this.rdoSendRead.AutoSize = true; 490 | this.rdoSendRead.Location = new System.Drawing.Point(80, 4); 491 | this.rdoSendRead.Name = "rdoSendRead"; 492 | this.rdoSendRead.Size = new System.Drawing.Size(95, 16); 493 | this.rdoSendRead.TabIndex = 1; 494 | this.rdoSendRead.Text = "循环发送读取"; 495 | this.rdoSendRead.UseVisualStyleBackColor = true; 496 | this.rdoSendRead.CheckedChanged += new System.EventHandler(this.rdoSendRead_CheckedChanged); 497 | // 498 | // label2 499 | // 500 | this.label2.Anchor = System.Windows.Forms.AnchorStyles.None; 501 | this.label2.AutoSize = true; 502 | this.label2.Location = new System.Drawing.Point(181, 6); 503 | this.label2.Name = "label2"; 504 | this.label2.Size = new System.Drawing.Size(41, 12); 505 | this.label2.TabIndex = 3; 506 | this.label2.Text = "次数:"; 507 | // 508 | // nudCycleCount 509 | // 510 | this.nudCycleCount.Anchor = System.Windows.Forms.AnchorStyles.None; 511 | this.nudCycleCount.Location = new System.Drawing.Point(227, 2); 512 | this.nudCycleCount.Margin = new System.Windows.Forms.Padding(2); 513 | this.nudCycleCount.Maximum = new decimal(new int[] { 514 | 10000000, 515 | 0, 516 | 0, 517 | 0}); 518 | this.nudCycleCount.Name = "nudCycleCount"; 519 | this.nudCycleCount.Size = new System.Drawing.Size(73, 21); 520 | this.nudCycleCount.TabIndex = 2; 521 | // 522 | // label3 523 | // 524 | this.label3.Anchor = System.Windows.Forms.AnchorStyles.None; 525 | this.label3.AutoSize = true; 526 | this.label3.Location = new System.Drawing.Point(305, 6); 527 | this.label3.Name = "label3"; 528 | this.label3.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); 529 | this.label3.Size = new System.Drawing.Size(51, 12); 530 | this.label3.TabIndex = 5; 531 | this.label3.Text = "间隔:"; 532 | // 533 | // nudInterval 534 | // 535 | this.nudInterval.Anchor = System.Windows.Forms.AnchorStyles.None; 536 | this.nudInterval.Location = new System.Drawing.Point(361, 2); 537 | this.nudInterval.Margin = new System.Windows.Forms.Padding(2); 538 | this.nudInterval.Maximum = new decimal(new int[] { 539 | 10000, 540 | 0, 541 | 0, 542 | 0}); 543 | this.nudInterval.Name = "nudInterval"; 544 | this.nudInterval.Size = new System.Drawing.Size(60, 21); 545 | this.nudInterval.TabIndex = 4; 546 | this.nudInterval.Value = new decimal(new int[] { 547 | 10, 548 | 0, 549 | 0, 550 | 0}); 551 | // 552 | // label4 553 | // 554 | this.label4.Anchor = System.Windows.Forms.AnchorStyles.None; 555 | this.label4.AutoSize = true; 556 | this.label4.Location = new System.Drawing.Point(426, 6); 557 | this.label4.Name = "label4"; 558 | this.label4.Size = new System.Drawing.Size(17, 12); 559 | this.label4.TabIndex = 6; 560 | this.label4.Text = "ms"; 561 | // 562 | // flowLayoutPanel1 563 | // 564 | this.flowLayoutPanel1.Controls.Add(this.rbtRS232); 565 | this.flowLayoutPanel1.Controls.Add(this.cboRS232); 566 | this.flowLayoutPanel1.Controls.Add(this.rbtUSB); 567 | this.flowLayoutPanel1.Controls.Add(this.cboUSB); 568 | this.flowLayoutPanel1.Controls.Add(this.rbtGPIB); 569 | this.flowLayoutPanel1.Controls.Add(this.cboGPIB); 570 | this.flowLayoutPanel1.Controls.Add(this.rbtLAN); 571 | this.flowLayoutPanel1.Controls.Add(this.cboLAN); 572 | this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 573 | this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 13); 574 | this.flowLayoutPanel1.Name = "flowLayoutPanel1"; 575 | this.flowLayoutPanel1.Size = new System.Drawing.Size(669, 54); 576 | this.flowLayoutPanel1.TabIndex = 0; 577 | // 578 | // rbtRS232 579 | // 580 | this.rbtRS232.Anchor = System.Windows.Forms.AnchorStyles.Left; 581 | this.rbtRS232.AutoSize = true; 582 | this.rbtRS232.Location = new System.Drawing.Point(3, 5); 583 | this.rbtRS232.Name = "rbtRS232"; 584 | this.rbtRS232.Size = new System.Drawing.Size(53, 16); 585 | this.rbtRS232.TabIndex = 2; 586 | this.rbtRS232.Text = "RS232"; 587 | this.rbtRS232.UseVisualStyleBackColor = true; 588 | this.rbtRS232.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); 589 | // 590 | // cboRS232 591 | // 592 | this.cboRS232.Anchor = System.Windows.Forms.AnchorStyles.Left; 593 | this.cboRS232.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 594 | this.cboRS232.FormattingEnabled = true; 595 | this.cboRS232.Location = new System.Drawing.Point(62, 3); 596 | this.cboRS232.Name = "cboRS232"; 597 | this.cboRS232.Size = new System.Drawing.Size(261, 20); 598 | this.cboRS232.TabIndex = 3; 599 | // 600 | // rbtUSB 601 | // 602 | this.rbtUSB.Anchor = System.Windows.Forms.AnchorStyles.Left; 603 | this.rbtUSB.AutoSize = true; 604 | this.rbtUSB.Location = new System.Drawing.Point(329, 5); 605 | this.rbtUSB.Name = "rbtUSB"; 606 | this.rbtUSB.Size = new System.Drawing.Size(41, 16); 607 | this.rbtUSB.TabIndex = 4; 608 | this.rbtUSB.Text = "USB"; 609 | this.rbtUSB.UseVisualStyleBackColor = true; 610 | this.rbtUSB.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); 611 | // 612 | // cboUSB 613 | // 614 | this.cboUSB.Anchor = System.Windows.Forms.AnchorStyles.Left; 615 | this.cboUSB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 616 | this.cboUSB.FormattingEnabled = true; 617 | this.cboUSB.Location = new System.Drawing.Point(376, 3); 618 | this.cboUSB.Name = "cboUSB"; 619 | this.cboUSB.Size = new System.Drawing.Size(261, 20); 620 | this.cboUSB.TabIndex = 5; 621 | // 622 | // rbtGPIB 623 | // 624 | this.rbtGPIB.Anchor = System.Windows.Forms.AnchorStyles.Left; 625 | this.rbtGPIB.AutoSize = true; 626 | this.rbtGPIB.Location = new System.Drawing.Point(3, 31); 627 | this.rbtGPIB.Name = "rbtGPIB"; 628 | this.rbtGPIB.Size = new System.Drawing.Size(53, 16); 629 | this.rbtGPIB.TabIndex = 6; 630 | this.rbtGPIB.Text = "GPIB "; 631 | this.rbtGPIB.UseVisualStyleBackColor = true; 632 | this.rbtGPIB.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); 633 | // 634 | // cboGPIB 635 | // 636 | this.cboGPIB.Anchor = System.Windows.Forms.AnchorStyles.Left; 637 | this.cboGPIB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 638 | this.cboGPIB.FormattingEnabled = true; 639 | this.cboGPIB.Location = new System.Drawing.Point(62, 29); 640 | this.cboGPIB.Name = "cboGPIB"; 641 | this.cboGPIB.Size = new System.Drawing.Size(261, 20); 642 | this.cboGPIB.TabIndex = 7; 643 | // 644 | // rbtLAN 645 | // 646 | this.rbtLAN.Anchor = System.Windows.Forms.AnchorStyles.Left; 647 | this.rbtLAN.AutoSize = true; 648 | this.rbtLAN.Location = new System.Drawing.Point(329, 31); 649 | this.rbtLAN.Name = "rbtLAN"; 650 | this.rbtLAN.Size = new System.Drawing.Size(41, 16); 651 | this.rbtLAN.TabIndex = 8; 652 | this.rbtLAN.Text = "LAN"; 653 | this.rbtLAN.UseVisualStyleBackColor = true; 654 | this.rbtLAN.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); 655 | // 656 | // cboLAN 657 | // 658 | this.cboLAN.Anchor = System.Windows.Forms.AnchorStyles.Left; 659 | this.cboLAN.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 660 | this.cboLAN.FormattingEnabled = true; 661 | this.cboLAN.Location = new System.Drawing.Point(376, 29); 662 | this.cboLAN.Name = "cboLAN"; 663 | this.cboLAN.Size = new System.Drawing.Size(261, 20); 664 | this.cboLAN.TabIndex = 9; 665 | // 666 | // flowLayoutPanel2 667 | // 668 | this.tableLayoutPanel.SetColumnSpan(this.flowLayoutPanel2, 2); 669 | this.flowLayoutPanel2.Controls.Add(this.lblBaudRate); 670 | this.flowLayoutPanel2.Controls.Add(this.cboBaudRate); 671 | this.flowLayoutPanel2.Controls.Add(this.lblParity); 672 | this.flowLayoutPanel2.Controls.Add(this.cboParity); 673 | this.flowLayoutPanel2.Controls.Add(this.lblStopBits); 674 | this.flowLayoutPanel2.Controls.Add(this.cboStopBits); 675 | this.flowLayoutPanel2.Controls.Add(this.lblDataBits); 676 | this.flowLayoutPanel2.Controls.Add(this.cboDataBits); 677 | this.flowLayoutPanel2.Controls.Add(this.lblFlowControl); 678 | this.flowLayoutPanel2.Controls.Add(this.cboFlowControl); 679 | this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 680 | this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 73); 681 | this.flowLayoutPanel2.Name = "flowLayoutPanel2"; 682 | this.flowLayoutPanel2.Size = new System.Drawing.Size(774, 29); 683 | this.flowLayoutPanel2.TabIndex = 3; 684 | // 685 | // lblBaudRate 686 | // 687 | this.lblBaudRate.Anchor = System.Windows.Forms.AnchorStyles.Left; 688 | this.lblBaudRate.AutoSize = true; 689 | this.lblBaudRate.Location = new System.Drawing.Point(3, 7); 690 | this.lblBaudRate.Name = "lblBaudRate"; 691 | this.lblBaudRate.Size = new System.Drawing.Size(41, 12); 692 | this.lblBaudRate.TabIndex = 0; 693 | this.lblBaudRate.Text = "波特率"; 694 | // 695 | // cboBaudRate 696 | // 697 | this.cboBaudRate.Anchor = System.Windows.Forms.AnchorStyles.Left; 698 | this.cboBaudRate.FormattingEnabled = true; 699 | this.cboBaudRate.Location = new System.Drawing.Point(50, 3); 700 | this.cboBaudRate.Margin = new System.Windows.Forms.Padding(3, 3, 17, 3); 701 | this.cboBaudRate.Name = "cboBaudRate"; 702 | this.cboBaudRate.Size = new System.Drawing.Size(73, 20); 703 | this.cboBaudRate.TabIndex = 1; 704 | // 705 | // lblParity 706 | // 707 | this.lblParity.Anchor = System.Windows.Forms.AnchorStyles.Left; 708 | this.lblParity.AutoSize = true; 709 | this.lblParity.Location = new System.Drawing.Point(143, 7); 710 | this.lblParity.Name = "lblParity"; 711 | this.lblParity.Size = new System.Drawing.Size(65, 12); 712 | this.lblParity.TabIndex = 0; 713 | this.lblParity.Text = "奇偶校验位"; 714 | // 715 | // cboParity 716 | // 717 | this.cboParity.Anchor = System.Windows.Forms.AnchorStyles.Left; 718 | this.cboParity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 719 | this.cboParity.FormattingEnabled = true; 720 | this.cboParity.Location = new System.Drawing.Point(214, 3); 721 | this.cboParity.Margin = new System.Windows.Forms.Padding(3, 3, 17, 3); 722 | this.cboParity.Name = "cboParity"; 723 | this.cboParity.Size = new System.Drawing.Size(73, 20); 724 | this.cboParity.TabIndex = 2; 725 | // 726 | // lblStopBits 727 | // 728 | this.lblStopBits.Anchor = System.Windows.Forms.AnchorStyles.Left; 729 | this.lblStopBits.AutoSize = true; 730 | this.lblStopBits.Location = new System.Drawing.Point(307, 7); 731 | this.lblStopBits.Name = "lblStopBits"; 732 | this.lblStopBits.Size = new System.Drawing.Size(41, 12); 733 | this.lblStopBits.TabIndex = 0; 734 | this.lblStopBits.Text = "停止位"; 735 | // 736 | // cboStopBits 737 | // 738 | this.cboStopBits.Anchor = System.Windows.Forms.AnchorStyles.Left; 739 | this.cboStopBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 740 | this.cboStopBits.FormattingEnabled = true; 741 | this.cboStopBits.Location = new System.Drawing.Point(354, 3); 742 | this.cboStopBits.Margin = new System.Windows.Forms.Padding(3, 3, 17, 3); 743 | this.cboStopBits.Name = "cboStopBits"; 744 | this.cboStopBits.Size = new System.Drawing.Size(115, 20); 745 | this.cboStopBits.TabIndex = 3; 746 | // 747 | // lblDataBits 748 | // 749 | this.lblDataBits.Anchor = System.Windows.Forms.AnchorStyles.Left; 750 | this.lblDataBits.AutoSize = true; 751 | this.lblDataBits.Location = new System.Drawing.Point(489, 7); 752 | this.lblDataBits.Name = "lblDataBits"; 753 | this.lblDataBits.Size = new System.Drawing.Size(41, 12); 754 | this.lblDataBits.TabIndex = 0; 755 | this.lblDataBits.Text = "数据位"; 756 | // 757 | // cboDataBits 758 | // 759 | this.cboDataBits.Anchor = System.Windows.Forms.AnchorStyles.Left; 760 | this.cboDataBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 761 | this.cboDataBits.FormattingEnabled = true; 762 | this.cboDataBits.Location = new System.Drawing.Point(536, 3); 763 | this.cboDataBits.Margin = new System.Windows.Forms.Padding(3, 3, 17, 3); 764 | this.cboDataBits.Name = "cboDataBits"; 765 | this.cboDataBits.Size = new System.Drawing.Size(73, 20); 766 | this.cboDataBits.TabIndex = 4; 767 | // 768 | // lblFlowControl 769 | // 770 | this.lblFlowControl.Anchor = System.Windows.Forms.AnchorStyles.Left; 771 | this.lblFlowControl.AutoSize = true; 772 | this.lblFlowControl.Location = new System.Drawing.Point(629, 7); 773 | this.lblFlowControl.Name = "lblFlowControl"; 774 | this.lblFlowControl.Size = new System.Drawing.Size(41, 12); 775 | this.lblFlowControl.TabIndex = 0; 776 | this.lblFlowControl.Text = "控制流"; 777 | // 778 | // cboFlowControl 779 | // 780 | this.cboFlowControl.Anchor = System.Windows.Forms.AnchorStyles.Left; 781 | this.cboFlowControl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 782 | this.cboFlowControl.FormattingEnabled = true; 783 | this.cboFlowControl.Location = new System.Drawing.Point(676, 3); 784 | this.cboFlowControl.Name = "cboFlowControl"; 785 | this.cboFlowControl.Size = new System.Drawing.Size(73, 20); 786 | this.cboFlowControl.TabIndex = 5; 787 | // 788 | // flowLayoutPanel4 789 | // 790 | this.flowLayoutPanel4.Controls.Add(this.btnRefresh); 791 | this.flowLayoutPanel4.Controls.Add(this.btnOpen); 792 | this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; 793 | this.flowLayoutPanel4.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; 794 | this.flowLayoutPanel4.Location = new System.Drawing.Point(678, 13); 795 | this.flowLayoutPanel4.Name = "flowLayoutPanel4"; 796 | this.flowLayoutPanel4.Size = new System.Drawing.Size(99, 54); 797 | this.flowLayoutPanel4.TabIndex = 5; 798 | // 799 | // btnRefresh 800 | // 801 | this.btnRefresh.Location = new System.Drawing.Point(2, 2); 802 | this.btnRefresh.Margin = new System.Windows.Forms.Padding(2); 803 | this.btnRefresh.Name = "btnRefresh"; 804 | this.btnRefresh.Size = new System.Drawing.Size(88, 23); 805 | this.btnRefresh.TabIndex = 5; 806 | this.btnRefresh.Text = "刷新"; 807 | this.btnRefresh.UseVisualStyleBackColor = true; 808 | this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); 809 | // 810 | // btnOpen 811 | // 812 | this.btnOpen.Location = new System.Drawing.Point(2, 28); 813 | this.btnOpen.Margin = new System.Windows.Forms.Padding(2, 1, 1, 1); 814 | this.btnOpen.Name = "btnOpen"; 815 | this.btnOpen.Size = new System.Drawing.Size(88, 23); 816 | this.btnOpen.TabIndex = 4; 817 | this.btnOpen.Text = "打开"; 818 | this.btnOpen.UseVisualStyleBackColor = true; 819 | this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); 820 | // 821 | // groupBoxDisplay 822 | // 823 | this.tableLayoutPanel.SetColumnSpan(this.groupBoxDisplay, 2); 824 | this.groupBoxDisplay.Controls.Add(this.txtDisplay); 825 | this.groupBoxDisplay.Dock = System.Windows.Forms.DockStyle.Fill; 826 | this.groupBoxDisplay.Location = new System.Drawing.Point(3, 382); 827 | this.groupBoxDisplay.Name = "groupBoxDisplay"; 828 | this.groupBoxDisplay.Size = new System.Drawing.Size(774, 216); 829 | this.groupBoxDisplay.TabIndex = 2; 830 | this.groupBoxDisplay.TabStop = false; 831 | this.groupBoxDisplay.Text = "显示"; 832 | // 833 | // txtDisplay 834 | // 835 | this.txtDisplay.ContextMenuStrip = this.contextMenuStrip; 836 | this.txtDisplay.Dock = System.Windows.Forms.DockStyle.Fill; 837 | this.txtDisplay.Location = new System.Drawing.Point(3, 17); 838 | this.txtDisplay.Multiline = true; 839 | this.txtDisplay.Name = "txtDisplay"; 840 | this.txtDisplay.ReadOnly = true; 841 | this.txtDisplay.ScrollBars = System.Windows.Forms.ScrollBars.Both; 842 | this.txtDisplay.Size = new System.Drawing.Size(768, 196); 843 | this.txtDisplay.TabIndex = 0; 844 | // 845 | // contextMenuStrip 846 | // 847 | this.contextMenuStrip.ImageScalingSize = new System.Drawing.Size(32, 32); 848 | this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 849 | this.清除ToolStripMenuItem, 850 | this.toolStripMenuItem1, 851 | this.全选ToolStripMenuItem, 852 | this.复制ToolStripMenuItem}); 853 | this.contextMenuStrip.Name = "contextMenuStrip"; 854 | this.contextMenuStrip.Size = new System.Drawing.Size(101, 76); 855 | this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); 856 | // 857 | // 清除ToolStripMenuItem 858 | // 859 | this.清除ToolStripMenuItem.Name = "清除ToolStripMenuItem"; 860 | this.清除ToolStripMenuItem.Size = new System.Drawing.Size(100, 22); 861 | this.清除ToolStripMenuItem.Text = "清除"; 862 | this.清除ToolStripMenuItem.Click += new System.EventHandler(this.清除ToolStripMenuItem_Click); 863 | // 864 | // toolStripMenuItem1 865 | // 866 | this.toolStripMenuItem1.Name = "toolStripMenuItem1"; 867 | this.toolStripMenuItem1.Size = new System.Drawing.Size(97, 6); 868 | // 869 | // 全选ToolStripMenuItem 870 | // 871 | this.全选ToolStripMenuItem.Name = "全选ToolStripMenuItem"; 872 | this.全选ToolStripMenuItem.Size = new System.Drawing.Size(100, 22); 873 | this.全选ToolStripMenuItem.Text = "全选"; 874 | this.全选ToolStripMenuItem.Click += new System.EventHandler(this.全选ToolStripMenuItem_Click); 875 | // 876 | // 复制ToolStripMenuItem 877 | // 878 | this.复制ToolStripMenuItem.Name = "复制ToolStripMenuItem"; 879 | this.复制ToolStripMenuItem.Size = new System.Drawing.Size(100, 22); 880 | this.复制ToolStripMenuItem.Text = "复制"; 881 | this.复制ToolStripMenuItem.Click += new System.EventHandler(this.复制ToolStripMenuItem_Click); 882 | // 883 | // flowLayoutPanel5 884 | // 885 | this.tableLayoutPanel.SetColumnSpan(this.flowLayoutPanel5, 2); 886 | this.flowLayoutPanel5.Controls.Add(this.lblIP); 887 | this.flowLayoutPanel5.Controls.Add(this.txtIPAddress); 888 | this.flowLayoutPanel5.Controls.Add(this.btnCheckIP); 889 | this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; 890 | this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 108); 891 | this.flowLayoutPanel5.Name = "flowLayoutPanel5"; 892 | this.flowLayoutPanel5.Size = new System.Drawing.Size(774, 29); 893 | this.flowLayoutPanel5.TabIndex = 6; 894 | // 895 | // lblIP 896 | // 897 | this.lblIP.Anchor = System.Windows.Forms.AnchorStyles.Left; 898 | this.lblIP.AutoSize = true; 899 | this.lblIP.Location = new System.Drawing.Point(3, 8); 900 | this.lblIP.Name = "lblIP"; 901 | this.lblIP.Size = new System.Drawing.Size(41, 12); 902 | this.lblIP.TabIndex = 0; 903 | this.lblIP.Text = "IP地址"; 904 | // 905 | // txtIPAddress 906 | // 907 | this.txtIPAddress.Anchor = System.Windows.Forms.AnchorStyles.Left; 908 | this.txtIPAddress.Location = new System.Drawing.Point(50, 4); 909 | this.txtIPAddress.Name = "txtIPAddress"; 910 | this.txtIPAddress.Size = new System.Drawing.Size(277, 21); 911 | this.txtIPAddress.TabIndex = 1; 912 | // 913 | // btnCheckIP 914 | // 915 | this.btnCheckIP.Anchor = System.Windows.Forms.AnchorStyles.Left; 916 | this.btnCheckIP.Location = new System.Drawing.Point(333, 3); 917 | this.btnCheckIP.Name = "btnCheckIP"; 918 | this.btnCheckIP.Size = new System.Drawing.Size(53, 23); 919 | this.btnCheckIP.TabIndex = 2; 920 | this.btnCheckIP.Text = "检测"; 921 | this.btnCheckIP.UseVisualStyleBackColor = true; 922 | this.btnCheckIP.Click += new System.EventHandler(this.btnCheckIP_Click); 923 | // 924 | // menuStrip1 925 | // 926 | this.tableLayoutPanel.SetColumnSpan(this.menuStrip1, 2); 927 | this.menuStrip1.ImageScalingSize = new System.Drawing.Size(32, 32); 928 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 929 | this.关于ToolStripMenuItem, 930 | this.时间ToolStripMenuItem}); 931 | this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; 932 | this.menuStrip1.Location = new System.Drawing.Point(0, 601); 933 | this.menuStrip1.Name = "menuStrip1"; 934 | this.menuStrip1.Padding = new System.Windows.Forms.Padding(3, 1, 0, 1); 935 | this.menuStrip1.Size = new System.Drawing.Size(780, 24); 936 | this.menuStrip1.TabIndex = 7; 937 | this.menuStrip1.Text = "menuStrip1"; 938 | // 939 | // 关于ToolStripMenuItem 940 | // 941 | this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 942 | this.toolStripMenuItem2, 943 | this.toolStripSeparator1, 944 | this.githubToolStripMenuItem1, 945 | this.blogToolStripMenuItem1, 946 | this.toolStripMenuItem3, 947 | this.byCNXYToolStripMenuItem1}); 948 | this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem"; 949 | this.关于ToolStripMenuItem.Size = new System.Drawing.Size(44, 22); 950 | this.关于ToolStripMenuItem.Text = "关于"; 951 | // 952 | // toolStripMenuItem2 953 | // 954 | this.toolStripMenuItem2.Name = "toolStripMenuItem2"; 955 | this.toolStripMenuItem2.Size = new System.Drawing.Size(163, 22); 956 | this.toolStripMenuItem2.Text = "已安装VISA信息"; 957 | this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); 958 | // 959 | // toolStripSeparator1 960 | // 961 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 962 | this.toolStripSeparator1.Size = new System.Drawing.Size(160, 6); 963 | // 964 | // githubToolStripMenuItem1 965 | // 966 | this.githubToolStripMenuItem1.Name = "githubToolStripMenuItem1"; 967 | this.githubToolStripMenuItem1.Size = new System.Drawing.Size(163, 22); 968 | this.githubToolStripMenuItem1.Text = "Github"; 969 | this.githubToolStripMenuItem1.Click += new System.EventHandler(this.githubToolStripMenuItem1_Click); 970 | // 971 | // blogToolStripMenuItem1 972 | // 973 | this.blogToolStripMenuItem1.Name = "blogToolStripMenuItem1"; 974 | this.blogToolStripMenuItem1.Size = new System.Drawing.Size(163, 22); 975 | this.blogToolStripMenuItem1.Text = "Blog"; 976 | this.blogToolStripMenuItem1.Click += new System.EventHandler(this.blogToolStripMenuItem1_Click); 977 | // 978 | // toolStripMenuItem3 979 | // 980 | this.toolStripMenuItem3.Name = "toolStripMenuItem3"; 981 | this.toolStripMenuItem3.Size = new System.Drawing.Size(160, 6); 982 | // 983 | // byCNXYToolStripMenuItem1 984 | // 985 | this.byCNXYToolStripMenuItem1.Name = "byCNXYToolStripMenuItem1"; 986 | this.byCNXYToolStripMenuItem1.Size = new System.Drawing.Size(163, 22); 987 | this.byCNXYToolStripMenuItem1.Text = "By CNXY"; 988 | this.byCNXYToolStripMenuItem1.Click += new System.EventHandler(this.byCNXYToolStripMenuItem1_Click); 989 | // 990 | // 时间ToolStripMenuItem 991 | // 992 | this.时间ToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; 993 | this.时间ToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 994 | this.时间ToolStripMenuItem.Name = "时间ToolStripMenuItem"; 995 | this.时间ToolStripMenuItem.Size = new System.Drawing.Size(44, 22); 996 | this.时间ToolStripMenuItem.Text = "时间"; 997 | this.时间ToolStripMenuItem.Click += new System.EventHandler(this.时间ToolStripMenuItem_Click); 998 | // 999 | // flowLayoutPanel11 1000 | // 1001 | this.flowLayoutPanel11.Controls.Add(this.lblOverTime); 1002 | this.flowLayoutPanel11.Controls.Add(this.nudTimeout); 1003 | this.flowLayoutPanel11.Controls.Add(this.lblTimeout); 1004 | this.flowLayoutPanel11.Dock = System.Windows.Forms.DockStyle.Fill; 1005 | this.flowLayoutPanel11.Location = new System.Drawing.Point(3, 143); 1006 | this.flowLayoutPanel11.Name = "flowLayoutPanel11"; 1007 | this.flowLayoutPanel11.Size = new System.Drawing.Size(669, 31); 1008 | this.flowLayoutPanel11.TabIndex = 10; 1009 | // 1010 | // lblOverTime 1011 | // 1012 | this.lblOverTime.Anchor = System.Windows.Forms.AnchorStyles.None; 1013 | this.lblOverTime.AutoSize = true; 1014 | this.lblOverTime.Location = new System.Drawing.Point(3, 7); 1015 | this.lblOverTime.Margin = new System.Windows.Forms.Padding(3); 1016 | this.lblOverTime.Name = "lblOverTime"; 1017 | this.lblOverTime.Size = new System.Drawing.Size(29, 12); 1018 | this.lblOverTime.TabIndex = 5; 1019 | this.lblOverTime.Text = "超时"; 1020 | // 1021 | // nudTimeout 1022 | // 1023 | this.nudTimeout.Anchor = System.Windows.Forms.AnchorStyles.None; 1024 | this.nudTimeout.Increment = new decimal(new int[] { 1025 | 100, 1026 | 0, 1027 | 0, 1028 | 0}); 1029 | this.nudTimeout.Location = new System.Drawing.Point(38, 3); 1030 | this.nudTimeout.Maximum = new decimal(new int[] { 1031 | 20000, 1032 | 0, 1033 | 0, 1034 | 0}); 1035 | this.nudTimeout.Name = "nudTimeout"; 1036 | this.nudTimeout.Size = new System.Drawing.Size(75, 21); 1037 | this.nudTimeout.TabIndex = 6; 1038 | this.nudTimeout.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 1039 | this.nudTimeout.Value = new decimal(new int[] { 1040 | 2000, 1041 | 0, 1042 | 0, 1043 | 0}); 1044 | // 1045 | // lblTimeout 1046 | // 1047 | this.lblTimeout.Anchor = System.Windows.Forms.AnchorStyles.None; 1048 | this.lblTimeout.AutoSize = true; 1049 | this.lblTimeout.Location = new System.Drawing.Point(119, 7); 1050 | this.lblTimeout.Name = "lblTimeout"; 1051 | this.lblTimeout.Size = new System.Drawing.Size(17, 12); 1052 | this.lblTimeout.TabIndex = 7; 1053 | this.lblTimeout.Text = "ms"; 1054 | // 1055 | // cmsCommand 1056 | // 1057 | this.cmsCommand.ImageScalingSize = new System.Drawing.Size(32, 32); 1058 | this.cmsCommand.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 1059 | this.全选ToolStripMenuItem1, 1060 | this.复制ToolStripMenuItem1, 1061 | this.粘贴ToolStripMenuItem}); 1062 | this.cmsCommand.Name = "contextMenuStrip"; 1063 | this.cmsCommand.Size = new System.Drawing.Size(101, 70); 1064 | this.cmsCommand.Opening += new System.ComponentModel.CancelEventHandler(this.cmsCommand_Opening); 1065 | // 1066 | // 全选ToolStripMenuItem1 1067 | // 1068 | this.全选ToolStripMenuItem1.Name = "全选ToolStripMenuItem1"; 1069 | this.全选ToolStripMenuItem1.Size = new System.Drawing.Size(100, 22); 1070 | this.全选ToolStripMenuItem1.Text = "全选"; 1071 | this.全选ToolStripMenuItem1.Click += new System.EventHandler(this.全选ToolStripMenuItem1_Click); 1072 | // 1073 | // 复制ToolStripMenuItem1 1074 | // 1075 | this.复制ToolStripMenuItem1.Name = "复制ToolStripMenuItem1"; 1076 | this.复制ToolStripMenuItem1.Size = new System.Drawing.Size(100, 22); 1077 | this.复制ToolStripMenuItem1.Text = "复制"; 1078 | this.复制ToolStripMenuItem1.Click += new System.EventHandler(this.复制ToolStripMenuItem1_Click); 1079 | // 1080 | // 粘贴ToolStripMenuItem 1081 | // 1082 | this.粘贴ToolStripMenuItem.Name = "粘贴ToolStripMenuItem"; 1083 | this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(100, 22); 1084 | this.粘贴ToolStripMenuItem.Text = "粘贴"; 1085 | this.粘贴ToolStripMenuItem.Click += new System.EventHandler(this.粘贴ToolStripMenuItem_Click); 1086 | // 1087 | // FrmMain 1088 | // 1089 | this.AcceptButton = this.btnOpen; 1090 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 1091 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 1092 | this.ClientSize = new System.Drawing.Size(780, 626); 1093 | this.Controls.Add(this.tableLayoutPanel); 1094 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 1095 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 1096 | this.MaximizeBox = false; 1097 | this.Name = "FrmMain"; 1098 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 1099 | this.Text = "NI-VISA仪器控制调试器"; 1100 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing); 1101 | this.Load += new System.EventHandler(this.FrmMain_Load); 1102 | this.tableLayoutPanel.ResumeLayout(false); 1103 | this.tableLayoutPanel.PerformLayout(); 1104 | this.tableLayoutPanel1.ResumeLayout(false); 1105 | this.tableLayoutPanel1.PerformLayout(); 1106 | this.flowLayoutPanel6.ResumeLayout(false); 1107 | this.flowLayoutPanel7.ResumeLayout(false); 1108 | this.groupBox1.ResumeLayout(false); 1109 | this.flowLayoutPanel3.ResumeLayout(false); 1110 | this.flowLayoutPanel3.PerformLayout(); 1111 | this.groupBox2.ResumeLayout(false); 1112 | this.flowLayoutPanel8.ResumeLayout(false); 1113 | this.flowLayoutPanel8.PerformLayout(); 1114 | ((System.ComponentModel.ISupportInitialize)(this.nudSpecifiedCount)).EndInit(); 1115 | this.groupBox3.ResumeLayout(false); 1116 | this.flowLayoutPanel9.ResumeLayout(false); 1117 | this.flowLayoutPanel9.PerformLayout(); 1118 | this.flowLayoutPanel10.ResumeLayout(false); 1119 | this.flowLayoutPanel10.PerformLayout(); 1120 | ((System.ComponentModel.ISupportInitialize)(this.nudCycleCount)).EndInit(); 1121 | ((System.ComponentModel.ISupportInitialize)(this.nudInterval)).EndInit(); 1122 | this.flowLayoutPanel1.ResumeLayout(false); 1123 | this.flowLayoutPanel1.PerformLayout(); 1124 | this.flowLayoutPanel2.ResumeLayout(false); 1125 | this.flowLayoutPanel2.PerformLayout(); 1126 | this.flowLayoutPanel4.ResumeLayout(false); 1127 | this.groupBoxDisplay.ResumeLayout(false); 1128 | this.groupBoxDisplay.PerformLayout(); 1129 | this.contextMenuStrip.ResumeLayout(false); 1130 | this.flowLayoutPanel5.ResumeLayout(false); 1131 | this.flowLayoutPanel5.PerformLayout(); 1132 | this.menuStrip1.ResumeLayout(false); 1133 | this.menuStrip1.PerformLayout(); 1134 | this.flowLayoutPanel11.ResumeLayout(false); 1135 | this.flowLayoutPanel11.PerformLayout(); 1136 | ((System.ComponentModel.ISupportInitialize)(this.nudTimeout)).EndInit(); 1137 | this.cmsCommand.ResumeLayout(false); 1138 | this.ResumeLayout(false); 1139 | 1140 | } 1141 | 1142 | #endregion 1143 | 1144 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 1145 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; 1146 | private System.Windows.Forms.RadioButton rbtRS232; 1147 | private System.Windows.Forms.ComboBox cboRS232; 1148 | private System.Windows.Forms.RadioButton rbtUSB; 1149 | private System.Windows.Forms.ComboBox cboUSB; 1150 | private System.Windows.Forms.RadioButton rbtGPIB; 1151 | private System.Windows.Forms.ComboBox cboGPIB; 1152 | private System.Windows.Forms.Button btnWrite; 1153 | private System.Windows.Forms.Button btnRead; 1154 | private System.Windows.Forms.Button btnQuery; 1155 | private System.Windows.Forms.GroupBox groupBoxDisplay; 1156 | private System.Windows.Forms.TextBox txtDisplay; 1157 | private System.Windows.Forms.RadioButton rbtLAN; 1158 | private System.Windows.Forms.ComboBox cboLAN; 1159 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; 1160 | private System.Windows.Forms.Button btnOpen; 1161 | private System.Windows.Forms.Label lblParity; 1162 | private System.Windows.Forms.ComboBox cboParity; 1163 | private System.Windows.Forms.Label lblStopBits; 1164 | private System.Windows.Forms.ComboBox cboStopBits; 1165 | private System.Windows.Forms.Label lblDataBits; 1166 | private System.Windows.Forms.ComboBox cboDataBits; 1167 | private System.Windows.Forms.Label lblFlowControl; 1168 | private System.Windows.Forms.ComboBox cboFlowControl; 1169 | private System.Windows.Forms.Label lblBaudRate; 1170 | private System.Windows.Forms.ComboBox cboBaudRate; 1171 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; 1172 | private System.Windows.Forms.Button btnRefresh; 1173 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip; 1174 | private System.Windows.Forms.ToolStripMenuItem 清除ToolStripMenuItem; 1175 | private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; 1176 | private System.Windows.Forms.ToolStripMenuItem 全选ToolStripMenuItem; 1177 | private System.Windows.Forms.ToolStripMenuItem 复制ToolStripMenuItem; 1178 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel5; 1179 | private System.Windows.Forms.Label lblIP; 1180 | private System.Windows.Forms.TextBox txtIPAddress; 1181 | private System.Windows.Forms.Button btnCheckIP; 1182 | private System.Windows.Forms.Label lblOverTime; 1183 | private System.Windows.Forms.NumericUpDown nudTimeout; 1184 | private System.Windows.Forms.Label lblTimeout; 1185 | private System.Windows.Forms.MenuStrip menuStrip1; 1186 | private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem; 1187 | private System.Windows.Forms.ToolStripMenuItem githubToolStripMenuItem1; 1188 | private System.Windows.Forms.ToolStripMenuItem blogToolStripMenuItem1; 1189 | private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; 1190 | private System.Windows.Forms.ToolStripMenuItem byCNXYToolStripMenuItem1; 1191 | private System.Windows.Forms.ToolStripMenuItem 时间ToolStripMenuItem; 1192 | private System.Windows.Forms.ContextMenuStrip cmsCommand; 1193 | private System.Windows.Forms.ToolStripMenuItem 复制ToolStripMenuItem1; 1194 | private System.Windows.Forms.ToolStripMenuItem 粘贴ToolStripMenuItem; 1195 | private System.Windows.Forms.ToolStripMenuItem 全选ToolStripMenuItem1; 1196 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 1197 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6; 1198 | private System.Windows.Forms.TextBox txtCommand; 1199 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel7; 1200 | private System.Windows.Forms.RadioButton rdoAscii; 1201 | private System.Windows.Forms.RadioButton rdoByte; 1202 | private System.Windows.Forms.Label label1; 1203 | private System.Windows.Forms.CheckBox chkAppendNewLine; 1204 | private System.Windows.Forms.GroupBox groupBox1; 1205 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; 1206 | private System.Windows.Forms.GroupBox groupBox2; 1207 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel8; 1208 | private System.Windows.Forms.RadioButton rdoUntilNewLine; 1209 | private System.Windows.Forms.RadioButton rdoSpecifiedCount; 1210 | private System.Windows.Forms.NumericUpDown nudSpecifiedCount; 1211 | private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; 1212 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 1213 | private System.Windows.Forms.GroupBox groupBox3; 1214 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel9; 1215 | private System.Windows.Forms.RadioButton rdoSend; 1216 | private System.Windows.Forms.RadioButton rdoSendRead; 1217 | private System.Windows.Forms.NumericUpDown nudCycleCount; 1218 | private System.Windows.Forms.Label label2; 1219 | private System.Windows.Forms.CheckBox chkStartCycle; 1220 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel10; 1221 | private System.Windows.Forms.Button btnCycle; 1222 | private System.Windows.Forms.Label label3; 1223 | private System.Windows.Forms.NumericUpDown nudInterval; 1224 | private System.Windows.Forms.Label label4; 1225 | private System.Windows.Forms.CheckBox chkRealTimeReceive; 1226 | private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel11; 1227 | } 1228 | } 1229 | 1230 | -------------------------------------------------------------------------------- /VISAInstrument/FrmMain.cs: -------------------------------------------------------------------------------- 1 | using Ivi.Visa; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using VISAInstrument.Configuration; 11 | using VISAInstrument.Ports; 12 | using VISAInstrument.Properties; 13 | using VISAInstrument.Utility; 14 | using VISAInstrument.Utility.Extension; 15 | using VISAInstrument.Utility.Extension.UI; 16 | 17 | namespace VISAInstrument 18 | { 19 | public partial class FrmMain : Form 20 | { 21 | public FrmMain() 22 | { 23 | InitializeComponent(); 24 | } 25 | private bool _cancelDisplayForm; 26 | private void radioButton_CheckedChanged(object sender, EventArgs e) 27 | { 28 | if(rbtRS232 == sender as RadioButton) 29 | { 30 | rdoSpecifiedCount.Text = @"读取指定字节数量"; 31 | this.tableLayoutPanel.RowStyles[2].Height = 35F; 32 | this.tableLayoutPanel.RowStyles[3].Height = 0F; 33 | 34 | return; 35 | } 36 | rdoSpecifiedCount.Text = @"读取指定字节数量或收到结束符"; 37 | if (rbtLAN == sender as RadioButton) 38 | { 39 | this.tableLayoutPanel.RowStyles[2].Height = 0F; 40 | this.tableLayoutPanel.RowStyles[3].Height = 35F; 41 | return; 42 | } 43 | this.tableLayoutPanel.RowStyles[2].Height = 0F; 44 | this.tableLayoutPanel.RowStyles[3].Height = 0F; 45 | } 46 | 47 | private void DoSomethingForRadioButton(out string message,params Func[] actionOfRbt) 48 | { 49 | message = string.Empty; 50 | if (actionOfRbt.Length != 4) throw new ArgumentException(); 51 | if (rbtRS232.Checked) message = actionOfRbt[0](); 52 | if (rbtUSB.Checked) message = actionOfRbt[1](); 53 | if (rbtGPIB.Checked) message = actionOfRbt[2](); 54 | if (rbtLAN.Checked) message = actionOfRbt[3](); 55 | } 56 | 57 | private readonly int[] _baudRate = { 256000, 128000, 115200, 57600, 56000, 43000, 38400, 28800, 19200, 9600, 4800, 2400, 1200, 600, 300, 110 }; 58 | private readonly int[] _dataBits = { 8, 7, 6 }; 59 | private bool _isAsciiCommand = true; 60 | private void FrmMain_Load(object sender, EventArgs e) 61 | { 62 | _cts = new CancellationTokenSource(); 63 | ShowTime(); 64 | 关于ToolStripMenuItem.Text = $@"{Application.ProductName}({Application.ProductVersion})"; 65 | rbtRS232.Checked = true; 66 | btnRefresh.PerformClick(); 67 | btnOpen.Text = Resources.OpenString; 68 | cboBaudRate.DataSource = _baudRate; 69 | cboBaudRate.SelectedIndex = 9; 70 | cboParity.DataSource = Enum.GetValues(typeof(SerialParity)); 71 | cboStopBits.DataSource = Enum.GetValues(typeof(SerialStopBitsMode)); 72 | cboStopBits.SelectedIndex = 0; 73 | cboDataBits.DataSource = _dataBits; 74 | cboFlowControl.DataSource = Enum.GetValues(typeof(SerialFlowControlModes)); 75 | EnableControl(true); 76 | if (_cancelDisplayForm) Close(); 77 | } 78 | 79 | private CancellationTokenSource _cts; 80 | private void ShowTime() 81 | { 82 | Task.Factory.StartNew(() => 83 | { 84 | while(!_cts.IsCancellationRequested) 85 | { 86 | string now = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}"; 87 | InvokeToForm(() => 时间ToolStripMenuItem.Text = now); 88 | Thread.Sleep(500); 89 | } 90 | }); 91 | } 92 | 93 | private PortOperatorBase _portOperatorBase; 94 | private bool _isWritingError; 95 | 96 | private bool Write() 97 | { 98 | _isWritingError = false; 99 | if (string.IsNullOrEmpty(txtCommand.Text)) 100 | { 101 | Invoke(new Action(() => MessageBox.Show(this,Resources.CommandNotEmpty))); 102 | return false; 103 | } 104 | string asciiString = string.Empty; 105 | byte[] byteArray = null; 106 | if (_isAsciiCommand) 107 | { 108 | asciiString = txtCommand.Text; 109 | } 110 | else 111 | { 112 | if (StringEx.TryParseByteStringToByte(txtCommand.Text, out byte[] bytes)) 113 | { 114 | byteArray = bytes; 115 | } 116 | else 117 | { 118 | _isWritingError = true; 119 | Invoke(new Action(() => MessageBox.Show(this,@"转换字节失败,请按照“XX XX XX”格式输入内容"))); 120 | return false; 121 | } 122 | } 123 | 124 | Stopwatch stopwatch = Stopwatch.StartNew(); 125 | try 126 | { 127 | if (_isAsciiCommand) 128 | { 129 | if (chkAppendNewLine.Checked) 130 | { 131 | _portOperatorBase.WriteLine(asciiString); 132 | } 133 | else 134 | { 135 | _portOperatorBase.Write(asciiString); 136 | } 137 | } 138 | else 139 | { 140 | if (chkAppendNewLine.Checked) 141 | { 142 | _portOperatorBase.WriteLine(byteArray); 143 | } 144 | else 145 | { 146 | _portOperatorBase.Write(byteArray); 147 | } 148 | } 149 | } 150 | catch(Exception ex) 151 | { 152 | Invoke(new Action(() => MessageBox.Show(this,$@"写入命令“{txtCommand.Text}”失败!{Environment.NewLine}{ex.Message}"))); 153 | return false; 154 | } 155 | Invoke(new Action(() => DisplayToTextBox($"[Time:{stopwatch.ElapsedMilliseconds}ms] Write: {txtCommand.Text}"))); 156 | return true; 157 | } 158 | 159 | private void btnWrite_Click(object sender, EventArgs e) 160 | { 161 | Write(); 162 | } 163 | 164 | private void Read() 165 | { 166 | Read(rdoUntilNewLine.Checked, (int)nudSpecifiedCount.Value); 167 | } 168 | 169 | private void Read(bool isUntilNewLine,int specifiedCount) 170 | { 171 | ClearIfTextBoxOverFlow(); 172 | string result; 173 | Stopwatch stopwatch = Stopwatch.StartNew(); 174 | try 175 | { 176 | if (_isAsciiCommand) 177 | { 178 | result = isUntilNewLine ? _portOperatorBase.ReadLine() : _portOperatorBase.Read(specifiedCount); 179 | } 180 | else 181 | { 182 | byte[] bytes = isUntilNewLine ? _portOperatorBase.ReadToBytes() : _portOperatorBase.ReadToBytes(specifiedCount); 183 | if (ByteEx.TryParseByteToByteString(bytes, out string byteString)) 184 | { 185 | result = byteString; 186 | } 187 | else 188 | { 189 | throw new InvalidCastException("无法转换从接收缓冲区接收回来的数据"); 190 | } 191 | } 192 | } 193 | catch (IOTimeoutException) 194 | { 195 | result = Resources.ReadTimeout; 196 | } 197 | catch (Exception ex) 198 | { 199 | result = ex.Message; 200 | } 201 | Invoke(new Action(() => DisplayToTextBox($"[Time:{stopwatch.ElapsedMilliseconds}ms] Read: {result}"))); 202 | } 203 | 204 | private void btnRead_Click(object sender, EventArgs e) 205 | { 206 | Read(); 207 | } 208 | 209 | private bool Query() 210 | { 211 | bool isSuccessful = Write(); 212 | if (isSuccessful && !_isWritingError) Read(); 213 | return isSuccessful; 214 | } 215 | 216 | private void btnQuery_Click(object sender, EventArgs e) 217 | { 218 | Query(); 219 | } 220 | 221 | private bool NewPortInstance(out string message) 222 | { 223 | bool hasAddress = false; 224 | bool hasException = false; 225 | DoSomethingForRadioButton(out message, 226 | () => 227 | { 228 | string message1 = string.Empty; 229 | if (cboRS232.SelectedIndex == -1) return "没有串口选中"; 230 | try 231 | { 232 | bool successful = int.TryParse(cboBaudRate.Text.ToString(), out int baudRate); 233 | if (!successful) 234 | { 235 | throw new InvalidOperationException("指定的波特率无效"); 236 | } 237 | _portOperatorBase = new Rs232PortOperator(((Pair)cboRS232.SelectedItem).Value, 238 | baudRate, (SerialParity)cboParity.SelectedItem, 239 | (SerialStopBitsMode)cboStopBits.SelectedItem, (int)cboDataBits.SelectedItem); 240 | hasAddress = true; 241 | } 242 | catch(Exception e1) 243 | { 244 | 245 | hasException = true; 246 | message1 = e1.ToString(); 247 | } 248 | 249 | return message1; 250 | }, 251 | () => 252 | { 253 | string message2 = string.Empty; 254 | if (cboUSB.SelectedIndex == -1) return "没有USB选中"; 255 | try 256 | { 257 | _portOperatorBase = new UsbPortOperator(cboUSB.SelectedItem.ToString()); 258 | hasAddress = true; 259 | } 260 | catch(Exception e1) 261 | { 262 | hasException = true; 263 | message2 = e1.ToString(); 264 | } 265 | return message2; 266 | }, 267 | () => 268 | { 269 | string message3 = string.Empty; 270 | if (cboGPIB.SelectedIndex == -1) return "没有GPIB选中"; 271 | try 272 | { 273 | _portOperatorBase = new GpibPortOperator(cboGPIB.SelectedItem.ToString()); 274 | hasAddress = true; 275 | } 276 | catch(Exception e1) 277 | { 278 | hasException = true; 279 | message3 = e1.ToString(); 280 | } 281 | return message3; 282 | }, 283 | () => 284 | { 285 | string message4 = string.Empty; 286 | if (cboLAN.SelectedIndex == -1) return "没有LAN选中"; 287 | try 288 | { 289 | _portOperatorBase = new LanPortOperator(cboLAN.SelectedItem.ToString()); 290 | hasAddress = true; 291 | } 292 | catch(Exception e1) 293 | { 294 | hasException = true; 295 | message4 = e1.ToString(); 296 | } 297 | return message4; 298 | }); 299 | if(!hasException && hasAddress) _portOperatorBase.Timeout = (int)nudTimeout.Value; 300 | return hasAddress; 301 | } 302 | 303 | private void DisplayToTextBox(string content) 304 | { 305 | txtDisplay.Text += $@"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} {content}{Environment.NewLine}"; 306 | txtDisplay.SelectionStart = txtDisplay.Text.Length - 1; 307 | txtDisplay.ScrollToCaret(); 308 | } 309 | 310 | private void ClearIfTextBoxOverFlow() 311 | { 312 | if (txtDisplay.Text.Length > 204800) txtDisplay.Clear(); 313 | } 314 | 315 | private Task _task; 316 | 317 | private void btnRefresh_Click(object sender, EventArgs e) 318 | { 319 | string title = Text; 320 | _task = Task.Factory.StartNew(() => 321 | { 322 | InvokeToForm(() => { btnRefresh.Enabled = false; btnOpen.Enabled = false; Text = title + Resources.LoadingRS232; }); 323 | string[] content1 = PortHelper.FindAddresses(PortType.Rs232); 324 | string[] content2 = PortHelper.FindRs232Type(content1); 325 | List list1 = new List(); 326 | List list2 = new List(); 327 | for (int i = 0; i < content2.Length; i++) 328 | { 329 | if (content2[i].Contains("LPT")) continue; 330 | list1.Add(content1[i]); 331 | list2.Add(content2[i]); 332 | } 333 | content1 = list1.ToArray(); 334 | content2 = list2.ToArray(); 335 | var content3 = content1; 336 | InvokeToForm(() => cboRS232.ShowAndDisplay(content3, content2)); 337 | InvokeToForm(() => { Text = title + Resources.LoadingUSB; }); 338 | content1 = PortHelper.FindAddresses(PortType.Usb); 339 | var content4 = content1; 340 | InvokeToForm(() => cboUSB.ShowAndDisplay(content4)); 341 | InvokeToForm(() => { Text = title + Resources.LoadingGPIB; }); 342 | content1 = PortHelper.FindAddresses(PortType.Gpib); 343 | var content5 = content1; 344 | InvokeToForm(() => cboGPIB.ShowAndDisplay(content5)); 345 | InvokeToForm(() => { Text = title + Resources.LoadingLAN; }); 346 | content1 = PortHelper.FindAddresses(PortType.Lan); 347 | InvokeToForm(() => cboLAN.ShowAndDisplay(content1)); 348 | InvokeToForm(() => { btnRefresh.Enabled = true; btnOpen.Enabled = true; Text = title; }); 349 | }).ContinueWith(x=> 350 | { 351 | if(x.IsFaulted) 352 | { 353 | _cancelDisplayForm = true; 354 | InvokeToForm(() => { tableLayoutPanel.Enabled = false; this.Text = Resources.RuntimeError; }); 355 | if (x.Exception?.InnerException != null) MessageBox.Show(this, x.Exception.InnerException.Message); 356 | } 357 | }); 358 | } 359 | 360 | 361 | private void InvokeToForm(Action action) 362 | { 363 | try 364 | { 365 | this.Invoke(action); 366 | } 367 | catch (Exception ex) 368 | { 369 | Debug.WriteLine(ex); 370 | } 371 | } 372 | 373 | private void btnOpen_Click(object sender, EventArgs e) 374 | { 375 | if(btnOpen.Text == Resources.OpenString) 376 | { 377 | try 378 | { 379 | if (!NewPortInstance(out string message)) 380 | { 381 | MessageBox.Show(this, message); 382 | return; 383 | } 384 | _portOperatorBase.Open(); 385 | btnOpen.Text = Resources.CloseString; 386 | if (_portOperatorBase is Rs232PortOperator) 387 | { 388 | chkRealTimeReceive.Enabled = true; 389 | BindOrRemoveDataReceivedEvent(); 390 | } 391 | else 392 | { 393 | chkRealTimeReceive.Enabled = false; 394 | } 395 | 396 | EnableControl(false); 397 | chkStartCycle_CheckedChanged(null, null); 398 | } 399 | catch (Exception ex) 400 | { 401 | MessageBox.Show(this, ex.ToString()); 402 | } 403 | } 404 | else 405 | { 406 | if(CheckCycleEnable("关闭")) 407 | { 408 | return; 409 | } 410 | 411 | try 412 | { 413 | _portOperatorBase.Close(); 414 | } 415 | catch (Exception ex) 416 | { 417 | Debug.WriteLine(ex); 418 | } 419 | btnOpen.Text = Resources.OpenString; 420 | EnableControl(true); 421 | } 422 | } 423 | 424 | private void EnableControl(bool enable) 425 | { 426 | flowLayoutPanel1.Enabled = enable; 427 | flowLayoutPanel2.Enabled = enable; 428 | btnRefresh.Enabled = enable; 429 | flowLayoutPanel5.Enabled = enable; 430 | flowLayoutPanel7.Enabled = !enable; 431 | txtCommand.Enabled = !enable; 432 | if(enable) 433 | { 434 | btnWrite.Enabled = false; 435 | btnRead.Enabled = false; 436 | btnQuery.Enabled = false; 437 | btnCycle.Enabled = false; 438 | } 439 | 440 | lblOverTime.Enabled = enable; 441 | lblTimeout.Enabled = enable; 442 | nudTimeout.Enabled = enable; 443 | } 444 | 445 | private void 清除ToolStripMenuItem_Click(object sender, EventArgs e) 446 | { 447 | txtDisplay.Clear(); 448 | } 449 | 450 | private void contextMenuStrip_Opening(object sender, CancelEventArgs e) 451 | { 452 | EnableContextMenuStrip(txtDisplay.Text.Length != 0); 453 | } 454 | 455 | private void EnableContextMenuStrip(bool enable) 456 | { 457 | contextMenuStrip.Enabled = enable; 458 | } 459 | 460 | private void 全选ToolStripMenuItem_Click(object sender, EventArgs e) 461 | { 462 | txtDisplay.Focus(); 463 | txtDisplay.SelectAll(); 464 | } 465 | 466 | private void 复制ToolStripMenuItem_Click(object sender, EventArgs e) 467 | { 468 | Clipboard.SetText(txtDisplay.SelectedText); 469 | } 470 | 471 | private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) 472 | { 473 | if (CheckCycleEnable("关闭")) 474 | { 475 | e.Cancel = true; 476 | return; 477 | } 478 | 479 | if (_task != null && !_task.IsCompleted) 480 | { 481 | MessageBox.Show(this,Resources.LoadingInstrumentResource); 482 | e.Cancel = true; 483 | return; 484 | } 485 | _cts.Cancel(); 486 | try 487 | { 488 | _portOperatorBase?.Close(); 489 | } 490 | catch (Exception ex) 491 | { 492 | Debug.WriteLine(ex); 493 | } 494 | } 495 | 496 | private const string IpRegex = @"^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$"; 497 | private void btnCheckIP_Click(object sender, EventArgs e) 498 | { 499 | if (!txtIPAddress.Text.IsMatch(IpRegex)) 500 | { 501 | MessageBox.Show(this,Resources.NotCorrectIP); 502 | txtIPAddress.SetSelect(); 503 | return; 504 | } 505 | if (cboLAN.Items.Cast().Any(item => ((string)item).Contains(txtIPAddress.Text))) 506 | { 507 | MessageBox.Show(this,Resources.LANContainIP); 508 | txtIPAddress.SetSelect(); 509 | return; 510 | } 511 | if (!PortHelper.OpenIpAddress(txtIPAddress.Text, out string fullAddress)) 512 | { 513 | MessageBox.Show(this,Resources.NotDetectIP); 514 | txtIPAddress.SetSelect(); 515 | return; 516 | } 517 | cboLAN.Items.Add(fullAddress); 518 | cboLAN.Text = cboLAN.Items[cboLAN.Items.Count-1].ToString(); 519 | MessageBox.Show(this,Resources.DetectOK); 520 | } 521 | 522 | private void githubToolStripMenuItem1_Click(object sender, EventArgs e) 523 | { 524 | Process.Start(Resources.GithubURL); 525 | } 526 | 527 | private void blogToolStripMenuItem1_Click(object sender, EventArgs e) 528 | { 529 | Process.Start(Resources.BlogURL); 530 | } 531 | 532 | private void byCNXYToolStripMenuItem1_Click(object sender, EventArgs e) 533 | { 534 | Process.Start("mailto:cnc46@qq.com"); 535 | } 536 | 537 | private void 时间ToolStripMenuItem_Click(object sender, EventArgs e) 538 | { 539 | try 540 | { 541 | string system32 = Environment.GetFolderPath(Environment.SpecialFolder.System); 542 | Process.Start($@"{system32}\rundll32.exe", "shell32.dll,Control_RunDLL timedate.cpl,,0"); 543 | } 544 | catch (Exception ex) 545 | { 546 | Debug.WriteLine(ex); 547 | } 548 | } 549 | 550 | private void 全选ToolStripMenuItem1_Click(object sender, EventArgs e) 551 | { 552 | txtCommand.SelectAll(); 553 | } 554 | 555 | private void 复制ToolStripMenuItem1_Click(object sender, EventArgs e) 556 | { 557 | Clipboard.SetText(txtCommand.SelectedText); 558 | } 559 | 560 | private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e) 561 | { 562 | txtCommand.Text = Clipboard.GetText(); 563 | Clipboard.Clear(); 564 | } 565 | 566 | private void cmsCommand_Opening(object sender, CancelEventArgs e) 567 | { 568 | if(string.IsNullOrEmpty(txtCommand.Text.Trim())) 569 | { 570 | 全选ToolStripMenuItem1.Enabled = false; 571 | 复制ToolStripMenuItem1.Enabled = false; 572 | } 573 | else 574 | { 575 | 全选ToolStripMenuItem1.Enabled = true; 576 | 复制ToolStripMenuItem1.Enabled = !string.IsNullOrEmpty(txtCommand.SelectedText); 577 | } 578 | 579 | 粘贴ToolStripMenuItem.Enabled = !string.IsNullOrEmpty(Clipboard.GetText()); 580 | } 581 | 582 | private void rdoAsciiByte_CheckedChanged(object sender, EventArgs e) 583 | { 584 | _isAsciiCommand = rdoAscii.Checked; 585 | if (sender == rdoAscii && !rdoAscii.Checked) return; 586 | if(sender == rdoByte && !rdoByte.Checked) return; 587 | if (string.IsNullOrEmpty(txtCommand.Text)) return; 588 | bool isSuccessful = false; 589 | if (rdoAscii.Checked) 590 | { 591 | if (StringEx.TryParseByteStringToAsciiString(txtCommand.Text, out string asciiString)) 592 | { 593 | txtCommand.Text = asciiString; 594 | isSuccessful = true; 595 | } 596 | } 597 | else 598 | { 599 | 600 | if (StringEx.TryParseAsciiStringToByteString(txtCommand.Text, out string byteString)) 601 | { 602 | txtCommand.Text = byteString; 603 | isSuccessful = true; 604 | } 605 | } 606 | if(!isSuccessful) txtCommand.Clear(); 607 | } 608 | 609 | private void rdoUntilNewLineSpecifiedCount_CheckedChanged(object sender, EventArgs e) 610 | { 611 | if (_portOperatorBase is Rs232PortOperator portOperator) 612 | { 613 | if (rdoUntilNewLine.Checked) 614 | { 615 | portOperator.SetReadTerminationCharacterEnabled(true); 616 | } 617 | else 618 | { 619 | portOperator.SetReadTerminationCharacterEnabled(false); 620 | } 621 | } 622 | nudSpecifiedCount.Enabled = !rdoUntilNewLine.Checked; 623 | } 624 | 625 | private void toolStripMenuItem2_Click(object sender, EventArgs e) 626 | { 627 | string message = VisaInformation.VisaSharedComponent.Concat(VisaInformation.NiVisaRuntime).Aggregate((x, y) => $"{x}{Environment.NewLine}{y}").TrimEnd('\r', '\n'); 628 | MessageBox.Show(this,message); 629 | } 630 | 631 | private void chkStartCycle_CheckedChanged(object sender, EventArgs e) 632 | { 633 | if(!chkRealTimeReceive.Checked) 634 | { 635 | flowLayoutPanel10.Enabled = chkStartCycle.Checked; 636 | btnWrite.Enabled = !chkStartCycle.Checked; 637 | btnRead.Enabled = !chkStartCycle.Checked; 638 | btnQuery.Enabled = !chkStartCycle.Checked; 639 | btnCycle.Enabled = chkStartCycle.Checked; 640 | rdoUntilNewLine.Enabled = true; 641 | rdoSpecifiedCount.Enabled = true; 642 | rdoSendRead.Enabled = true; 643 | } 644 | else 645 | { 646 | btnRead.Enabled = false; 647 | btnQuery.Enabled = false; 648 | 649 | rdoUntilNewLine.Enabled = false; 650 | rdoSendRead.Enabled = false; 651 | rdoSpecifiedCount.Enabled = false; 652 | 653 | if (chkStartCycle.Checked) 654 | { 655 | rdoSend.Checked = true; 656 | rdoUntilNewLine.Checked = true; 657 | 658 | flowLayoutPanel10.Enabled = true; 659 | btnWrite.Enabled = false; 660 | btnCycle.Enabled = true; 661 | } 662 | else 663 | { 664 | flowLayoutPanel10.Enabled = false; 665 | btnWrite.Enabled = true; 666 | btnCycle.Enabled = false; 667 | } 668 | } 669 | } 670 | 671 | private void rdoSendRead_CheckedChanged(object sender, EventArgs e) 672 | { 673 | if (rdoSendRead.Checked) btnCycle.Text = @"循环发送读取"; 674 | } 675 | 676 | private void rdoSend_CheckedChanged(object sender, EventArgs e) 677 | { 678 | if (rdoSend.Checked) btnCycle.Text = @"循环发送"; 679 | } 680 | 681 | private void EnableCycle(bool enabled) 682 | { 683 | Invoke(new Action(() => 684 | { 685 | flowLayoutPanel9.Enabled = !enabled; 686 | groupBox1.Enabled = !enabled; 687 | groupBox2.Enabled = !enabled; 688 | txtCommand.Enabled = !enabled; 689 | })); 690 | _cycleEnabled = enabled; 691 | } 692 | 693 | private bool _cycleEnabled; 694 | private string _originalCycleText; 695 | private const string StopCycleText = "停止"; 696 | private void btnCycle_Click(object sender, EventArgs e) 697 | { 698 | if(btnCycle.Text == StopCycleText) 699 | { 700 | EnableCycle(false); 701 | btnCycle.Enabled = false; 702 | Task.Factory.StartNew(() => 703 | { 704 | while(btnCycle.Text == StopCycleText) 705 | { 706 | Thread.Sleep(100); 707 | } 708 | Invoke(new Action(() => btnCycle.Enabled = true)); 709 | }); 710 | } 711 | else 712 | { 713 | EnableCycle(true); 714 | _originalCycleText = btnCycle.Text; 715 | btnCycle.Text = StopCycleText; 716 | Task.Factory.StartNew(() => 717 | { 718 | int count = 0; 719 | int cycleCount = (int)nudCycleCount.Value; 720 | int intervalTime = (int)nudInterval.Value; 721 | while (_cycleEnabled) 722 | { 723 | if (cycleCount != 0 && count >= cycleCount) 724 | { 725 | EnableCycle(false); 726 | break; 727 | } 728 | bool isSuccessful = rdoSend.Checked ? Write() : Query(); 729 | if (!isSuccessful) 730 | { 731 | EnableCycle(false); 732 | break; 733 | } 734 | Thread.Sleep(intervalTime); 735 | if(cycleCount != 0) count++; 736 | } 737 | Invoke(new Action(() => btnCycle.Text = _originalCycleText)); 738 | }); 739 | } 740 | } 741 | 742 | private bool CheckCycleEnable(string operationName) 743 | { 744 | bool cycleEnabledTemp = _cycleEnabled; 745 | if (cycleEnabledTemp) 746 | { 747 | MessageBox.Show(this,$@"请停止循环操作后再执行{operationName}操作"); 748 | } 749 | return cycleEnabledTemp; 750 | } 751 | 752 | private void BindOrRemoveDataReceivedEvent() 753 | { 754 | if (_portOperatorBase is Rs232PortOperator portOperator) 755 | { 756 | if (chkRealTimeReceive.Checked) 757 | { 758 | portOperator.DataReceived += PortOperator_DataReceived; 759 | } 760 | else 761 | { 762 | portOperator.DataReceived -= PortOperator_DataReceived; 763 | } 764 | } 765 | } 766 | 767 | private void chkRealTimeReceive_CheckedChanged(object sender, EventArgs e) 768 | { 769 | chkStartCycle_CheckedChanged(null, null); 770 | BindOrRemoveDataReceivedEvent(); 771 | } 772 | 773 | private void PortOperator_DataReceived(object sender, SerialDataReceivedEventArgs e) 774 | { 775 | if(e.BytesToRead > 0) Read(false, e.BytesToRead); 776 | } 777 | } 778 | } -------------------------------------------------------------------------------- /VISAInstrument/FrmMain.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 175, 17 125 | 126 | 127 | 295, 17 128 | 129 | 130 | 131 | 132 | AAABAAEAPkAAAAEAIAAoQAAAFgAAACgAAAA+AAAAgAAAAAEAIAAAAAAAAD4AAF8jAABfIwAAAAAAAAAA 133 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 134 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 135 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 136 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 137 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 138 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAuVwAALlc 139 | AAC5XAAAuVwAALlcAAC5XAAAuVwAALlcAAC5XAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 140 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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f///z/gD4AB+AP/P8AHgAHwAf8/gAOAAeA 399 | B/z+AA8ABwAD/PwADwAPAAP8/AAPgB8AA/z8AA/gPwAD/PwAD+B/AAP8/AAP4H8AA/z8AAfgfgAD/P4A 400 | A+B8AAP8/gAB4HgAB/z/AAAAAAAH/P/AAAAAAB/8//8AAAAH//z//4AAAA///P//wAAAH//8///gAAA/ 401 | wDz//+AAAD+ADMAfwAAAPwAMgB/AAAA+AASAAAAAAAAABIAAAAAAAAAEgAAAAAAAAASAAAAAAAAABIAA 402 | AAAAAAAEgAAAAAAAAASAH8AAAD8ABMA/wAAAPwAM///gAAA/gAz//+AAAD/APP//wAAAH//8//+AAAAP 403 | //z//wAAAAf//P+AAAAAA//8/wAAAAgAH/z+AAHgfAAP/P4AA+B+AAf8/AAH4H8AB/z8AA/gf4AH/PwA 404 | D+B/gAf8/AAPwD+AB/z8AA+AD4AH/PwADwAPgAf8/gAPAAfAB/z+AA4AB8AP/P8AHgAH8B/8/4B+AAf/ 405 | //z///4AB////P///gAH///8///+AAf///z///4AB////P///wAH///8////gA////z////AH////P// 406 | ///////8 407 | 408 | 409 | -------------------------------------------------------------------------------- /VISAInstrument/Ports/GpibPortOperator.cs: -------------------------------------------------------------------------------- 1 | using NationalInstruments.Visa; 2 | using System; 3 | using VISAInstrument.Utility; 4 | 5 | namespace VISAInstrument.Ports 6 | { 7 | internal class GpibPortOperator : PortOperatorBase, IPortType 8 | { 9 | public GpibPortOperator(string address) : base(new GpibSession(address), address) 10 | { 11 | if (!address.ToUpper().Contains("GPIB")) 12 | throw new ArgumentException($"该地址不含GPIB字样"); 13 | } 14 | public PortType PortType => PortType.Gpib; 15 | } 16 | } -------------------------------------------------------------------------------- /VISAInstrument/Ports/IPortOperator.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Ports 2 | { 3 | internal interface IPortOperator 4 | { 5 | void Open(); 6 | void Close(); 7 | void Write(string command); 8 | string Read(); 9 | } 10 | } -------------------------------------------------------------------------------- /VISAInstrument/Ports/IPortType.cs: -------------------------------------------------------------------------------- 1 | using VISAInstrument.Utility; 2 | 3 | namespace VISAInstrument.Ports 4 | { 5 | internal interface IPortType 6 | { 7 | PortType PortType { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /VISAInstrument/Ports/LanPortOperator.cs: -------------------------------------------------------------------------------- 1 | using NationalInstruments.Visa; 2 | using System; 3 | using VISAInstrument.Utility; 4 | 5 | namespace VISAInstrument.Ports 6 | { 7 | internal class LanPortOperator : PortOperatorBase, IPortType 8 | { 9 | public LanPortOperator(string address) : base(new TcpipSession(address), address) 10 | { 11 | if (!address.ToUpper().Contains("TCPIP")) 12 | throw new ArgumentException($"该地址不含TCPIP字样"); 13 | } 14 | public PortType PortType => PortType.Lan; 15 | } 16 | } -------------------------------------------------------------------------------- /VISAInstrument/Ports/PortEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VISAInstrument.Ports 4 | { 5 | internal class PortEventArgs : EventArgs 6 | { 7 | public string Address { get; } 8 | public bool Cancel { set; get; } 9 | public PortEventArgs(string address) 10 | { 11 | Address = address; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /VISAInstrument/Ports/PortOperatorBase.cs: -------------------------------------------------------------------------------- 1 | using Ivi.Visa; 2 | using System; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace VISAInstrument.Ports 7 | { 8 | internal abstract class PortOperatorBase : IPortOperator 9 | { 10 | public string Address { set; get; } 11 | 12 | protected PortOperatorBase(IMessageBasedSession session) 13 | { 14 | Session = session; 15 | } 16 | 17 | protected PortOperatorBase(IMessageBasedSession session, string address) : this(session) 18 | { 19 | Address = address; 20 | } 21 | 22 | public int Timeout { set; get; } = 2000; 23 | 24 | public event EventHandler PortOpening; 25 | 26 | public event EventHandler PortClosing; 27 | 28 | protected virtual void OnPortOpening(PortEventArgs e) 29 | { 30 | PortOpening?.Invoke(this, e); 31 | } 32 | 33 | protected virtual void OnPortClosing(PortEventArgs e) 34 | { 35 | PortClosing?.Invoke(this, e); 36 | } 37 | 38 | public bool IsPortOpen { private set; get; } 39 | 40 | protected IMessageBasedSession Session { get; } 41 | 42 | public virtual void Open() 43 | { 44 | PortEventArgs e = new PortEventArgs(Address); 45 | OnPortOpening(e); 46 | if (e.Cancel) return; 47 | Session.TimeoutMilliseconds = Timeout; 48 | this.IsPortOpen = true; 49 | } 50 | 51 | public virtual void Close() 52 | { 53 | PortEventArgs e = new PortEventArgs(Address); 54 | OnPortClosing(e); 55 | if (e.Cancel) return; 56 | Session.Dispose(); 57 | this.IsPortOpen = false; 58 | } 59 | 60 | public virtual void Write(string command) 61 | { 62 | Session.RawIO.Write(command); 63 | } 64 | 65 | public virtual void Write(byte[] command) 66 | { 67 | Session.RawIO.Write(command); 68 | } 69 | 70 | public virtual void WriteLine(byte[] command) 71 | { 72 | Session.RawIO.Write(command.Concat(new byte[] { 0x0A }).ToArray()); 73 | } 74 | 75 | public virtual void WriteLine(string command) 76 | { 77 | Write($"{command}\n"); 78 | } 79 | 80 | public byte[] ReadToBytes() 81 | { 82 | return Session.RawIO.Read(); 83 | } 84 | 85 | public byte[] ReadToBytes(int count) 86 | { 87 | return Session.RawIO.Read(count); 88 | } 89 | 90 | public string Read() 91 | { 92 | return Encoding.ASCII.GetString(Session.RawIO.Read()); 93 | } 94 | 95 | public string Read(int count) 96 | { 97 | return Encoding.ASCII.GetString(Session.RawIO.Read(count)); 98 | } 99 | 100 | public string ReadLine() 101 | { 102 | string result = Read(); 103 | return result.EndsWith("\n") ? result.TrimEnd(new char[] { '\n' }) : result; 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /VISAInstrument/Ports/SerialDataReceivedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VISAInstrument.Ports 4 | { 5 | public class SerialDataReceivedEventArgs:EventArgs 6 | { 7 | public int BytesToRead { get; } 8 | public SerialDataReceivedEventArgs(int bytesToRead) 9 | { 10 | BytesToRead = bytesToRead; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /VISAInstrument/Ports/UsbPortOperator.cs: -------------------------------------------------------------------------------- 1 | using NationalInstruments.Visa; 2 | using System; 3 | using VISAInstrument.Utility; 4 | 5 | namespace VISAInstrument.Ports 6 | { 7 | internal class UsbPortOperator : PortOperatorBase, IPortType 8 | { 9 | public UsbPortOperator(string address) : base(new UsbSession(address), address) 10 | { 11 | if (!address.ToUpper().Contains("USB")) 12 | throw new ArgumentException("该地址不含USB字样"); 13 | } 14 | public PortType PortType => PortType.Usb; 15 | } 16 | } -------------------------------------------------------------------------------- /VISAInstrument/Ports/VISAInstrument.Port.cs: -------------------------------------------------------------------------------- 1 | using Ivi.Visa; 2 | using NationalInstruments.Visa; 3 | using System; 4 | using VISAInstrument.Utility; 5 | 6 | namespace VISAInstrument.Ports 7 | { 8 | internal class Rs232PortOperator : PortOperatorBase, IPortType 9 | { 10 | public int BaudRate { get; } 11 | 12 | public SerialParity Parity { get; } 13 | 14 | public SerialStopBitsMode StopBits { get; } 15 | 16 | public int DataBits { get; } 17 | 18 | public PortType PortType => PortType.Rs232; 19 | 20 | public SerialFlowControlModes FlowControl { set; get; } = SerialFlowControlModes.None; 21 | 22 | private readonly SerialSession _serialSession; 23 | 24 | 25 | private EventHandler _dataReceived; 26 | 27 | public event EventHandler DataReceived 28 | { 29 | add 30 | { 31 | _serialSession.AnyCharacterReceived += SerialSession_AnyCharacterReceived; 32 | _dataReceived += value; 33 | } 34 | remove 35 | { 36 | _serialSession.AnyCharacterReceived -= SerialSession_AnyCharacterReceived; 37 | _dataReceived -= value; 38 | } 39 | } 40 | 41 | private void SerialSession_AnyCharacterReceived(object sender, VisaEventArgs e) 42 | { 43 | OnDataReceived(new SerialDataReceivedEventArgs(_serialSession.BytesAvailable)); 44 | } 45 | 46 | protected virtual void OnDataReceived(SerialDataReceivedEventArgs e) 47 | { 48 | _dataReceived?.Invoke(this, e); 49 | } 50 | 51 | public Rs232PortOperator(string address, int baudRate, SerialParity parity, SerialStopBitsMode stopBits, int dataBits) : base(new SerialSession(address), address) 52 | { 53 | if (!address.ToUpper().Contains("ASRL")) throw new ArgumentException($"该地址不含ASRL字样"); 54 | BaudRate = baudRate; 55 | Parity = parity; 56 | StopBits = stopBits; 57 | if (dataBits < 5 || dataBits > 8) throw new NotSupportedException($"不支持数据位为:{dataBits.ToString()}"); 58 | DataBits = dataBits; 59 | _serialSession = (SerialSession)Session; 60 | } 61 | 62 | public void SetReadTerminationCharacterEnabled(bool enabled) 63 | { 64 | _serialSession.ReadTermination = enabled ? SerialTerminationMethod.TerminationCharacter : SerialTerminationMethod.None; 65 | } 66 | 67 | public override void Open() 68 | { 69 | base.Open(); 70 | _serialSession.BaudRate = BaudRate; 71 | switch (Parity) 72 | { 73 | case SerialParity.None: 74 | _serialSession.Parity = SerialParity.None; break; 75 | case SerialParity.Odd: 76 | _serialSession.Parity = SerialParity.Odd; break; 77 | case SerialParity.Even: 78 | _serialSession.Parity = SerialParity.Even; break; 79 | case SerialParity.Mark: 80 | _serialSession.Parity = SerialParity.Mark; break; 81 | case SerialParity.Space: 82 | _serialSession.Parity = SerialParity.Space; break; 83 | default: 84 | throw new ArgumentOutOfRangeException(); 85 | } 86 | switch (StopBits) 87 | { 88 | case SerialStopBitsMode.One: 89 | _serialSession.StopBits = SerialStopBitsMode.One; break; 90 | case SerialStopBitsMode.OneAndOneHalf: 91 | _serialSession.StopBits = SerialStopBitsMode.OneAndOneHalf; break; 92 | case SerialStopBitsMode.Two: 93 | _serialSession.StopBits = SerialStopBitsMode.Two; break; 94 | default: 95 | throw new ArgumentOutOfRangeException(); 96 | } 97 | _serialSession.DataBits = (short)DataBits; 98 | switch (FlowControl) 99 | { 100 | case SerialFlowControlModes.None: 101 | _serialSession.FlowControl = SerialFlowControlModes.None; break; 102 | case SerialFlowControlModes.XOnXOff: 103 | _serialSession.FlowControl = SerialFlowControlModes.XOnXOff; break; 104 | case SerialFlowControlModes.RtsCts: 105 | _serialSession.FlowControl = SerialFlowControlModes.RtsCts; break; 106 | case SerialFlowControlModes.DtrDsr: 107 | _serialSession.FlowControl = SerialFlowControlModes.DtrDsr; break; 108 | default: 109 | throw new ArgumentOutOfRangeException(); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /VISAInstrument/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Windows.Forms; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using Ivi.Visa.ConflictManager; 8 | using VISAInstrument.Configuration; 9 | using VISAInstrument.Properties; 10 | using VISAInstrument.Utility; 11 | 12 | namespace VISAInstrument 13 | { 14 | internal static class Program 15 | { 16 | [STAThread] 17 | private static void Main() 18 | { 19 | Application.EnableVisualStyles(); 20 | Application.SetCompatibleTextRenderingDefault(false); 21 | using (new Mutex(false, Resources.MutexName, out bool result)) 22 | { 23 | if (!result) 24 | { 25 | MessageBox.Show(Resources.Running); 26 | return; 27 | } 28 | } 29 | if (!IsVisaExisted(out string message, out string[] visaSharedComponent, out string[] niVisaRuntime)) 30 | { 31 | if (MessageBox.Show($@"{message}{Environment.NewLine}{Environment.NewLine}{Resources.NeedToDownLoad}", @"错误", 32 | MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes) return; 33 | try 34 | { 35 | string url = GetVisaUrl(); 36 | if (!string.IsNullOrEmpty(url)) 37 | { 38 | Process.Start(url); 39 | } 40 | } 41 | catch (Exception ex) 42 | { 43 | MessageBox.Show(ex.Message); 44 | } 45 | return; 46 | } 47 | VisaInformation.VisaSharedComponent = visaSharedComponent; 48 | VisaInformation.NiVisaRuntime = niVisaRuntime; 49 | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; 50 | Application.Run(new FrmMain()); 51 | } 52 | 53 | private static string GetVisaUrl() 54 | { 55 | Version version = Environment.OSVersion.Version; 56 | if (version.Major == 5) 57 | { 58 | return Resources.VISA32URLXP; 59 | } 60 | return version.Major >= 6 ? Resources.VISA32URLWIN7 : string.Empty; 61 | } 62 | 63 | private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 64 | { 65 | Exception ex = (Exception)e.ExceptionObject; 66 | if (ex is DllNotFoundException) 67 | { 68 | DialogResult result = MessageBox.Show($@"{Resources.VISA32Error}{Environment.NewLine}{Environment.NewLine}{Resources.VISADownLoad}", Resources.RuntimeError, MessageBoxButtons.YesNo, MessageBoxIcon.Information); 69 | 70 | if (result == DialogResult.Yes) 71 | { 72 | 73 | string url = GetVisaUrl(); 74 | if (!string.IsNullOrEmpty(url)) 75 | { 76 | Process.Start(url); 77 | } 78 | } 79 | } 80 | else 81 | { 82 | MessageBox.Show(ex.Message); 83 | } 84 | 85 | Environment.Exit(1); 86 | } 87 | 88 | private static bool IsVisaExisted(out string message, out string[] visaSharedComponent, out string[] niVisaRuntime) 89 | { 90 | const string visaSharedComponentsString = "VISA Shared Components"; 91 | const string niVisaRuntimeString = "NI-VISA .NET Runtime"; 92 | const string visaSharedComponentsVersion = "5.6.0.0"; 93 | const string niVisaRuntimeVersion = "15.5.0.0"; 94 | const string noneVersion = "0.0.0.0"; 95 | UninstallInfo[] visaUninstallInfo = UninstallInfoHelper.GetUninstallInfo().Where(x => !string.IsNullOrEmpty(x.DisplayName)).ToArray(); 96 | UninstallInfo[] iviVisaUninstallInfo = visaUninstallInfo.Where(x => x.DisplayName.StartsWith(visaSharedComponentsString)).ToArray(); 97 | visaSharedComponent = iviVisaUninstallInfo.Select(x => x.ToString()).ToArray(); 98 | niVisaRuntime = Array.Empty(); 99 | string GetFullVersion(string version) 100 | { 101 | string newVersion = version; 102 | try 103 | { 104 | Version versionTemp = new Version(version); 105 | if (versionTemp.Build == -1) 106 | { 107 | newVersion += ".0"; 108 | } 109 | if (versionTemp.Revision == -1) 110 | { 111 | newVersion += ".0"; 112 | } 113 | return newVersion; 114 | } 115 | catch 116 | { 117 | return noneVersion; 118 | } 119 | } 120 | message = string.Empty; 121 | if (!iviVisaUninstallInfo.Any(x => 122 | !string.IsNullOrEmpty(x.DisplayVersion) && 123 | new Version(GetFullVersion(x.DisplayVersion)) >= new Version(visaSharedComponentsVersion))) 124 | { 125 | string versions = string.Empty; 126 | if (iviVisaUninstallInfo.Any()) 127 | { 128 | versions = iviVisaUninstallInfo.Where(x => !string.IsNullOrEmpty(x.DisplayVersion)).Aggregate("", (m, n) => $"{m}/{n.DisplayVersion}").Trim('/'); 129 | } 130 | message = !string.IsNullOrEmpty(versions) ? $"{visaSharedComponentsString}目前版本为{versions},小于其最小版本({visaSharedComponentsVersion})" : $"必须安装{visaSharedComponentsString},且版本必须大于最小版本({visaSharedComponentsVersion})"; 131 | return false; 132 | } 133 | 134 | ConflictManager manager = new ConflictManager(); 135 | try 136 | { 137 | List results = manager.GetInstalledVisas(ApiType.DotNet); 138 | if (results.Count <= 0) 139 | { 140 | message = "系统没有安装.NET版本的VISA"; 141 | return false; 142 | } 143 | 144 | VisaImplementation implementation = 145 | results.FirstOrDefault(x => x.ResourceManufacturerId == 4086); 146 | if (implementation == null) 147 | { 148 | message = $"系统没有安装{niVisaRuntimeString}"; 149 | return false; 150 | } 151 | 152 | UninstallInfo[] niVisaUninstallInfo = visaUninstallInfo.Where(x => x.DisplayName.StartsWith(niVisaRuntimeString)).ToArray(); 153 | niVisaRuntime = niVisaUninstallInfo.Select(x => x.ToString()).ToArray(); 154 | if (!niVisaUninstallInfo.Any(x => 155 | !string.IsNullOrEmpty(x.DisplayVersion) && 156 | new Version(GetFullVersion(x.DisplayVersion)) >= new Version(niVisaRuntimeVersion))) 157 | { 158 | string versions = string.Empty; 159 | if (niVisaUninstallInfo.Any()) 160 | { 161 | versions = niVisaUninstallInfo.Where(x => !string.IsNullOrEmpty(x.DisplayVersion)).Aggregate("", (m, n) => $"{m}/{n.DisplayVersion}").Trim('/'); 162 | } 163 | 164 | message = !string.IsNullOrEmpty(versions) ? $"{niVisaRuntimeString}目前版本为{versions},小于其最小版本({niVisaRuntimeVersion})" : $"必须安装{niVisaRuntimeString},且版本必须大于最小版本({niVisaRuntimeVersion})"; 165 | return false; 166 | } 167 | if (!implementation.Enabled) manager.SetPreferredVisa(implementation); 168 | return true; 169 | } 170 | catch (Exception e) 171 | { 172 | message = e.Message; 173 | return false; 174 | } 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /VISAInstrument/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("VISAInstrument")] 9 | [assembly: AssemblyDescription("基于NI-VISA接口(GPIB、USB、串口、LAN等)的通信连接")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("by CNXY")] 12 | [assembly: AssemblyProduct("VISAInstrument")] 13 | [assembly: AssemblyCopyright("Copyright © CNXY 2022")] 14 | [assembly: AssemblyTrademark("CNXY")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("7fa82266-0999-4572-ad46-aa79ed2e9cac")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.3.0.6")] 36 | [assembly: AssemblyFileVersion("1.3.0.6")] 37 | -------------------------------------------------------------------------------- /VISAInstrument/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace VISAInstrument.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VISAInstrument.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性,对 51 | /// 使用此强类型资源类的所有资源查找执行重写。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// 查找类似 https://cncc.cnblogs.com 的本地化字符串。 65 | /// 66 | internal static string BlogURL { 67 | get { 68 | return ResourceManager.GetString("BlogURL", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// 查找类似 关闭 的本地化字符串。 74 | /// 75 | internal static string CloseString { 76 | get { 77 | return ResourceManager.GetString("CloseString", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// 查找类似 命令不能为空! 的本地化字符串。 83 | /// 84 | internal static string CommandNotEmpty { 85 | get { 86 | return ResourceManager.GetString("CommandNotEmpty", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// 查找类似 检测成功! 的本地化字符串。 92 | /// 93 | internal static string DetectOK { 94 | get { 95 | return ResourceManager.GetString("DetectOK", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// 查找类似 https://github.com/cnxy/VISAInstrument 的本地化字符串。 101 | /// 102 | internal static string GithubURL { 103 | get { 104 | return ResourceManager.GetString("GithubURL", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// 查找类似 LAN地址已经包含该IP,请重新输入! 的本地化字符串。 110 | /// 111 | internal static string LANContainIP { 112 | get { 113 | return ResourceManager.GetString("LANContainIP", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// 查找类似 【正在加载GPIB资源中...请稍候...】 的本地化字符串。 119 | /// 120 | internal static string LoadingGPIB { 121 | get { 122 | return ResourceManager.GetString("LoadingGPIB", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// 查找类似 正在加载仪器资源,请等待加载完毕后再关闭此程序! 的本地化字符串。 128 | /// 129 | internal static string LoadingInstrumentResource { 130 | get { 131 | return ResourceManager.GetString("LoadingInstrumentResource", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// 查找类似 【正在加载LAN资源中...请稍候...】 的本地化字符串。 137 | /// 138 | internal static string LoadingLAN { 139 | get { 140 | return ResourceManager.GetString("LoadingLAN", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// 查找类似 【正在加载RS232资源中...请稍候...】 的本地化字符串。 146 | /// 147 | internal static string LoadingRS232 { 148 | get { 149 | return ResourceManager.GetString("LoadingRS232", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// 查找类似 【正在加载USB资源中...请稍候...】 的本地化字符串。 155 | /// 156 | internal static string LoadingUSB { 157 | get { 158 | return ResourceManager.GetString("LoadingUSB", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// 查找类似 VISAInstrument 的本地化字符串。 164 | /// 165 | internal static string MutexName { 166 | get { 167 | return ResourceManager.GetString("MutexName", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// 查找类似 是否需要下载与VISA相关的运行时软件? 的本地化字符串。 173 | /// 174 | internal static string NeedToDownLoad { 175 | get { 176 | return ResourceManager.GetString("NeedToDownLoad", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// 查找类似 不是正确的IP地址,请重新输入! 的本地化字符串。 182 | /// 183 | internal static string NotCorrectIP { 184 | get { 185 | return ResourceManager.GetString("NotCorrectIP", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// 查找类似 没有检测到有效的仪器IP地址,请重新输入! 的本地化字符串。 191 | /// 192 | internal static string NotDetectIP { 193 | get { 194 | return ResourceManager.GetString("NotDetectIP", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// 查找类似 打开 的本地化字符串。 200 | /// 201 | internal static string OpenString { 202 | get { 203 | return ResourceManager.GetString("OpenString", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// 查找类似 读取时间超时 的本地化字符串。 209 | /// 210 | internal static string ReadTimeout { 211 | get { 212 | return ResourceManager.GetString("ReadTimeout", resourceCulture); 213 | } 214 | } 215 | 216 | /// 217 | /// 查找类似 程序已经在运行! 的本地化字符串。 218 | /// 219 | internal static string Running { 220 | get { 221 | return ResourceManager.GetString("Running", resourceCulture); 222 | } 223 | } 224 | 225 | /// 226 | /// 查找类似 运行时错误 的本地化字符串。 227 | /// 228 | internal static string RuntimeError { 229 | get { 230 | return ResourceManager.GetString("RuntimeError", resourceCulture); 231 | } 232 | } 233 | 234 | /// 235 | /// 查找类似 加载VISA32错误,请保证已经安装VISA32运行时! 的本地化字符串。 236 | /// 237 | internal static string VISA32Error { 238 | get { 239 | return ResourceManager.GetString("VISA32Error", resourceCulture); 240 | } 241 | } 242 | 243 | /// 244 | /// 查找类似 https://download.ni.com/support/softlib/visa/NI-VISA/18.5/Windows/NIVISA1850runtime.zip 的本地化字符串。 245 | /// 246 | internal static string VISA32URLWIN7 { 247 | get { 248 | return ResourceManager.GetString("VISA32URLWIN7", resourceCulture); 249 | } 250 | } 251 | 252 | /// 253 | /// 查找类似 https://download.ni.com/support/softlib/visa/NI-VISA/15.5/Windows/NIVISA1550runtime.zip 的本地化字符串。 254 | /// 255 | internal static string VISA32URLXP { 256 | get { 257 | return ResourceManager.GetString("VISA32URLXP", resourceCulture); 258 | } 259 | } 260 | 261 | /// 262 | /// 查找类似 点击“是”从弹出的网址进行下载并安装。 的本地化字符串。 263 | /// 264 | internal static string VISADownLoad { 265 | get { 266 | return ResourceManager.GetString("VISADownLoad", resourceCulture); 267 | } 268 | } 269 | } 270 | } 271 | -------------------------------------------------------------------------------- /VISAInstrument/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | https://cncc.cnblogs.com 122 | 123 | 124 | 关闭 125 | 126 | 127 | 命令不能为空! 128 | 129 | 130 | 检测成功! 131 | 132 | 133 | https://github.com/cnxy/VISAInstrument 134 | 135 | 136 | LAN地址已经包含该IP,请重新输入! 137 | 138 | 139 | 【正在加载GPIB资源中...请稍候...】 140 | 141 | 142 | 正在加载仪器资源,请等待加载完毕后再关闭此程序! 143 | 144 | 145 | 【正在加载LAN资源中...请稍候...】 146 | 147 | 148 | 【正在加载RS232资源中...请稍候...】 149 | 150 | 151 | 【正在加载USB资源中...请稍候...】 152 | 153 | 154 | VISAInstrument 155 | 156 | 157 | 是否需要下载与VISA相关的运行时软件? 158 | 159 | 160 | 不是正确的IP地址,请重新输入! 161 | 162 | 163 | 没有检测到有效的仪器IP地址,请重新输入! 164 | 165 | 166 | 打开 167 | 168 | 169 | 读取时间超时 170 | 171 | 172 | 程序已经在运行! 173 | 174 | 175 | 运行时错误 176 | 177 | 178 | 加载VISA32错误,请保证已经安装VISA32运行时! 179 | 180 | 181 | https://download.ni.com/support/softlib/visa/NI-VISA/18.5/Windows/NIVISA1850runtime.zip 182 | 183 | 184 | https://download.ni.com/support/softlib/visa/NI-VISA/15.5/Windows/NIVISA1550runtime.zip 185 | 186 | 187 | 点击“是”从弹出的网址进行下载并安装。 188 | 189 | -------------------------------------------------------------------------------- /VISAInstrument/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace VISAInstrument.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /VISAInstrument/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/ByteEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VISAInstrument.Utility.Extension 4 | { 5 | internal static class ByteEx 6 | { 7 | public static bool TryParseByteToByteString(byte[] bytes, out string byteString) 8 | { 9 | byteString = string.Empty; 10 | try 11 | { 12 | byteString = BitConverter.ToString(bytes).Replace("-", " "); 13 | return true; 14 | } 15 | catch 16 | { 17 | return false; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/RegexEx.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | 3 | namespace VISAInstrument.Utility.Extension 4 | { 5 | public static class RegexEx 6 | { 7 | public static bool IsMatch(this string input,string pattern) 8 | { 9 | return Regex.IsMatch(input, pattern); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/StringEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace VISAInstrument.Utility.Extension 5 | { 6 | internal static class StringEx 7 | { 8 | public static bool TryParseByteStringToAsciiString(string byteString, out string asciiString) 9 | { 10 | asciiString = string.Empty; 11 | try 12 | { 13 | string[] byteStrings = byteString.Trim(' ').Split(' '); 14 | char[] charValues = byteStrings.Select(x => (char)Convert.ToByte(x, 16)).ToArray(); 15 | asciiString = new string(charValues); 16 | return true; 17 | } 18 | catch 19 | { 20 | return false; 21 | } 22 | } 23 | public static bool TryParseAsciiStringToByteString(string asciiString, out string byteString) 24 | { 25 | byteString = string.Empty; 26 | try 27 | { 28 | byte[] byteValues = asciiString.Select(x => (byte)x).ToArray(); 29 | byteString = BitConverter.ToString(byteValues).Replace("-", " "); 30 | return true; 31 | } 32 | catch 33 | { 34 | return false; 35 | } 36 | } 37 | public static bool TryParseByteStringToByte(string byteString, out byte[] bytes) 38 | { 39 | bytes = null; 40 | try 41 | { 42 | string[] byteStrings = byteString.Trim(' ').Split(' '); 43 | bytes = byteStrings.Select(x => Convert.ToByte(x, 16)).ToArray(); 44 | return true; 45 | } 46 | catch 47 | { 48 | return false; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/UI/ComboBoxEx.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Windows.Forms; 3 | 4 | namespace VISAInstrument.Utility.Extension.UI 5 | { 6 | internal static class ComboBoxEx 7 | { 8 | public static void SetItems(this ComboBox comboBox, params object[] content) 9 | { 10 | comboBox.Items.AddRange(content); 11 | } 12 | 13 | public static void SetItems(this ComboBox comboBox, TValue[] values, TDisplay[] displays) 14 | { 15 | PairCollection pc = new PairCollection(); 16 | pc.AddRange(values, displays); 17 | comboBox.DataSource = pc.DataList; 18 | comboBox.ValueMember = Pair.ValueName; 19 | comboBox.DisplayMember = Pair.DisplayName; 20 | } 21 | 22 | public static void ClearItems(this ComboBox comboBox) 23 | { 24 | comboBox.DataSource = null; 25 | comboBox.Items.Clear(); 26 | } 27 | 28 | public static void SetFirstItem(this ComboBox comboBox) 29 | { 30 | if (comboBox.Items.Count != 0) 31 | comboBox.Text = comboBox.Items[0].ToString(); 32 | } 33 | public static void SetFirstItem(this ComboBox comboBox) 34 | { 35 | if (comboBox.Items.Count == 0) return; 36 | string item = ((Pair)comboBox.Items[0]).Display.ToString(); 37 | comboBox.Text = !string.IsNullOrEmpty(item) ? item : ((Pair)comboBox.Items[comboBox.Items.Count - 1]).Display.ToString(); 38 | 39 | } 40 | 41 | public static void ShowAndDisplay(this ComboBox comboBox, params string[] content) 42 | { 43 | comboBox.ClearItems(); 44 | comboBox.SetItems(content.Select(x=>(object)x).ToArray()); 45 | comboBox.SetFirstItem(); 46 | } 47 | 48 | public static void ShowAndDisplay(this ComboBox comboBox, TValue[] values, TDisplay[] displays) 49 | { 50 | comboBox.ClearItems(); 51 | comboBox.SetItems(values, displays); 52 | comboBox.SetFirstItem(); 53 | } 54 | 55 | public static void AddItem(this ComboBox comboBox, string content) 56 | { 57 | if (comboBox.Items.Cast().Any(item => (string)item == content)) 58 | { 59 | return; 60 | } 61 | string[] commands = (string[])comboBox.DataSource; 62 | commands = commands.Concat(new[] { content }).ToArray(); 63 | comboBox.DataSource = commands; 64 | comboBox.Text = content; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/UI/Pair.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Utility.Extension.UI 2 | { 3 | internal class Pair 4 | { 5 | public static string ValueName => "Value"; 6 | public static string DisplayName => "Display"; 7 | } 8 | } -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/UI/Pair2.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Utility.Extension.UI 2 | { 3 | internal class Pair : Pair 4 | { 5 | public Pair() { } 6 | 7 | public Pair(TValue value, TDisplay display) 8 | { 9 | this.Value = value; 10 | this.Display = display; 11 | } 12 | 13 | public TValue Value { set; get; } 14 | public TDisplay Display { set; get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/UI/PairCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace VISAInstrument.Utility.Extension.UI 5 | { 6 | internal class PairCollection 7 | { 8 | public PairCollection() 9 | { 10 | DataList = new List>(); 11 | } 12 | 13 | public Pair this[int index] => DataList[index]; 14 | 15 | public void Add(TValue value, TDisplay display) 16 | { 17 | DataList.Add(new Pair() { Value = value, Display = display }); 18 | } 19 | 20 | public void AddRange(TValue[] values, TDisplay[] displays) 21 | { 22 | if (values.Length != displays.Length) throw new ArgumentException("参数长度必须相等"); 23 | for (int i = 0; i < values.Length; i++) 24 | { 25 | Add(values[i], displays[i]); 26 | } 27 | } 28 | 29 | public List> DataList { get; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/Extension/UI/TextBoxEx.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace VISAInstrument.Utility.Extension.UI 4 | { 5 | static class TextBoxEx 6 | { 7 | public static void SetSelect(this TextBoxBase textBox) 8 | { 9 | textBox.Focus(); 10 | textBox.SelectAll(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/PortHelper.cs: -------------------------------------------------------------------------------- 1 | using Ivi.Visa; 2 | using NationalInstruments.Visa; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | 8 | namespace VISAInstrument.Utility 9 | { 10 | internal class PortHelper 11 | { 12 | private static string ToStringFromPortType(PortType portType) 13 | { 14 | switch (portType) 15 | { 16 | case PortType.Usb: return "USB"; 17 | case PortType.Gpib: return "GPIB"; 18 | case PortType.Lan: return "TCPIP"; 19 | case PortType.None:return ""; 20 | case PortType.Rs232: 21 | default: return "ASRL"; 22 | } 23 | } 24 | 25 | public static string[] FindAddresses(PortType portType) 26 | { 27 | IEnumerable result = new List(); 28 | try 29 | { 30 | ResourceManager manager = new ResourceManager(); 31 | result = manager.Find($"{ToStringFromPortType(portType)}?*INSTR"); 32 | }catch(Exception ex) 33 | { 34 | if (!(ex is NativeVisaException)) 35 | { 36 | if (ex.InnerException != null) throw ex.InnerException; 37 | throw; 38 | } 39 | } 40 | 41 | return result.ToArray().Where(n=>!n.Contains("//")).ToArray(); 42 | } 43 | 44 | public static string[] FindRs232Type(string[] addresses) 45 | { 46 | List list = new List(); 47 | foreach (var address in addresses) 48 | { 49 | try 50 | { 51 | ResourceManager manager = new ResourceManager(); 52 | ParseResult result = manager.Parse(address); 53 | list.Add(result.AliasIfExists); 54 | } 55 | catch 56 | { 57 | list.Add(address); 58 | } 59 | } 60 | return list.ToArray(); 61 | } 62 | 63 | public static bool OpenIpAddress(string address,out string fullAddress) 64 | { 65 | bool result = false; 66 | string addressTemp = $"TCPIP0::{address}::INSTR"; 67 | fullAddress = addressTemp; 68 | try 69 | { 70 | using (new TcpipSession(addressTemp)) 71 | { 72 | result = true; 73 | } 74 | } 75 | catch (Exception ex) 76 | { 77 | Debug.WriteLine(ex); 78 | } 79 | return result; 80 | } 81 | 82 | public static string[] FindAddresses() 83 | { 84 | return FindAddresses(PortType.None); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/PortType.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Utility 2 | { 3 | internal enum PortType 4 | { 5 | Rs232, Usb, Gpib, Lan, None 6 | } 7 | } -------------------------------------------------------------------------------- /VISAInstrument/Utility/UninstallInfo.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Utility 2 | { 3 | public class UninstallInfo 4 | { 5 | public bool Is64Bit { get; private set; } 6 | 7 | public string DisplayName { get; private set; } 8 | public string QuietUninstallString { get; private set; } 9 | public string DisplayVersion { get; private set; } 10 | public string Publisher { get; private set; } 11 | public string NoModify { get; private set; } 12 | public string NoRepair { get; private set; } 13 | public string EstimatedSize { get; private set; } 14 | public string DisplayIcon { get; private set; } 15 | public string SystemComponent { get; private set; } 16 | public string InstallLocation { get; private set; } 17 | public string URLInfoAbout { get; private set; } 18 | public string URLUpdateInfo { get; private set; } 19 | public string InstallDate { get; private set; } 20 | public string InstallSource { get; private set; } 21 | public string Language { get; private set; } 22 | public string WindowsInstaller { get; private set; } 23 | public string NoRemove { get; private set; } 24 | public string VersionMinor { get; private set; } 25 | public string VersionMajor { get; private set; } 26 | public string UninstallPath { get; private set; } 27 | public string ModifyPath { get; private set; } 28 | public string HelpTelephone { get; private set; } 29 | public string ClickToRunComponent { get; private set; } 30 | public string AuthorizedCDFPrefix { get; private set; } 31 | public string Comments { get; private set; } 32 | public string Contact { get; private set; } 33 | public string UninstallString { get; private set; } 34 | public string HelpLink { get; private set; } 35 | public string Readme { get; private set; } 36 | public string SettingsIdentifier { get; private set; } 37 | public string PartAssist { get; private set; } 38 | public string RepairPath { get; private set; } 39 | public string Version { get; private set; } 40 | public string EngineVersion { get; private set; } 41 | public string NoElevateOnModify { get; private set; } 42 | public string Resume { get; private set; } 43 | public string Installed { get; private set; } 44 | public string LogFile { get; private set; } 45 | public string ProductGuid { get; private set; } 46 | public string RegOwner { get; private set; } 47 | public string LogMode { get; private set; } 48 | public string Size { get; private set; } 49 | public string UninstallData { get; private set; } 50 | public string UninstallDataFile { get; private set; } 51 | public string ReleaseType { get; private set; } 52 | public string ParentDisplayName { get; private set; } 53 | public string ParentKeyName { get; private set; } 54 | public string RegistryLocation { get; private set; } 55 | 56 | public override string ToString() 57 | { 58 | if (!string.IsNullOrEmpty(DisplayName) && !string.IsNullOrEmpty(DisplayVersion)) return DisplayName + "," + DisplayVersion; 59 | return base.ToString(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/UninstallInfoHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Reflection; 4 | using Microsoft.Win32; 5 | 6 | namespace VISAInstrument.Utility 7 | { 8 | public class UninstallInfoHelper 9 | { 10 | public static UninstallInfo[] GetUninstallInfo(UninstallInfoOption uninstallInfoOption = UninstallInfoOption.Only32Bit) 11 | { 12 | const string registryPathOf32Bit = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; 13 | const string registryPathOf64Bit = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"; 14 | string[] registryPaths = uninstallInfoOption == UninstallInfoOption.Only32Bit ? new[] { registryPathOf32Bit } 15 | : uninstallInfoOption == UninstallInfoOption.Only64Bit ? new[] { registryPathOf64Bit } 16 | : new[] { registryPathOf32Bit, registryPathOf64Bit }; 17 | List list = new List(); 18 | foreach (string registryPath in registryPaths) 19 | { 20 | RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(registryPath); 21 | if (registryKey == null) continue; 22 | foreach (string subKeyName in registryKey.GetSubKeyNames()) 23 | { 24 | UninstallInfo uninstallInfo = null; 25 | PropertyInfo[] propertyNames = typeof(UninstallInfo).GetProperties(); 26 | PropertyInfo is64BitPropertyInfo = propertyNames.First(x => x.Name == nameof(UninstallInfo.Is64Bit)); 27 | PropertyInfo[] newPropertyNames = propertyNames.Where(x => x != is64BitPropertyInfo).ToArray(); 28 | RegistryKey currentKey = registryKey.OpenSubKey(subKeyName); 29 | if (currentKey == null) continue; 30 | foreach (string valueName in currentKey.GetValueNames()) 31 | { 32 | PropertyInfo propertyInfo = newPropertyNames.FirstOrDefault(x => x.Name == valueName); 33 | if (propertyInfo == null) continue; 34 | object value = currentKey.GetValue(valueName); 35 | if (value == null || value is string valueString && string.IsNullOrEmpty(valueString)) continue; 36 | if (uninstallInfo == null) 37 | { 38 | uninstallInfo = new UninstallInfo(); 39 | is64BitPropertyInfo.SetValue(uninstallInfo, registryPaths.First() != registryPath, null); 40 | } 41 | propertyInfo.SetValue(uninstallInfo, value.ToString(), null); 42 | } 43 | 44 | if (uninstallInfo != null && !string.IsNullOrEmpty(uninstallInfo.DisplayName)) 45 | { 46 | list.Add(uninstallInfo); 47 | } 48 | } 49 | } 50 | return list.Distinct(new UninstallInfoEqualityComparer()).ToArray(); 51 | } 52 | 53 | class UninstallInfoEqualityComparer : IEqualityComparer 54 | { 55 | public bool Equals(UninstallInfo x, UninstallInfo y) 56 | { 57 | if (x == null && y == null) return true; 58 | if (x == null || y == null) return false; 59 | 60 | if (string.IsNullOrEmpty(x.DisplayName) && string.IsNullOrEmpty(y.DisplayName) 61 | && string.IsNullOrEmpty(x.DisplayVersion) && string.IsNullOrEmpty(y.DisplayVersion)) 62 | { 63 | return true; 64 | } 65 | if (string.IsNullOrEmpty(x.DisplayName) || string.IsNullOrEmpty(y.DisplayName) 66 | || string.IsNullOrEmpty(x.DisplayVersion) || string.IsNullOrEmpty(y.DisplayVersion)) 67 | { 68 | return false; 69 | } 70 | return x.Is64Bit.Equals(y.Is64Bit) && x.DisplayName.Equals(y.DisplayName) && x.DisplayVersion.Equals(y.DisplayVersion); 71 | } 72 | 73 | public int GetHashCode(UninstallInfo obj) 74 | { 75 | if (string.IsNullOrEmpty(obj.DisplayName) && string.IsNullOrEmpty(obj.DisplayVersion)) 76 | { 77 | return 0; 78 | } 79 | if (string.IsNullOrEmpty(obj.DisplayName)) 80 | { 81 | return obj.DisplayVersion.GetHashCode(); 82 | } 83 | if (string.IsNullOrEmpty(obj.DisplayVersion)) 84 | { 85 | return obj.DisplayName.GetHashCode(); 86 | } 87 | 88 | return obj.DisplayName.GetHashCode() ^ obj.DisplayVersion.GetHashCode() + 1623; 89 | } 90 | } 91 | 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /VISAInstrument/Utility/UninstallInfoOption.cs: -------------------------------------------------------------------------------- 1 | namespace VISAInstrument.Utility 2 | { 3 | public enum UninstallInfoOption 4 | { 5 | Only32Bit, 6 | Only64Bit, 7 | Both 8 | } 9 | } -------------------------------------------------------------------------------- /VISAInstrument/VISAInstrument.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7FA82266-0999-4572-AD46-AA79ED2E9CAC} 8 | WinExe 9 | VISAInstrument 10 | VISAInstrument 11 | v4.7.2 12 | 512 13 | 14 | 15 | 16 | publish\ 17 | true 18 | Disk 19 | false 20 | Foreground 21 | 7 22 | Days 23 | false 24 | false 25 | true 26 | 0 27 | 1.0.0.%2a 28 | false 29 | false 30 | true 31 | 32 | 33 | x86 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | false 42 | 43 | 44 | AnyCPU 45 | pdbonly 46 | true 47 | bin\Release\ 48 | TRACE 49 | prompt 50 | 4 51 | false 52 | 53 | 54 | logo.ico 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | Form 68 | 69 | 70 | FrmMain.cs 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | FrmMain.cs 98 | 99 | 100 | ResXFileCodeGenerator 101 | Resources.Designer.cs 102 | Designer 103 | 104 | 105 | True 106 | Resources.resx 107 | True 108 | 109 | 110 | SettingsSingleFileGenerator 111 | Settings.Designer.cs 112 | 113 | 114 | True 115 | Settings.settings 116 | True 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | False 125 | Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 126 | true 127 | 128 | 129 | False 130 | .NET Framework 3.5 SP1 131 | false 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /VISAInstrument/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnxy/VISAInstrument/3651fc4abe1121eae151cf82d4121004e6d35a5c/VISAInstrument/logo.ico --------------------------------------------------------------------------------