Compare commits

..
Author SHA1 Message Date
mschill 23a296df86 Bring branch up to date 2026-08-19 06:26:18 -04:00
jjenko dbea4abafb Merge pull request 'F2026-020 Added the missing Layout settings to "Attachments - Separate Page Numbers" document style in the Farley FSG format.' (#806) from F2026-20_Farley_FSG_Format into Development
format only change - good for testing
2026-08-14 11:01:17 -04:00
jjenko 57622931a5 F2026-020 Added the missing Layout settings to "Attachments - Separate Page Numbers" document style in the Farley FSG format. 2026-08-14 11:02:13 -04:00
mschill 75368c2fe0 Merge pull request 'F2026-018 Changed the font to Arial 11pt in all Farley formats B2026-072 Fixed bug where a Caution or Note in the RNO column would sometimes print on top of text in the AER column' (#805) from F2026-018_B2026-072_Farely_Arial_Print_Fix into Development
Looks Good to me. Ready for QA.
2026-08-13 14:31:33 -04:00
jjenko 5e071bd35a F2026-018 Changed the font to Arial 11pt in all Farley formats B2026-072 Fixed bug where a Caution or Note in the RNO column would sometimes print on top of text in the AER column 2026-08-13 14:28:55 -04:00
jjenko 77639318c6 Merge pull request 'F2026-019 FixedlLinked attachments that were showing a double attachment number prefixed to the step number Added a unlinked background step type that includes the attachment number' (#804) from F2026-019_CallawayBackgrounds into Development
format only change - good for testing
2026-08-12 10:37:04 -04:00
jjenko 1a890b11cb F2026-019 FixedlLinked attachments that were showing a double attachment number prefixed to the step number Added a unlinked background step type that includes the attachment number 2026-08-12 10:38:02 -04:00
mschill f2e01803bc Additional XYPlot cleanup 2026-08-11 14:24:32 -04:00
mschill 752d30ba8f Bring Up To Date with Dev 2026-08-11 09:50:41 -04:00
jjenko 795f21f04b Merge pull request 'B2026-039-Error-sequence-contains-no-elements' (#802) from B2026-039-Error-sequence-contains-no-elements into Development
good for testing
2026-08-11 08:46:39 -04:00
mschill b1427f4997 Volian.Base.Library & Baseline 2026-08-11 07:33:32 -04:00
plarsen c95e86c2a6 Merge branch 'Development' into B2026-039-Error-sequence-contains-no-elements 2026-08-10 21:37:25 -04:00
plarsen 18d2aa3b51 B2026-039-Error-sequence-contains-no-elements 2026-08-10 21:28:29 -04:00
jjenko 7ba3ea8b13 Merge pull request 'B2026 056 syntax problem in x/y plot' (#801) from B2026-056-Syntax-problem-in-X/Y-plot into Development
good for testing
2026-08-10 11:11:07 -04:00
plarsen 30b34c3a50 B2026-056-Syntax-problem-in-XY-Plot 2026-08-10 10:02:16 -04:00
plarsen 6a42800d2c B2026-056-Syntax-problem-in-XY-Plot 2026-08-09 22:54:27 -04:00
plarsen 70f132540f B2026-056-Syntax-problem-in-XY-plot 2026-08-07 12:15:52 -04:00
plarsen cd9eaaaba1 B2026-056-Syntac-problem-in-XY-Plot 2026-08-05 21:42:44 -04:00
plarsen 70aa1f4024 B2026-056-Syntax-problem-in-XY-plot 2026-08-05 17:23:13 -04:00
plarsen 1d634d96fe Merge branch 'Development' of https://git.volian.com/Volian/SourceCode into Development 2026-08-05 17:15:54 -04:00
mschill 6d7d127b63 Updates to DropDownPanel, Baseline, & Controls 2026-08-05 15:16:53 -04:00
mschill 6f0fcdded2 Bring Up to Date 2026-08-04 11:07:38 -04:00
jjenko 4eb5254d96 Merge pull request 'B2026-070 –Barakah Word Section with less than sign' (#800) from B2026-070 into Development
good for testing
2026-08-04 09:14:05 -04:00
mschill 6c2eee0cbc B2026-070 –Barakah Word Section with less than sign 2026-08-04 07:57:01 -04:00
plarsen 3c5265cecf Merge branch 'Development' of https://git.volian.com/Volian/SourceCode into Development 2026-08-03 10:31:24 -04:00
mschill 9c97394f5e Bring Branch up to date 2026-08-03 06:27:46 -04:00
mschill 478d35890d Merge pull request 'C2026-047 Improved the efficiency of retrieving Alarm Point Table information.' (#799) from C2026-047_AlarmPointTableProcessing into Development
Looks Good - Ready for QA.
2026-08-03 05:36:26 -04:00
jjenko 1b9b63412c C2026-047 Improved the efficiency of retrieving Alarm Point Table information. 2026-07-31 13:44:19 -04:00
mschill 3bb8fff3a1 Merge pull request 'B2026 053 find unlinked values of selected' (#795) from B2026-053-Find-Unlinked-Values-of-Selected into Development
Looks Good. Ready For QA.
FYI - Branch was out of date so I updated it.

Would be sure to test both Searches that changed.
2026-07-30 15:29:18 -04:00
mschill 694bc0ead4 Merge branch 'Development' into B2026-053-Find-Unlinked-Values-of-Selected 2026-07-30 15:27:52 -04:00
plarsen cfc324d31e B2026-053-Find-Unlinked-Values-of-Selected 2026-07-30 15:22:32 -04:00
plarsen 43b63e2843 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-30 12:51:24 -04:00
jjenko f2ec510a70 Merge pull request 'B2026-069 – Updated Messaging related to Checking out working Drafts when ROs are being checked if they need updated.' (#798) from B2026-069 into Development
good for testing
2026-07-30 10:54:23 -04:00
mschill 453edbb28e B2026-069 – Updated Messaging related to Checking out working Drafts when ROs are being checked if they need updated. 2026-07-30 10:54:24 -04:00
mschill e492f12602 AdjustBuildRevision, FlexMsgBx, Formats, LBWordLib, VlnStatus, RoAccessToSql, TablePicker, VG 2026-07-30 08:15:47 -04:00
plarsen bc9407f52f B2026-053-Find-Unlinked-Values-of-Selected 2026-07-29 13:48:05 -04:00
plarsen 954cc5918f B2026-053-Find-Unlinked-Values-of-Selected 2026-07-29 12:34:20 -04:00
plarsen 4ef16e7856 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-28 15:46:43 -04:00
plarsen 1eb3c3e725 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-28 15:39:17 -04:00
plarsen a89c2d3d22 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-28 15:37:37 -04:00
plarsen 914837a5a2 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-28 10:57:55 -04:00
plarsen 9643a71ba5 Merge branch 'Development' of https://git.volian.com/Volian/SourceCode into Development 2026-07-28 08:35:53 -04:00
mschill aa7e0528f8 Merge branch 'Development' into B2026-053-Find-Unlinked-Values-of-Selected 2026-07-28 06:34:08 -04:00
plarsen 57bd8d569e B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 13:45:20 -04:00
plarsen b49d8871a2 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 12:25:46 -04:00
plarsen b90d419bc5 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 12:14:55 -04:00
jjenko 1f48d498e1 Merge pull request 'B2026-067 – Corrected specific instance where a crash would occur when multiple Word Sections open and were closed in a specific order.' (#797) from B2026-067 into Development
good for testing
2026-07-27 11:54:21 -04:00
mschill da6139c932 B2026-067 – Corrected specific instance where a crash would occur when multiple Word Sections open and were closed in a specific order. 2026-07-27 11:47:36 -04:00
plarsen be744b40a3 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 11:35:42 -04:00
plarsen 780ce657ca B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 11:28:40 -04:00
plarsen 464be0f803 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 11:22:49 -04:00
plarsen 58a6cb9a24 Development 2026-07-27 11:19:47 -04:00
plarsen 9bf7b2ffde B2026-053-Find-Unlinked-Values-of-Selected 2026-07-27 11:14:19 -04:00
mschill cde1f28215 Merge pull request 'B2026-066 Fixed issue of the Update RO Values button and Working Draft context menu item, not being disabled after Updating RO Values.' (#796) from B2026-066_UpdateROsButtonFix into Development
Looks Good. Ready for QA.
2026-07-27 11:09:42 -04:00
jjenko db198cb7d0 B2026-066 Fixed issue of the Update RO Values button and Working Draft context menu item, not being disabled after Updating RO Values. 2026-07-27 11:08:35 -04:00
plarsen 99fe567e78 Development 2026-07-27 09:13:34 -04:00
mschill f67d37801a Print Library, Svg Library, Utils Library, XYPlots 2026-07-24 13:36:46 -04:00
plarsen 2261c8f0f5 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-24 10:47:25 -04:00
plarsen f93b16fc52 B2026-053-Find-Unlinked-Values-of-Selected 2026-07-23 09:21:09 -04:00
plarsen 7c3a43749c B2026-053-Find-Unlinked-Values-of-Selected 2026-07-23 09:09:22 -04:00
plarsen ecec7b9f1a Merge branch 'Development' of https://git.volian.com/Volian/SourceCode into Development 2026-07-23 08:17:55 -04:00
plarsen 1aca7335f7 Development 2026-07-23 08:15:18 -04:00
plarsen ba5aee6640 Development 2026-07-21 11:33:58 -04:00
mschill 06c3136566 Merge branch 'Development' into C2026-043-Tech-Debt_v1 2026-07-21 10:38:53 -04:00
jjenko abaf55e9b1 Merge pull request 'C2026-046 - Decrease check if need to update ROs.' (#793) from C2026-046 into Development
good for testing
2026-07-21 10:32:30 -04:00
mschill 3a2dd0b0aa C2026-046 - Decrease check if need to update ROs. 2026-07-21 10:24:46 -04:00
mschill 9486b37300 C2026-043-Tech-Debt_v1 - Stash 1 2026-07-21 06:49:28 -04:00
jjenko 0fed1acfd8 Merge pull request 'F2026-017 Blank line was sometimes missing after the Note and Caution text. This was a 64-bit build difference that affected the text width calculations.' (#792) from F2026-017_SummerCautionNoteAdj into Development
Format only change - good for testing phase
2026-07-17 10:11:25 -04:00
jjenko d7c2300021 F2026-017 Blank line was sometimes missing after the Note and Caution text. This was a 64-bit build difference that affected the text width calculations. 2026-07-17 10:11:43 -04:00
jjenko fca333299d Merge pull request 'C2026 044' (#791) from C2026-044 into Development
good for testing phase
2026-07-16 08:53:54 -04:00
mschill a13b03a136 C2026-044 – ve_GetParentItem Performance Improvement
Added Included columns to Index
2026-07-16 08:48:11 -04:00
mschill 48054f5bf1 C2026-044 – ve_GetParentItem Performance Improvement 2026-07-16 08:26:52 -04:00
mschill 51f2897a33 C2026-044 – ve_GetParentItem Performance Improvement 2026-07-16 08:26:07 -04:00
plarsen 7a3a07b0da Merge branch 'Development' of https://git.volian.com/Volian/SourceCode into Development 2026-07-16 08:25:16 -04:00
jjenko 7c3cfca86c Merge pull request 'B2026-055 – Transition Search Improvements' (#790) from B2026-055 into Development
good for testing
2026-07-15 13:54:03 -04:00
mschill 352af15984 B2026-055 – Transition Search Improvements 2026-07-15 12:43:38 -04:00
jjenko 2c42933d58 Merge pull request 'F2026-016 Robinson- created a new sub-format for a Foldout section that uses a smaller font size.' (#789) from F2026-016_Robinson_Foldout_Format into Development
format only change. good for testing
2026-07-10 09:57:15 -04:00
jjenko 2e68362836 F2026-016 Robinson- created a new sub-format for a Foldout section that uses a smaller font size. 2026-07-10 09:56:58 -04:00
jjenko c6736db7ea Merge pull request 'B2026-065 Adjusted the Callaway Two Column format for the position of RNO tables.' (#788) from B2026-065_RNO_TablePositionAdjustment into Development
format only change.  Good for testing
2026-07-09 10:41:42 -04:00
jjenko c005f03af8 B2026-065 Adjusted the Callaway Two Column format for the position of RNO tables. 2026-07-09 10:41:46 -04:00
jjenko 459aabcc86 Merge pull request 'B2026-064 – Updating ROs from Display ROs should not error' (#787) from B2026-064 into Development
good for testing
2026-07-07 11:01:30 -04:00
mschill ad33097d5e B2026-064 – Updating ROs from Display ROs should not error 2026-07-07 10:59:51 -04:00
jjenko 8d7735735e Merge pull request 'F2026_015 Moved the change bar position to the right one space to accommodate the wider Caution and Note boxes' (#786) from F2026-015_SouthTexas_ChgBars into Development
format only change.  Ready for testing
2026-07-01 09:15:24 -04:00
jjenko 25bbc46925 F2026_015 Moved the change bar position to the right one space to accommodate the wider Caution and Note boxes 2026-07-01 09:17:23 -04:00
jjenko 5a26b0ee35 Merge pull request 'B2026-054 - When performing a Transition search, the Formats dropdown list is repeating several times.' (#785) from B2026-054 into Development
good for testing phase
2026-07-01 08:19:38 -04:00
mschill 09a397bed2 B2026-054 - When performing a Transition search, the Formats dropdown list is repeating several times. 2026-07-01 07:21:25 -04:00
jjenko a33039bcae Merge pull request 'F2026-014 South Texas EOP format – adjusted the Caution and Note box width. Also remove the extra space between bullets and multiple Caution/Note text' (#784) from F2026-014_SouthTexas_Caution_Box_Width into Development
format only changes - ready for testing
2026-06-30 14:34:22 -04:00
jjenko 0ebd125266 F2026-014 South Texas EOP format – adjusted the Caution and Note box width. Also remove the extra space between bullets and multiple Caution/Note text 2026-06-30 14:35:28 -04:00
jjenko fd16a6b6c3 Merge pull request 'B2026-063 - Issue Deleting Steps with Grids' (#783) from B2026-063 into Development
good for testing
2026-06-30 13:50:22 -04:00
mschill cf19f764c7 Copy / Paste Error when updating Revision Comment 2026-06-30 13:49:37 -04:00
jjenko 88850d6c25 Merge pull request 'B2026-063 - Issue Deleting Steps with Grids' (#782) from B2026-063 into Development
good for testing phase
2026-06-30 09:28:28 -04:00
mschill b173c61575 B2026-063 - Issue Deleting Steps with Grids 2026-06-30 09:11:43 -04:00
jjenko 3b866f0952 Merge pull request 'B2026-057 - Issue when ROs are out of date and swapping between sets – sometimes asked if want to update ROs twice if said no the first time.' (#781) from B2026-057 into Development
good for testing phase
2026-06-29 10:00:42 -04:00
mschill 94db524a11 B2026-057 - Issue when ROs are out of date and swapping between sets – sometimes asked if want to update ROs twice if said no the first time. 2026-06-29 09:51:48 -04:00
jjenko f27616ce1f Merge pull request 'B2026-052 - Issue when parens inside a Hardspaced Multi-RO Return Values.' (#780) from B2026-052 into Development
good for testing phase
2026-06-29 08:47:11 -04:00
mschill 7f75af7119 B2026-052 - Issue when parens inside a Hardspaced Multi-RO Return Values.
PROMS crashes when doing an update ROFst.
2026-06-25 15:46:25 -04:00
plarsen 05ab48cdc5 Merge branch 'Development' of https://git.volian.com/Volian/SourceCode into Development 2026-06-24 09:49:07 -04:00
mschill 38e42723af Merge pull request 'B2026-060, B2026-061, Fixed issue where change bars were printing when they should not have been.' (#778) from B2026-60_B2026-61 into Development
Looks Good. Ready for QA!
2026-06-18 14:18:24 -04:00
jjenko f4ec60c9e0 B2026-060, B2026-061, Fixed issue where change bars were printing when they should not have been. 2026-06-18 14:06:30 -04:00
plarsen fd51c209a3 Development 2026-06-15 15:18:03 -04:00
jjenko 01394b1978 Merge pull request 'B2026 058' (#777) from B2026-058 into Development
good for testing
2026-06-12 15:15:39 -04:00
mschill 9b7db08fcf update unicode 2026-06-12 15:02:01 -04:00
mschill 6d7cdef223 B2026-058 – If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit. 2026-06-12 14:57:42 -04:00
jjenko d9c35fe02a Merge pull request 'C2026 021 b2026 048' (#775) from C2026-021_B2026-048 into Development
good for testing
2026-05-29 09:47:07 -04:00
mschill 250b3fa406 Remove commented out code 2026-05-29 06:33:37 -04:00
mschill a5a3f16177 C2026-021_B2026-048 Expand Functionality of Viewing Mode 2026-05-29 06:06:58 -04:00
jjenko ffa7e21c18 Merge pull request 'B2026-050 Problem when Approval with Duplicate Rev Numbers' (#773) from B2026-050 into Development
good for testing phase
2026-05-26 08:38:20 -04:00
mschill 4608c05df0 B2026-050 Problem when Approval with Duplicate Rev Numbers 2026-05-26 07:01:43 -04:00
jjenko 56ff5a0213 Merge pull request 'B2026-051 Fix Error loading Display Ros when cannot find RO lookup' (#772) from B2026-051 into Development
good for testing phase
2026-05-22 11:34:31 -04:00
mschill 014fde301c B2026-051 Fix Error loading Display Ros when cannot find RO lookup 2026-05-22 11:07:57 -04:00
jjenko 0080a42423 Merge pull request 'C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST' (#756) from C2026-008 into Development
Reviewed-on: #756
Reviewed-by: John Jenko <jjenko@volian.com>

This was pre-tested prior to  this merge.
2026-05-19 09:24:09 -04:00
mschill 2035a4c855 Merge branch 'Development' into C2026-008 2026-05-19 08:59:34 -04:00
jjenko 4dc6a190fa Merge pull request 'C2026-037 Change History Deleted Items to 24-hour clock' (#771) from C2026-037 into Development
good for testing
2026-05-19 08:56:47 -04:00
mschill e0db322262 C2026-037 Change History Deleted Items to 24-hour clock 2026-05-19 06:56:31 -04:00
mschill 8f1bb45e42 C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST
--Fix for Blank popup box when completes updating ROs through Admin Tool & fix for updating ROs when fails part way through (if network error, etc…)
2026-05-15 07:09:21 -04:00
mschill f39aefd28f Merge branch 'Development' into C2026-008 2026-05-14 10:40:00 -04:00
jjenko 2cfc43dbfd Merge pull request 'B2026-045 Issue with Refreshing Changebars when Approval is done multiple times in a row on Multi-unit. Printing was ok but the UI required leaving PROMS and going back in.' (#769) from B2026-045 into Development
good for testing
2026-05-13 15:38:26 -04:00
mschill f4168b5202 B2026-045 Issue with Refreshing Changebars when Approval is done multiple times in a row on Multi-unit. Printing was ok but the UI required leaving PROMS and going back in. 2026-05-13 15:02:52 -04:00
jjenko 2d93b652e8 Merge pull request 'B2026-046-RO-symbols-and-Annotations' (#768) from B2026-046-RO-symbols-and-Annotations into Development
good for testing
2026-05-13 13:43:12 -04:00
plarsen 70782cd655 B2026-046-RO-symbols-and-Annotations 2026-05-13 13:37:12 -04:00
mschill 768fcc4f05 Fix Bug in Dotnet Bar related to multiple events and closing display tabs 2026-05-12 08:54:26 -04:00
mschill 727491f99b Merge branch 'C2026-008' of https://git.volian.com/Volian/SourceCode into C2026-008 2026-05-11 14:43:49 -04:00
mschill c5f1c3a340 C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST
Update ProgressBar & fix Already Checked out popup multiple times
2026-05-11 14:42:48 -04:00
mschill a78311104a Merge branch 'Development' into C2026-008 2026-05-11 14:41:01 -04:00
plarsen 4b5b06210c B2026-046-RO-symbols-and-Annotations 2026-05-08 23:20:38 -04:00
jjenko 333645b044 Merge pull request 'F2026_013 Fixed typo in Vogtle format title' (#767) from F2026-013_Vogtle_3_4_Format into Development
format only change - good for testing phase
2026-05-07 15:23:01 -04:00
jjenko 23173074aa F2026_013 Fixed typo in Vogtle format title 2026-05-07 15:21:48 -04:00
jjenko be8bb9c4e1 Merge pull request 'B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function' (#765) from B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function into Development
good for testing phase
2026-05-07 15:07:27 -04:00
plarsen d07e132216 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-07 14:55:44 -04:00
plarsen 401fa12851 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-07 13:29:55 -04:00
plarsen 194ca84d38 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-07 11:34:16 -04:00
plarsen 7bbf62d735 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-07 11:27:36 -04:00
plarsen 3924e2fca5 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-06 07:54:39 -04:00
plarsen 2e39102e7c Merge branch 'Development' into B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-05 22:26:21 -04:00
plarsen 2a0849fae5 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-05 22:08:27 -04:00
jjenko 9f4e8f6eef Merge pull request 'C2026-014 Set Changebar date with multi-unit' (#766) from C2026-014 into Development
good for testing
2026-05-05 09:05:23 -04:00
mschill d0fe36f86e C2026-014 Set Changebar date with multi-unit 2026-05-05 08:50:39 -04:00
jjenko 10da22cd77 Merge pull request 'C2026-015 Set overall Changebar date when approving multi-unit' (#764) from C2026-015 into Development
good for testing
2026-05-05 08:44:47 -04:00
mschill 6dacc2d515 Merge branch 'Development' into C2026-015 2026-05-05 06:08:19 -04:00
mschill 7baa9628d6 C2026-015 Set overall Changebar date when approving multi-unit 2026-05-05 06:00:43 -04:00
plarsen ec5229101f B2026-043-Fix-Error-for-Set_At_AAll_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-04 17:00:42 -04:00
plarsen a0e0b1e788 B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function 2026-05-04 16:33:08 -04:00
jjenko f1e04396de Merge pull request 'B2026-042-Fix-Null-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-4' (#762) from B2026-042-Fix-Null-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-4 into Development
good for testing
2026-05-04 09:11:33 -04:00
plarsen d0cae8c2fc B2026-042-Fix-Null-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-4 2026-05-04 08:48:51 -04:00
plarsen 90c215d4c1 B2026-042-Fix-Null-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-4 2026-05-01 16:26:04 -04:00
plarsen 1b1dc78548 C2026-027-New-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-4 2026-04-30 16:37:10 -04:00
jjenko a112163f85 Merge pull request 'C2026-015 Set overall Changebar date when approving multi-unit' (#761) from C2026-015 into Development
ready for testing
2026-04-30 14:01:58 -04:00
mschill 2a9f2e188d C2026-015 Set overall Changebar date when approving multi-unit 2026-04-30 13:53:02 -04:00
jjenko 652e0cb06f Merge pull request 'C2026-027-New-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-3' (#760) from C2026-027-New-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-3 into Development
ready for testing
2026-04-30 08:41:01 -04:00
plarsen 123b1b08c2 C2026-027-New-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-3 2026-04-30 08:20:41 -04:00
plarsen b321bc354b C2026-027-New-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-3 2026-04-28 18:09:15 -04:00
plarsen 03d7397242 Merge remote-tracking branch 'origin/Development' into Development 2026-04-28 14:39:52 -04:00
mschill 45e78ef184 Merge branch 'Development' into C2026-008 2026-04-28 13:43:35 -04:00
jjenko fe7c5893bb Merge pull request 'B2026-040 - Signoff/Checkoffs not printing unless set to Section Default' (#758) from B2026-040 into Development
good for testing
2026-04-28 11:11:45 -04:00
mschill 2b57c552d1 B2026-040 - Signoff/Checkoffs not printing unless set to Section Default 2026-04-28 11:03:04 -04:00
mschill 7f0d39b684 C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST 2026-04-28 09:13:17 -04:00
plarsen 7273a8b13b Development 2026-04-27 15:43:38 -04:00
jjenko a544a5cd4f Merge pull request 'B2026-037 - Remove Fix Symbol Font' (#755) from B2026-037 into Development
good for testing phase
2026-04-16 14:02:42 -04:00
mschill ff9ade75d4 B2026-037 - Remove Fix Symbol Font 2026-04-16 09:32:02 -04:00
mschill cfd5498521 Merge pull request 'C2026-033 Added logic to not display the Empty Procedure message box if we are printing via baseline print testing.' (#754) from C2026-033_Baseline_Printing into Development
Looks Good. Ready for QA.
2026-04-15 11:55:19 -04:00
jjenko 9b7c30e1cd C2026-033 Added logic to not display the Empty Procedure message box if we are printing via baseline print testing. 2026-04-15 11:28:21 -04:00
mschill 670e5d7fa9 Merge pull request 'Baseline Application fixes' (#753) from baseline into Development
Looks good. Ready for QA.
2026-04-13 11:13:50 -04:00
jjenko 8258235611 Baseline Application fixes 2026-04-13 11:06:50 -04:00
jjenko 4d97f29943 Merge pull request 'B2026-035_fix_RO_Preview_for_X_Y_Plots' (#751) from B2026-035_fix_RO_Preview_for_X_Y_Plots into Development
good for testing
2026-03-31 08:53:49 -04:00
plarsen ab8d59eb2d Merge branch 'Development' into B2026-035_fix_RO_Preview_for_X_Y_Plots 2026-03-31 08:48:01 -04:00
plarsen c324fa69b2 B2026-035_fix_RO_Preview_for_X_Y_Plots 2026-03-31 08:47:43 -04:00
plarsen 1cdb9b4cc2 Development 2026-03-31 08:43:41 -04:00
plarsen f47fa49b80 B2026-035_fix_RO_Preview_for_X_Y_Plots 2026-03-30 16:12:37 -04:00
243 changed files with 23595 additions and 36093 deletions
+1
View File
@@ -402,3 +402,4 @@ FodyWeavers.xsd
/fmtall /fmtall
/genmacall /genmacall
*AssemblyInfo.cs *AssemblyInfo.cs
/PROMS/Baseline/Baseline.sln
+2 -42
View File
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
@@ -35,31 +33,7 @@ namespace AdjustBuildRevision
outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.4.yyMM.dHH") + "\")"); outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.4.yyMM.dHH") + "\")");
else else
outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.3.yyMM.dHH") + "\")"); outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.3.yyMM.dHH") + "\")");
// if (outline != line)
// {
// Console.WriteLine("Before: '{0}'", line);
// Console.WriteLine("After: '{0}'", outline);
// lines[i] = outline;
// changed = true;
// }
// else
// {
// Console.WriteLine("No change: '{0}'", line);
// }
// }
//}
//if (changed)
//{
// if (!fi.IsReadOnly) fi.IsReadOnly = false;
// StreamWriter sw = fi.CreateText();
// foreach (string line in lines)
// sw.WriteLine(line);
// sw.Close();
// string line = lines[i];
// string outline = line;
// if (line.Contains("AssemblyVersion") || line.Contains("AssemblyFileVersion"))
// {
//outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("1.1.yyMM.dHH") + "\")");
if (outline != line) if (outline != line)
{ {
Console.WriteLine("Before: '{0}'", line); Console.WriteLine("Before: '{0}'", line);
@@ -84,7 +58,7 @@ namespace AdjustBuildRevision
} }
else else
{ {
MessageBox.Show("File " + fi.FullName + " does not exist"); MessageBox.Show($"File {fi.FullName} does not exist");
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -93,10 +67,6 @@ namespace AdjustBuildRevision
} }
} }
//private static DateTime GetLatestDateTime(string path)
//{
// return GetLatestDateTime(new DirectoryInfo(path));
//}
private static DateTime GetLatestDateTime(DirectoryInfo di, DateTime dtCheck) private static DateTime GetLatestDateTime(DirectoryInfo di, DateTime dtCheck)
{ {
DateTime dtMax = dtCheck; DateTime dtMax = dtCheck;
@@ -104,24 +74,14 @@ namespace AdjustBuildRevision
foreach(FileInfo myFile in myFiles) foreach(FileInfo myFile in myFiles)
{ {
DateTime dt = myFile.LastWriteTime; DateTime dt = myFile.LastWriteTime;
//if (dt > dtCheck)
//{
//Console.WriteLine("\"File\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}",myFile.FullName,dt.ToString("1.1.yyMM.dHH"),dt,dtCheck);
if(dtMax < dt) dtMax = dt; if(dtMax < dt) dtMax = dt;
//}
} }
DirectoryInfo[] myFolders = di.GetDirectories(); DirectoryInfo[] myFolders = di.GetDirectories();
foreach (DirectoryInfo diChild in myFolders) foreach (DirectoryInfo diChild in myFolders)
{ {
DateTime dtChild = GetLatestDateTime(diChild,dtCheck); DateTime dtChild = GetLatestDateTime(diChild,dtCheck);
//if (dtChild > dtCheck)
//{
//Console.WriteLine("\"SubFolder\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}", diChild.FullName, dtChild.ToString("1.1.yyMM.dHH"),dtChild,dtCheck);
if(dtChild > dtMax) dtMax = dtChild; if(dtChild > dtMax) dtMax = dtChild;
//}
} }
//if(dtMax > dtCheck)
// Console.WriteLine("\"Folder\"\t\"{0}\"\t\"{1}\"", di.FullName, dtMax.ToString("1.1.yyMM.dHH"));
return dtMax; return dtMax;
} }
} }
+1
View File
@@ -67,6 +67,7 @@
<Compile Include="frmSettings.Designer.cs"> <Compile Include="frmSettings.Designer.cs">
<DependentUpon>frmSettings.cs</DependentUpon> <DependentUpon>frmSettings.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmBaseline.resx"> <EmbeddedResource Include="frmBaseline.resx">
+8
View File
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
-3
View File
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace Baseline namespace Baseline
+161 -206
View File
@@ -43,12 +43,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml.Serialization; using System.Xml.Serialization;
@@ -73,12 +70,7 @@ namespace Baseline
} }
public partial class frmBaseline : Form public partial class frmBaseline : Form
{ {
private IgnoreLines _MyIgnore = new IgnoreLines(); public IgnoreLines MyIgnore { get; set; } = new IgnoreLines();
public IgnoreLines MyIgnore
{
get { return _MyIgnore; }
set { _MyIgnore = value; }
}
private LastWas myLast = LastWas.Search; private LastWas myLast = LastWas.Search;
private Settings MySettings; private Settings MySettings;
public string MyStatus public string MyStatus
@@ -151,8 +143,10 @@ namespace Baseline
this.WindowState = Properties.Settings.Default.WidnowState; this.WindowState = Properties.Settings.Default.WidnowState;
if(Properties.Settings.Default.Ignore != null && Properties.Settings.Default.Ignore != "") if(Properties.Settings.Default.Ignore != null && Properties.Settings.Default.Ignore != "")
MyIgnore = IgnoreLines.Get(Properties.Settings.Default.Ignore); MyIgnore = IgnoreLines.Get(Properties.Settings.Default.Ignore);
MySettings= new Settings(); MySettings = new Settings
MySettings.IgnoreLines = new BindingList<string>(); {
IgnoreLines = new BindingList<string>()
};
splitContainer1.SplitterDistance = Properties.Settings.Default.Split1; splitContainer1.SplitterDistance = Properties.Settings.Default.Split1;
splitContainer2.SplitterDistance = Properties.Settings.Default.Split2; splitContainer2.SplitterDistance = Properties.Settings.Default.Split2;
splitContainer3.SplitterDistance = Properties.Settings.Default.Split3; splitContainer3.SplitterDistance = Properties.Settings.Default.Split3;
@@ -240,8 +234,7 @@ namespace Baseline
lbProcedures.Items.Clear(); lbProcedures.Items.Clear();
lbResults1.Items.Clear(); lbResults1.Items.Clear();
lbResults2.Items.Clear(); lbResults2.Items.Clear();
FindFile ff = lbDifferent.SelectedItem as FindFile; if (lbDifferent.SelectedItem is FindFile ff)
if (ff != null)
{ {
// Fill Procedure or Result ListBoxes // Fill Procedure or Result ListBoxes
switch (myLast) switch (myLast)
@@ -361,13 +354,6 @@ namespace Baseline
lines1 = list1.AsEnumerable<string>();// Convert back to Enumerable to work with LINQ lines1 = list1.AsEnumerable<string>();// Convert back to Enumerable to work with LINQ
return lines1; return lines1;
} }
private string GetProcNum(string line)
{
string retval = line.Substring(3, line.IndexOf(" | ") - 3);
if (retval.Contains("_"))
retval = retval.Substring(0, retval.IndexOf("_") - 1);
return retval;
}
/// <summary> /// <summary>
/// Include lines for Procedure or Page or Search is true /// Include lines for Procedure or Page or Search is true
/// Account for Case Insensitive CheckBox /// Account for Case Insensitive CheckBox
@@ -450,13 +436,13 @@ namespace Baseline
private void lbResults1_SelectedIndexChanged(object sender, EventArgs e) private void lbResults1_SelectedIndexChanged(object sender, EventArgs e)
{ {
string line=null; string line=null;
if (lbResults1.SelectedItem is string) if (lbResults1.SelectedItem is string v)
line = (string)lbResults1.SelectedItem; line = v;
Line myLine = lbResults1.SelectedItem as Line; Line myLine = lbResults1.SelectedItem as Line;
switch (myLast) switch (myLast)
{ {
case LastWas.Pagination: case LastWas.Pagination:
line = OpenPDF(line); OpenPDF(line);
break; break;
case LastWas.Baseline: // TODO: Need to add code here to open matching file case LastWas.Baseline: // TODO: Need to add code here to open matching file
OpenOnePDF(myLine,1); OpenOnePDF(myLine,1);
@@ -472,14 +458,14 @@ namespace Baseline
{ {
string line=null; string line=null;
if(lbResults2.SelectedItem is string) if(lbResults2.SelectedItem is string v)
line = (string)lbResults2.SelectedItem; line = v;
Line myLine = lbResults2.SelectedItem as Line; Line myLine = lbResults2.SelectedItem as Line;
switch (myLast) switch (myLast)
{ {
case LastWas.Pagination: case LastWas.Pagination:
line = OpenPDF(line); OpenPDF(line);
break; break;
case LastWas.Baseline: // TODO: Need to add code here to open matching file case LastWas.Baseline: // TODO: Need to add code here to open matching file
OpenOnePDF(myLine,2); OpenOnePDF(myLine,2);
@@ -491,34 +477,97 @@ namespace Baseline
break; break;
} }
} }
string exePath;
private string OpenPDF(string line) /// <summary>
/// This will return the full path to the PDF file
/// </summary>
/// <param name="fi"></param>
/// <param name="patern"></param>
/// <returns></returns>
private string GetPFDFileAndPath(FileInfo fi, string patern)
{ {
int page = int.Parse(line.Substring(0, 6)); string[] fileList = Directory.GetFiles(fi.DirectoryName, patern);
// sort the list of file list
Array.Sort((string[])fileList);
return fileList.FirstOrDefault(); // the PDF file that we what should be top of the list then.
}
/// <summary>
/// This will parse out the procedure number for the PROMS ShortPath representation of a procedure section or step part
/// In the PROMS ShortPath, ".S" is used to delimit the procedure number, section then uses "..S" for the step parts
/// This method was written to handle cases where ".S" is used as part of the procedure number
/// </summary>
/// <param name="txt"></param>
/// <returns></returns>
private string ParseOutProcedureNumberFromLine(string txt)
{
// if the item is to a high levels step or sub-step the short path as "..S" for each part of the step
// so look for the last occurence of ".." which will be the end of the section information
int lidx = txt.LastIndexOf("..");
if (lidx > 0)
{
lidx = txt.LastIndexOf(".S", lidx); // this will position us to the end of the procedure number
}
else
{
lidx = txt.LastIndexOf(".S"); // this will position us to the end of the procedure number if there was no step information
}
// old logic was looking for the first occurence of ".S" in the txt string as the ending point of the procedure nuumber
// Beaver Valley has a procedure number "1.SBGEN" in which the old logic would not work
// 1.SBGEN.SC. ==> short path of attachment section "C"
// 1.SBGEN.SC..S1. ==> short path of Step 1 in attachment section "C"
// B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file. // B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file.
line = line.Substring(8, line.IndexOf(".S") - 8).Replace("/", "_").Replace("\\", "_"); string rtnstr = txt.Substring(8, lidx - 8).Replace("/", "_").Replace("\\", "_");
return rtnstr;
}
string exePath;
private void OpenPDF(string line)
{
int pageNum = int.Parse(line.Substring(0, 6));
// B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file.
string ProcNum = ParseOutProcedureNumberFromLine(line);
string procPatern = string.Format("*{0}*.pdf", string.IsNullOrEmpty(line) ? "noProcNumber" : ProcNum);
FindFile ff = lbDifferent.SelectedItem as FindFile; FindFile ff = lbDifferent.SelectedItem as FindFile;
FileInfo fi1 = new FileInfo(ff.File1); FileInfo fi1 = new FileInfo(ff.File1);
FileInfo fi2 = new FileInfo(ff.File2); FileInfo fi2 = new FileInfo(ff.File2);
string PDFfileName1 = GetPFDFileAndPath(fi1,procPatern);
string PDFfileName2 = GetPFDFileAndPath(fi2,procPatern);
if (string.IsNullOrEmpty(PDFfileName1) || string.IsNullOrEmpty(PDFfileName2)) return;
// If you don't know where the Reader executable is for PDFs Open a PDF and Check to see where the path points // If you don't know where the Reader executable is for PDFs Open a PDF and Check to see where the path points
if (exePath == null) if (exePath == null)
{ {
System.Diagnostics.Process p = System.Diagnostics.Process.Start(fi1.DirectoryName + "\\" + line + ".pdf"); try
{
System.Diagnostics.Process p = System.Diagnostics.Process.Start(PDFfileName1);
exePath = TryToGetPath(p); exePath = TryToGetPath(p);
p.Kill(); // No need to keep it open p.Kill(); // No need to keep it open
} }
catch (Exception ex)
{
Application.DoEvents();
string msg = string.Format("{0} - {1}", ex.GetType().Name, ex.Message);
Console.WriteLine(msg);
MessageBox.Show(msg, "Error opening default PDF Viewer");
return;
}
}
// Open the first PDF on a Specific Page // Open the first PDF on a Specific Page
System.Diagnostics.ProcessStartInfo psi1 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A page={0} ", page) + fi1.DirectoryName + "\\" + line + ".pdf "); System.Diagnostics.ProcessStartInfo psi1 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format(" /A \"page={0}\" \"{1}\" ", pageNum,PDFfileName1));
System.Diagnostics.Process p1 = System.Diagnostics.Process.Start(psi1); System.Diagnostics.Process p1 = System.Diagnostics.Process.Start(psi1);
// Move the PDF Reader window to 0,0 // Move the PDF Reader window to 0,0
MoveProcess(p1, 0, 0); MoveProcess(p1, 0, 0);
// Open the first PDF on a Specific Page
System.Diagnostics.ProcessStartInfo psi2 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A page={0} ", page) + fi2.DirectoryName + "\\" + line + ".pdf "); // Open the second PDF on a Specific Page
System.Diagnostics.ProcessStartInfo psi2 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format(" /A \"page={0}\" \"{1}\" ", pageNum, PDFfileName2));
System.Diagnostics.Process p2 = System.Diagnostics.Process.Start(psi2); System.Diagnostics.Process p2 = System.Diagnostics.Process.Start(psi2);
// Move the PDF Reader window to 960,0 // Move the PDF Reader window to 960,0
// TODO: This Offset could be a Setting // TODO: This Offset could be a Setting
MoveProcess(p2, 960, 0); MoveProcess(p2, 960, 0);
return line; return;
} }
/// <summary> /// <summary>
/// Try to get the location of the PDF Reader executable /// Try to get the location of the PDF Reader executable
@@ -530,7 +579,7 @@ namespace Baseline
p.WaitForInputIdle(); p.WaitForInputIdle();
while (p.MainModule == null) while (p.MainModule == null)
{ {
Console.WriteLine("{0} - {1}", p.MainWindowTitle,p.ProcessName); Console.WriteLine("{0} - {1}", p.MainWindowTitle, p.ProcessName);
p.WaitForInputIdle(); p.WaitForInputIdle();
Application.DoEvents(); Application.DoEvents();
} }
@@ -551,10 +600,10 @@ namespace Baseline
progname = @"C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\UC.exe"; progname = @"C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\UC.exe";
System.Diagnostics.ProcessStartInfo psi = System.Diagnostics.ProcessStartInfo psi =
new System.Diagnostics.ProcessStartInfo(progname, string.Format(@" -t ""{0}"" ""{1}""", compareFile, baseFile)); new System.Diagnostics.ProcessStartInfo(progname, string.Format(@" -t ""{0}"" ""{1}""", compareFile, baseFile));
System.Diagnostics.Process prc = System.Diagnostics.Process.Start(psi); _ = System.Diagnostics.Process.Start(psi);
} }
private ProcessLocationQueue myQueue= new ProcessLocationQueue(); private readonly ProcessLocationQueue myQueue= new ProcessLocationQueue();
private Timer queueTimer = null; private Timer queueTimer = null;
/// <summary> /// <summary>
/// Move a Process to a specific screen location - This is done with a timer so /// Move a Process to a specific screen location - This is done with a timer so
@@ -567,8 +616,10 @@ namespace Baseline
{ {
if (queueTimer == null) if (queueTimer == null)
{ {
queueTimer = new Timer(); queueTimer = new Timer
queueTimer.Enabled = false; {
Enabled = false
};
queueTimer.Tick += queueTimer_Tick; queueTimer.Tick += queueTimer_Tick;
queueTimer.Interval = 1000; queueTimer.Interval = 1000;
} }
@@ -594,40 +645,54 @@ namespace Baseline
/// <param name="list"></param> /// <param name="list"></param>
private void OpenOnePDF(Line myLine, int list) private void OpenOnePDF(Line myLine, int list)
{ {
if (myLine == null) return; // no PDF to open
// B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file. // B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file.
string proc = myLine.MyProc.Number.Replace("/","_").Replace("\\","_"); string proc = myLine.MyProc.Number.Replace("/","_").Replace("\\","_");
// if no procedure number, PROMS creates pdf filename "NoProcNumber.pdf"
// create pattern to use to get the PDF from the directory
// add wildcards (*) to file the file if any prefix or suffix was added to the filename
string procPatern = string.Format("*{0}*.pdf", proc == string.Empty ? "noProcNumber" : proc);
int pagenum = myLine.MyPage.Number; int pagenum = myLine.MyPage.Number;
FindFile ff = lbDifferent.SelectedItem as FindFile; FindFile ff = lbDifferent.SelectedItem as FindFile;
FileInfo fi1 = new FileInfo(ff.File1); string PDFfileName;
FileInfo fi2 = new FileInfo(ff.File2); if (list == 1)
if (exePath == null)
{ {
System.Diagnostics.Process p = System.Diagnostics.Process.Start(fi1.DirectoryName + "\\" + proc + ".pdf"); FileInfo fi1 = new FileInfo(ff.File1);
while (exePath == null) PDFfileName = GetPFDFileAndPath(fi1, procPatern);
}
else // list == 2
{
FileInfo fi2 = new FileInfo(ff.File2);
PDFfileName = GetPFDFileAndPath(fi2, procPatern);
}
if (string.IsNullOrEmpty(PDFfileName)) return; // no PDF to open
// if exePath is null, then open the found PDF with the default PDF viewer and
// capture/save the entire name and path of the default PDF viewer
if (exePath == null)
{ {
try try
{ {
System.Diagnostics.Process tp = System.Diagnostics.Process.Start(PDFfileName);
exePath = p.MainModule.FileName; exePath = TryToGetPath(tp);
tp.Kill();
} }
catch (Exception ex) catch (Exception ex)
{ {
Application.DoEvents(); Application.DoEvents();
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); string msg = string.Format("{0} - {1}", ex.GetType().Name, ex.Message);
Console.WriteLine(msg);
MessageBox.Show(msg, "Error opening default PDF Viewer");
return;
} }
} }
p.Kill(); // open the PDF and jump to the page number
} System.Diagnostics.ProcessStartInfo psi1 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A \"page={0}\" \"{1}\" ", pagenum, PDFfileName))
if (list == 1)
{ {
System.Diagnostics.ProcessStartInfo psi1 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A page={0} ", pagenum) + fi1.DirectoryName + "\\" + proc + ".pdf "); UseShellExecute = false
System.Diagnostics.Process p1 = System.Diagnostics.Process.Start(psi1); };
} _ = System.Diagnostics.Process.Start(psi1);
else
{
System.Diagnostics.ProcessStartInfo psi2 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A page={0} ", pagenum) + fi2.DirectoryName + "\\" + proc + ".pdf ");
System.Diagnostics.Process p1 = System.Diagnostics.Process.Start(psi2);
}
} }
/// <summary> /// <summary>
/// Perform Debug Meta file comparison for all of the folders within the automated testing folders /// Perform Debug Meta file comparison for all of the folders within the automated testing folders
@@ -709,11 +774,11 @@ namespace Baseline
private void lbProcedures_SelectedIndexChanged(object sender, EventArgs e) private void lbProcedures_SelectedIndexChanged(object sender, EventArgs e)
{ {
//Initialize Results List Box //Initialize Results List Box
lbResults1.Items.Clear(); if (!(lbProcedures.SelectedItem is Procedure myProc)) return; // clicked on the white space (blank line) in the list of different procedures
Procedure myProc = lbProcedures.SelectedItem as Procedure;
//TODO: May need to consider if there are duplicate procedure numers and titles //TODO: May need to consider if there are duplicate procedure numers and titles
Procedure myProc1 = MyProcs1.Find(x => x.Number == myProc.Number && x.Title == myProc.Title); Procedure myProc1 = MyProcs1.Find(x => x.Number == myProc.Number && x.Title == myProc.Title);
// Build the results ListBox for the left window // Build the results ListBox for the left window
lbResults1.Items.Clear();
if (myProc1 != null) if (myProc1 != null)
{ {
foreach (Page myPage in myProc1.MyPages) foreach (Page myPage in myProc1.MyPages)
@@ -758,27 +823,12 @@ namespace Baseline
}; };
public class Settings public class Settings
{ {
private BindingList<string> _IgnoreLines; public BindingList<string> IgnoreLines { get; set; }
public BindingList<string> IgnoreLines
{
get { return _IgnoreLines; }
set { _IgnoreLines = value; }
}
} }
public partial class FindFile public partial class FindFile
{ {
private string _File1; public string File1 { get; set; }
public string File1 public string File2 { get; set; }
{
get { return _File1; }
set { _File1 = value; }
}
private string _File2;
public string File2
{
get { return _File2; }
set { _File2 = value; }
}
public FindFile(string file1, string file2) public FindFile(string file1, string file2)
{ {
File1 = file1; File1 = file1;
@@ -787,11 +837,8 @@ namespace Baseline
} }
public partial class FindFiles : List<FindFile> public partial class FindFiles : List<FindFile>
{ {
private string _FileName; private readonly string _FileName;
public string FileName public string FileName => _FileName;
{
get { return _FileName; }
}
/// <summary> /// <summary>
/// Build list of DocVersion Folders with differences /// Build list of DocVersion Folders with differences
/// </summary> /// </summary>
@@ -1025,33 +1072,15 @@ namespace Baseline
// Text - the line of text // Text - the line of text
public partial class Procedure public partial class Procedure
{ {
private string _Number; public string Number { get; set; }
public string Number public string Title { get; set; }
{ public Pages MyPages { get; set; } = new Pages();
get { return _Number; }
set { _Number = value; }
}
private string _Title;
public string Title
{
get { return _Title; }
set { _Title = value; }
}
private Pages _MyPages = new Pages();
public Pages MyPages
{
get { return _MyPages; }
set { _MyPages = value; }
}
public Procedure(string number, string title) public Procedure(string number, string title)
{ {
_Number = number; Number = number;
_Title = title; Title = title;
}
public override string ToString()
{
return string.Format("{0} - {1}", Number, Title);
} }
public override string ToString() => string.Format("{0} - {1}", Number, Title);
} }
public partial class Procedures : List<Procedure> public partial class Procedures : List<Procedure>
{ {
@@ -1083,76 +1112,33 @@ namespace Baseline
} }
public partial class Page public partial class Page
{ {
private int _Number; public int Number { get; set; }
public int Number
{
get { return _Number; }
set { _Number = value; }
}
private Lines _MyLines = new Lines();
public Lines MyLines public Lines MyLines { get; set; } = new Lines();
{ public Page(int number) => Number = number;
get { return _MyLines; } public override string ToString() => string.Format("Page {0}", Number);
set { _MyLines = value; }
}
public Page(int number)
{
_Number = number;
}
public override string ToString()
{
return string.Format("Page {0}", Number);
}
} }
public partial class Pages : List<Page> public partial class Pages : List<Page>
{ {
public void Add(int number) public void Add(int number) => Add(new Page(number));
{
Add(new Page(number));
}
} }
public partial class Line public partial class Line
{ {
private Procedure _MyProc; public Procedure MyProc { get; set; }
public Procedure MyProc public Page MyPage { get; set; }
{ public string Text { get; set; }
get { return _MyProc; } public Line(string text) => Text = text;
set { _MyProc = value; }
}
private Page _MyPage;
public Page MyPage
{
get { return _MyPage; }
set { _MyPage = value; }
}
private string _Text;
public string Text
{
get { return _Text; }
set { _Text = value; }
}
public Line(string text)
{
_Text = text;
}
public Line(string text, Procedure myProc, Page myPage) public Line(string text, Procedure myProc, Page myPage)
{ {
_Text = text; Text = text;
_MyProc = myProc; MyProc = myProc;
_MyPage = myPage; MyPage = myPage;
}
public override string ToString()
{
return Text;
} }
public override string ToString() => Text;
} }
public partial class Lines : List<Line> public partial class Lines : List<Line>
{ {
public void Add(string text) public void Add(string text) => Add(new Line(text));
{
Add(new Line(text));
}
} }
[Serializable] [Serializable]
public partial class IgnoreLine public partial class IgnoreLine
@@ -1191,20 +1177,11 @@ namespace Baseline
public IgnoreLines() public IgnoreLines()
{ {
} }
public void Add(string text, Relation searchType, bool active) public void Add(string text, Relation searchType, bool active) => Add(new IgnoreLine(text, searchType, active));
{
Add(new IgnoreLine(text, searchType, active));
}
// Convert IgnoreLines to string (XML) // Convert IgnoreLines to string (XML)
public override string ToString() public override string ToString() => GenericSerializer<IgnoreLines>.StringSerialize(this);
{
return GenericSerializer<IgnoreLines>.StringSerialize(this);
}
// Convert string to IgnoreLines // Convert string to IgnoreLines
public static IgnoreLines Get(string xml) public static IgnoreLines Get(string xml) => GenericSerializer<IgnoreLines>.StringDeserialize(xml);
{
return GenericSerializer<IgnoreLines>.StringDeserialize(xml);
}
} }
/// <summary> /// <summary>
/// This is a simple serializer that takes a class and converts it to and from string (XML) /// This is a simple serializer that takes a class and converts it to and from string (XML)
@@ -1233,7 +1210,7 @@ namespace Baseline
string ss = s.Replace("encoding=\"utf-16\"", ""); string ss = s.Replace("encoding=\"utf-16\"", "");
XmlSerializer xs = new XmlSerializer(typeof(T)); XmlSerializer xs = new XmlSerializer(typeof(T));
UTF8Encoding enc = new UTF8Encoding(); UTF8Encoding enc = new UTF8Encoding();
Byte[] arrBytData = enc.GetBytes(ss); byte[] arrBytData = enc.GetBytes(ss);
using (MemoryStream ms = new MemoryStream(arrBytData)) using (MemoryStream ms = new MemoryStream(arrBytData))
{ {
t = (T)xs.Deserialize(ms); t = (T)xs.Deserialize(ms);
@@ -1248,10 +1225,7 @@ namespace Baseline
{ {
public NonXsiTextWriter(TextWriter w) : base(w) { } public NonXsiTextWriter(TextWriter w) : base(w) { }
public NonXsiTextWriter(Stream w, Encoding encoding) public NonXsiTextWriter(Stream w, Encoding encoding)
: base(w, encoding) : base(w, encoding) => Formatting = Formatting.Indented;
{
this.Formatting = Formatting.Indented;
}
public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { } public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { }
bool _skip = false; bool _skip = false;
public override void WriteStartAttribute(string prefix, string localName, string ns) public override void WriteStartAttribute(string prefix, string localName, string ns)
@@ -1294,32 +1268,16 @@ namespace Baseline
public const short SWP_NOZORDER = 0X4; public const short SWP_NOZORDER = 0X4;
public const int SWP_SHOWWINDOW = 0x0040; public const int SWP_SHOWWINDOW = 0x0040;
private System.Diagnostics.Process _Process; public System.Diagnostics.Process Process { get; set; }
public int X { get; set; }
public System.Diagnostics.Process Process public int Y { get; set; }
{
get { return _Process; }
set { _Process = value; }
}
private int _X;
public int X
{
get { return _X; }
set { _X = value; }
}
private int _Y;
public int Y
{
get { return _Y; }
set { _Y = value; }
}
public ProcessLocation(System.Diagnostics.Process process, int x, int y) public ProcessLocation(System.Diagnostics.Process process, int x, int y)
{ {
Process = process; Process = process;
X = x; X = x;
Y = y; Y = y;
} }
private static Boolean FoxitSettingInfo = true; private static bool FoxitSettingInfo = true;
/// <summary> /// <summary>
/// MoveIt() moves the window containing the PDF viewer to the right so the two pdf viewer windows will not overlap. /// MoveIt() moves the window containing the PDF viewer to the right so the two pdf viewer windows will not overlap.
@@ -1340,10 +1298,7 @@ namespace Baseline
} }
public class ProcessLocationQueue: Queue<ProcessLocation> public class ProcessLocationQueue: Queue<ProcessLocation>
{ {
public void Add(System.Diagnostics.Process process, int x, int y) public void Add(System.Diagnostics.Process process, int x, int y) => Enqueue(new ProcessLocation(process, x, y));
{
Enqueue(new ProcessLocation(process,x,y));
}
public void ProcessNext() public void ProcessNext()
{ {
ProcessLocation pl = Dequeue(); ProcessLocation pl = Dequeue();
+5 -25
View File
@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace Baseline namespace Baseline
@@ -19,17 +12,7 @@ namespace Baseline
set { set {
_MyIgnore = value; _MyIgnore = value;
dgv.DataSource=null; dgv.DataSource=null;
//dgvcSearchType.ValueType = typeof(Relation);
//dgvcSearchType.ValueMember = "Value";
//dgvcSearchType.DisplayMember = "Display";
//dgvcSearchType.DataSource = new Relation[] { Relation.Contains, Relation.StartsWith, Relation.EndsWith, Relation.Regex }
//.Select(x => new { Display = x.ToString(), Value = x })
//.ToList();
dgv.DataSource=value; dgv.DataSource=value;
//dgvcSearchType.DataSource =
//new List<Relation>((Relation[]) Enum.GetValues(typeof(Relation)))
//.Select(x => new { Display=x.ToString(), Value=(int)x })
//.ToList();;
} }
} }
public frmSettings(IgnoreLines myIgnore) public frmSettings(IgnoreLines myIgnore)
@@ -46,19 +29,16 @@ namespace Baseline
col.ValueType = typeof(Relation); col.ValueType = typeof(Relation);
} }
private void dgv_DataError(object sender, DataGridViewDataErrorEventArgs e) private void dgv_DataError(object sender, DataGridViewDataErrorEventArgs e) => Console.WriteLine("Here");
{
Console.WriteLine("Here");
}
private void btnOK_Click(object sender, EventArgs e) private void btnOK_Click(object sender, EventArgs e)
{ {
this.DialogResult = System.Windows.Forms.DialogResult.OK; DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close(); Close();
} }
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)
{ {
this.DialogResult = System.Windows.Forms.DialogResult.Cancel; DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close(); Close();
} }
} }
} }
+10 -23
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@@ -15,7 +14,7 @@ namespace AT.STO.UI.Win
{ {
#region Private Variable Declarations #region Private Variable Declarations
private IDropDownAware _dropDownControl = null; private IDropDownAware _dropDownControl = null;
private DropDownWindowHelper _dropDownHelper = null; private readonly DropDownWindowHelper _dropDownHelper = null;
private Form _owner = null; private Form _owner = null;
#endregion #endregion
#region Constructor / Destructor #region Constructor / Destructor
@@ -47,7 +46,7 @@ namespace AT.STO.UI.Win
/// <param name="e"></param> /// <param name="e"></param>
protected override void OnHandleCreated(EventArgs e) protected override void OnHandleCreated(EventArgs e)
{ {
_owner = this.FindForm(); _owner = FindForm();
_dropDownHelper.ReleaseHandle(); _dropDownHelper.ReleaseHandle();
if (_owner != null) if (_owner != null)
@@ -66,8 +65,8 @@ namespace AT.STO.UI.Win
{ {
base.OnResize(e); base.OnResize(e);
combo.Location = new Point(0, 0); combo.Location = new Point(0, 0);
combo.Width = this.ClientRectangle.Width; combo.Width = ClientRectangle.Width;
this.Height = combo.Height; Height = combo.Height;
} }
#endregion #endregion
#region Event Handler #region Event Handler
@@ -96,7 +95,7 @@ namespace AT.STO.UI.Win
else else
{ {
_dropDownHelper.CloseDropDown(); _dropDownHelper.CloseDropDown();
this.Focus(); Focus();
} }
} }
@@ -115,7 +114,7 @@ namespace AT.STO.UI.Win
private void DropDownHelper_DropDownCancel(object sender, DropDownCancelEventArgs e) private void DropDownHelper_DropDownCancel(object sender, DropDownCancelEventArgs e)
{ {
if (this.Bounds.Contains(Parent.PointToClient(e.CursorLocation))) if (Bounds.Contains(Parent.PointToClient(e.CursorLocation)))
{ {
e.Cancel = true; e.Cancel = true;
} }
@@ -138,23 +137,14 @@ namespace AT.STO.UI.Win
SetValue<long>(e.Value as ILookupItem<long>); SetValue<long>(e.Value as ILookupItem<long>);
} }
if (this.FinishEditing != null) FinishEditing?.Invoke(this, e);
{
this.FinishEditing(this, e);
}
_dropDownControl.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing); _dropDownControl.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing);
_dropDownControl.ValueChanged -= new DropDownValueChangedEventHandler(DropDown_ValueChanged); _dropDownControl.ValueChanged -= new DropDownValueChangedEventHandler(DropDown_ValueChanged);
_dropDownHelper.CloseDropDown(); _dropDownHelper.CloseDropDown();
} }
private void DropDown_ValueChanged(object sender, DropDownValueChangedEventArgs e) private void DropDown_ValueChanged(object sender, DropDownValueChangedEventArgs e) => ValueChanged?.Invoke(this, e);
{
if (this.ValueChanged != null)
{
this.ValueChanged(this, e);
}
}
#endregion #endregion
#region Public Properties #region Public Properties
/// <summary> /// <summary>
@@ -169,15 +159,12 @@ namespace AT.STO.UI.Win
{ {
_dropDownControl = value; _dropDownControl = value;
this.Controls.Add(_dropDownControl as Control); Controls.Add(_dropDownControl as Control);
} }
} }
#endregion #endregion
#region Public Methods #region Public Methods
public override string ToString() public override string ToString() => Name;
{
return this.Name;
}
#endregion #endregion
#region Private Methods #region Private Methods
/// <summary> /// <summary>
+10 -35
View File
@@ -36,9 +36,8 @@ namespace AT.STO.UI.Win
public class DropDownCancelEventArgs : EventArgs public class DropDownCancelEventArgs : EventArgs
{ {
#region Private Variable Declarations #region Private Variable Declarations
private bool _cancel = false;
private Point _cursorLocation; private Point _cursorLocation;
private Form _dropDown = null; private readonly Form _dropDown = null;
#endregion #endregion
#region Constructor / Destructor #region Constructor / Destructor
/// <summary> /// <summary>
@@ -51,34 +50,24 @@ namespace AT.STO.UI.Win
{ {
_dropDown = DropDown; _dropDown = DropDown;
_cursorLocation = CursorLocation; _cursorLocation = CursorLocation;
_cancel = false; Cancel = false;
} }
#endregion #endregion
#region Public Properties #region Public Properties
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public bool Cancel public bool Cancel { get; set; } = false;
{
get { return _cancel; }
set { _cancel = value; }
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Point CursorLocation public Point CursorLocation => _cursorLocation;
{
get { return _cursorLocation; }
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Form DropDown public Form DropDown => _dropDown;
{
get { return _dropDown; }
}
#endregion #endregion
} }
@@ -91,7 +80,7 @@ namespace AT.STO.UI.Win
public class DropDownClosedEventArgs : EventArgs public class DropDownClosedEventArgs : EventArgs
{ {
#region Private Variable Declarations #region Private Variable Declarations
private Form _dropDown = null; private readonly Form _dropDown = null;
#endregion #endregion
#region Constructor / Destructor #region Constructor / Destructor
/// <summary> /// <summary>
@@ -99,19 +88,13 @@ namespace AT.STO.UI.Win
/// popup form. /// popup form.
/// </summary> /// </summary>
/// <param name="DropDown">DropDown Form which is being closed.</param> /// <param name="DropDown">DropDown Form which is being closed.</param>
public DropDownClosedEventArgs(Form DropDown) public DropDownClosedEventArgs(Form DropDown) => _dropDown = DropDown;
{
_dropDown = DropDown;
}
#endregion #endregion
#region Public Properties #region Public Properties
/// <summary> /// <summary>
/// Gets the dropdown form which is being closed. /// Gets the dropdown form which is being closed.
/// </summary> /// </summary>
public Form DropDown public Form DropDown => _dropDown;
{
get { return _dropDown; }
}
#endregion #endregion
} }
@@ -121,7 +104,6 @@ namespace AT.STO.UI.Win
public class DropDownValueChangedEventArgs : EventArgs public class DropDownValueChangedEventArgs : EventArgs
{ {
#region Private Variable Declarations #region Private Variable Declarations
private object _value = null;
#endregion #endregion
#region Constructor / Destructor #region Constructor / Destructor
/// <summary> /// <summary>
@@ -135,20 +117,13 @@ namespace AT.STO.UI.Win
/// Initialization with the control's value. /// Initialization with the control's value.
/// </summary> /// </summary>
/// <param name="Value"></param> /// <param name="Value"></param>
public DropDownValueChangedEventArgs(object Value) public DropDownValueChangedEventArgs(object Value) => this.Value = Value;
{
_value = Value;
}
#endregion #endregion
#region Public Properties #region Public Properties
/// <summary> /// <summary>
/// Gets or sets the control's value. /// Gets or sets the control's value.
/// </summary> /// </summary>
public object Value public object Value { get; set; } = null;
{
get { return _value; }
set { _value = value; }
}
#endregion #endregion
} }
} }
+9 -21
View File
@@ -13,16 +13,13 @@ namespace AT.STO.UI.Win
internal partial class DropDownForm : Form, IDropDownAware internal partial class DropDownForm : Form, IDropDownAware
{ {
#region Private Variable Declaration #region Private Variable Declaration
private IDropDownAware _control = null; private readonly IDropDownAware _control = null;
#endregion #endregion
#region Constructor / Destructor #region Constructor / Destructor
/// <summary> /// <summary>
/// Default Constructor /// Default Constructor
/// </summary> /// </summary>
public DropDownForm() public DropDownForm() => InitializeComponent();
{
InitializeComponent();
}
/// <summary> /// <summary>
/// Constructor to initialize the for with the control to display. /// Constructor to initialize the for with the control to display.
@@ -41,7 +38,7 @@ namespace AT.STO.UI.Win
#region Form Events #region Form Events
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
{ {
this.Controls.Remove(_control as Control); Controls.Remove(_control as Control);
base.OnClosing(e); base.OnClosing(e);
} }
@@ -58,22 +55,13 @@ namespace AT.STO.UI.Win
#region Event Handler #region Event Handler
private void Ctrl_FinishEditing(object sender, DropDownValueChangedEventArgs e) private void Ctrl_FinishEditing(object sender, DropDownValueChangedEventArgs e)
{ {
if (this.FinishEditing != null) FinishEditing?.Invoke(this, e);
{
this.FinishEditing(this, e);
}
_control.FinishEditing -= new DropDownValueChangedEventHandler(Ctrl_FinishEditing); _control.FinishEditing -= new DropDownValueChangedEventHandler(Ctrl_FinishEditing);
_control.ValueChanged -= new DropDownValueChangedEventHandler(Ctrl_ValueChanged); _control.ValueChanged -= new DropDownValueChangedEventHandler(Ctrl_ValueChanged);
} }
private void Ctrl_ValueChanged(object sender, DropDownValueChangedEventArgs e) private void Ctrl_ValueChanged(object sender, DropDownValueChangedEventArgs e) => ValueChanged?.Invoke(this, e);
{
if (this.ValueChanged != null)
{
this.ValueChanged(this, e);
}
}
#endregion #endregion
#region IDropDownAware Implementation #region IDropDownAware Implementation
/// <summary> /// <summary>
@@ -100,15 +88,15 @@ namespace AT.STO.UI.Win
private void InitializeControl(Control Ctrl) private void InitializeControl(Control Ctrl)
{ {
Size size = Ctrl.Size; Size size = Ctrl.Size;
Size inner = this.ClientRectangle.Size; Size inner = ClientRectangle.Size;
Size outer = this.Size; Size outer = Size;
int gap = outer.Width - inner.Width; int gap = outer.Width - inner.Width;
size.Width += gap; size.Width += gap;
size.Height += gap; size.Height += gap;
this.Size = size; Size = size;
this.Controls.Add(Ctrl); Controls.Add(Ctrl);
Ctrl.Location = new Point(0, 0); Ctrl.Location = new Point(0, 0);
Ctrl.Visible = true; Ctrl.Visible = true;
Ctrl.Invalidate(); Ctrl.Invalidate();
@@ -1,4 +1,3 @@
using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@@ -23,8 +22,7 @@ namespace AT.STO.UI.Win
private const int WM_NCMBUTTONDOWN = 0x0A7; private const int WM_NCMBUTTONDOWN = 0x0A7;
#endregion #endregion
#region Private Variable Declarations #region Private Variable Declarations
private Form _dropDown = null; private readonly DropDownWindowHelper _owner = null;
private DropDownWindowHelper _owner = null;
#endregion #endregion
#region Event Declarations #region Event Declarations
public event DropDownCancelEventHandler DropDownCancel; public event DropDownCancelEventHandler DropDownCancel;
@@ -36,44 +34,34 @@ namespace AT.STO.UI.Win
/// </summary> /// </summary>
/// <param name="Owner">The <see cref="DropDownWindowHelper"/> object /// <param name="Owner">The <see cref="DropDownWindowHelper"/> object
/// which owns this class.</param> /// which owns this class.</param>
public DropDownMessageFilter(DropDownWindowHelper Owner) public DropDownMessageFilter(DropDownWindowHelper Owner) => _owner = Owner;
{
_owner = Owner;
}
#endregion #endregion
#region Public Properties #region Public Properties
/// <summary> /// <summary>
/// Gets/sets the dropdown form which is being displayed. /// Gets/sets the dropdown form which is being displayed.
/// </summary> /// </summary>
public Form DropDown public Form DropDown { get; set; } = null;
{
get { return _dropDown; }
set { _dropDown = value; }
}
#endregion #endregion
#region Private Methods #region Private Methods
private void OnMouseDown() private void OnMouseDown()
{ {
Point cursorPos = Cursor.Position; // Get the cursor location Point cursorPos = Cursor.Position; // Get the cursor location
if (!_dropDown.Bounds.Contains(cursorPos)) // Check if it is within the popup form if (!DropDown.Bounds.Contains(cursorPos)) // Check if it is within the popup form
{ {
OnDropDownCancel(new DropDownCancelEventArgs(_dropDown, cursorPos)); // If not, then call to see if it should be closed OnDropDownCancel(new DropDownCancelEventArgs(DropDown, cursorPos)); // If not, then call to see if it should be closed
} }
} }
#endregion #endregion
#region DropDownCancelEvent Implementation #region DropDownCancelEvent Implementation
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e) protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
{ {
if (this.DropDownCancel != null) DropDownCancel?.Invoke(this, e);
{
this.DropDownCancel(this, e);
}
if (!e.Cancel) if (!e.Cancel)
{ {
_owner.CloseDropDown(); _owner.CloseDropDown();
_dropDown = null; // Clear reference for GC DropDown = null; // Clear reference for GC
} }
} }
#endregion #endregion
@@ -90,7 +78,7 @@ namespace AT.STO.UI.Win
/// This implementation always returns <c>false</c>.</returns> /// This implementation always returns <c>false</c>.</returns>
public bool PreFilterMessage(ref Message m) public bool PreFilterMessage(ref Message m)
{ {
if (_dropDown != null) if (DropDown != null)
{ {
switch (m.Msg) switch (m.Msg)
{ {
@@ -1,6 +1,5 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
namespace AT.STO.UI.Win namespace AT.STO.UI.Win
@@ -22,7 +21,7 @@ namespace AT.STO.UI.Win
private Form _dropDown = null; private Form _dropDown = null;
private bool _dropDownShowing = false; private bool _dropDownShowing = false;
private DropDownMessageFilter _filter = null; private readonly DropDownMessageFilter _filter = null;
private Form _owner = null; private Form _owner = null;
private bool _skipClose = false; private bool _skipClose = false;
#endregion #endregion
@@ -44,10 +43,7 @@ namespace AT.STO.UI.Win
} }
#endregion #endregion
#region Event Handler #region Event Handler
private void Popup_Cancel(object sender, DropDownCancelEventArgs e) private void Popup_Cancel(object sender, DropDownCancelEventArgs e) => OnDropDownCancel(e);
{
OnDropDownCancel(e);
}
/// <summary> /// <summary>
/// Responds to the <see cref="System.Windows.Forms.Form.Closed"/> /// Responds to the <see cref="System.Windows.Forms.Form.Closed"/>
@@ -55,10 +51,7 @@ namespace AT.STO.UI.Win
/// </summary> /// </summary>
/// <param name="sender">Popup form that has been closed.</param> /// <param name="sender">Popup form that has been closed.</param>
/// <param name="e">Not used.</param> /// <param name="e">Not used.</param>
private void Popup_Closed(object sender, EventArgs e) private void Popup_Closed(object sender, EventArgs e) => CloseDropDown();
{
CloseDropDown();
}
/// <summary> /// <summary>
/// Subclasses the owning form's existing Window Procedure to enables the /// Subclasses the owning form's existing Window Procedure to enables the
@@ -76,7 +69,7 @@ namespace AT.STO.UI.Win
{ {
if (((int)m.WParam) == 0) // Check if the title bar will made inactive: if (((int)m.WParam) == 0) // Check if the title bar will made inactive:
{ // Note it's no good to try and consume this message; if you try to do that you'll end up with windows { // Note it's no good to try and consume this message; if you try to do that you'll end up with windows
UIApiCalls.SendMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it. UIApiCalls.SendMessage(Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it.
} }
} }
else if (m.Msg == UIApiCalls.WM_ACTIVATEAPP) else if (m.Msg == UIApiCalls.WM_ACTIVATEAPP)
@@ -84,7 +77,7 @@ namespace AT.STO.UI.Win
if ((int)m.WParam == 0) // Check if the application is being deactivated. if ((int)m.WParam == 0) // Check if the application is being deactivated.
{ {
CloseDropDown(); // It is so cancel the popup: CloseDropDown(); // It is so cancel the popup:
UIApiCalls.PostMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state: UIApiCalls.PostMessage(Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state:
} }
} }
} }
@@ -173,17 +166,14 @@ namespace AT.STO.UI.Win
/// <summary> /// <summary>
/// Indicator weither the DropDown is showing. /// Indicator weither the DropDown is showing.
/// </summary> /// </summary>
public bool DropDownShowing public bool DropDownShowing => _dropDownShowing;
{
get { return _dropDownShowing; }
}
#endregion #endregion
#region Event Implementation #region Event Implementation
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e) protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
{ {
if (this.DropDownCancel != null) if (DropDownCancel != null)
{ {
this.DropDownCancel(this, e); DropDownCancel(this, e);
if (!e.Cancel) if (!e.Cancel)
{ {
@@ -192,13 +182,7 @@ namespace AT.STO.UI.Win
} }
} }
protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e) protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e) => DropDownClosed?.Invoke(this, e);
{
if (this.DropDownClosed != null)
{
this.DropDownClosed(this, e);
}
}
#endregion #endregion
} }
} }
@@ -1,5 +1,3 @@
using System;
namespace AT.STO.UI.Win namespace AT.STO.UI.Win
{ {
/// <summary> /// <summary>
@@ -1,5 +1,3 @@
using System;
namespace AT.STO.UI.Win namespace AT.STO.UI.Win
{ {
public interface ILookupItem<T> where T: struct public interface ILookupItem<T> where T: struct
+35 -64
View File
@@ -1,8 +1,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Globalization;
//using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@@ -121,10 +119,7 @@ namespace JR.Utils.GUI.Forms
/// </summary> /// </summary>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(string text) public static DialogResult Show(string text) => FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -132,10 +127,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="owner">The owner.</param> /// <param name="owner">The owner.</param>
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text) public static DialogResult Show(IWin32Window owner, string text) => FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -143,10 +135,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="caption">The caption.</param> /// <param name="caption">The caption.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(string text, string caption) public static DialogResult Show(string text, string caption) => FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -155,10 +144,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="text">The text.</param> /// <param name="text">The text.</param>
/// <param name="caption">The caption.</param> /// <param name="caption">The caption.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption) public static DialogResult Show(IWin32Window owner, string text, string caption) => FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -167,10 +153,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="caption">The caption.</param> /// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param> /// <param name="buttons">The buttons.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -180,10 +163,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="caption">The caption.</param> /// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param> /// <param name="buttons">The buttons.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons) public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -193,10 +173,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="buttons">The buttons.</param> /// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param> /// <param name="icon">The icon.</param>
/// <returns></returns> /// <returns></returns>
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -207,10 +184,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="buttons">The buttons.</param> /// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param> /// <param name="icon">The icon.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
{
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -221,10 +195,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="icon">The icon.</param> /// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param> /// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
{
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -236,10 +207,7 @@ namespace JR.Utils.GUI.Forms
/// <param name="icon">The icon.</param> /// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param> /// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
{
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
}
/// <summary> /// <summary>
/// Shows the specified message box. /// Shows the specified message box.
@@ -251,10 +219,8 @@ namespace JR.Utils.GUI.Forms
/// <param name="icon">The icon.</param> /// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param> /// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping owner for legacy reasons")]
{ public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.ShowCustom(null, text, caption, buttons, icon);
return FlexibleMessageBoxForm.ShowCustom(null, text, caption, buttons, icon);
}
#endregion #endregion
@@ -341,7 +307,7 @@ namespace JR.Utils.GUI.Forms
this.richTextBoxMessage.TabIndex = 0; this.richTextBoxMessage.TabIndex = 0;
this.richTextBoxMessage.TabStop = false; this.richTextBoxMessage.TabStop = false;
this.richTextBoxMessage.Text = "<Message>"; this.richTextBoxMessage.Text = "<Message>";
this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxMessage_LinkClicked); this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RichTextBoxMessage_LinkClicked);
// //
// panel1 // panel1
// //
@@ -431,8 +397,8 @@ namespace JR.Utils.GUI.Forms
#region Private constants #region Private constants
//These separators are used for the "copy to clipboard" standard operation, triggered by Ctrl + C (behavior and clipboard format is like in a standard MessageBox) //These separators are used for the "copy to clipboard" standard operation, triggered by Ctrl + C (behavior and clipboard format is like in a standard MessageBox)
private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n"; private static readonly string STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n";
private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " "; private static readonly string STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " ";
//These are the possible buttons (in a standard MessageBox) //These are the possible buttons (in a standard MessageBox)
private enum ButtonID { OK = 0, CANCEL, YES, NO, ABORT, RETRY, IGNORE, OVERWRITE, RENAME }; private enum ButtonID { OK = 0, CANCEL, YES, NO, ABORT, RETRY, IGNORE, OVERWRITE, RENAME };
@@ -440,10 +406,10 @@ namespace JR.Utils.GUI.Forms
//These are the buttons texts for different languages. //These are the buttons texts for different languages.
//If you want to add a new language, add it here and in the GetButtonText-Function //If you want to add a new language, add it here and in the GetButtonText-Function
private enum TwoLetterISOLanguageID { en, de, es, it }; private enum TwoLetterISOLanguageID { en, de, es, it };
private static readonly String[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore", "&Overwrite", "&Rename" }; //Note: This is also the fallback language private static readonly string[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore", "&Overwrite", "&Rename" }; //Note: This is also the fallback language
private static readonly String[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren", "&Overwrite", "&Rename" }; private static readonly string[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren", "&Overwrite", "&Rename" };
private static readonly String[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&Sí", "&No", "&Abortar", "&Reintentar", "&Ignorar", "&Overwrite", "&Rename" }; private static readonly string[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&Sí", "&No", "&Abortar", "&Reintentar", "&Ignorar", "&Overwrite", "&Rename" };
private static readonly String[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora", "&Overwrite", "&Rename" }; private static readonly string[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora", "&Overwrite", "&Rename" };
#endregion #endregion
@@ -451,7 +417,7 @@ namespace JR.Utils.GUI.Forms
private MessageBoxDefaultButton defaultButton; private MessageBoxDefaultButton defaultButton;
private int visibleButtonsCount; private int visibleButtonsCount;
private TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en; private readonly TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en;
#endregion #endregion
@@ -758,9 +724,9 @@ namespace JR.Utils.GUI.Forms
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void FlexibleMessageBoxForm_Shown(object sender, EventArgs e) private void FlexibleMessageBoxForm_Shown(object sender, EventArgs e)
{ {
int buttonIndexToFocus = 1;
Button buttonToFocus; Button buttonToFocus;
int buttonIndexToFocus;
//Set the default button... //Set the default button...
switch (this.defaultButton) switch (this.defaultButton)
{ {
@@ -799,7 +765,7 @@ namespace JR.Utils.GUI.Forms
/// </summary> /// </summary>
/// <param name="sender">The source of the event.</param> /// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Forms.LinkClickedEventArgs"/> instance containing the event data.</param> /// <param name="e">The <see cref="System.Windows.Forms.LinkClickedEventArgs"/> instance containing the event data.</param>
private void richTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e) private void RichTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e)
{ {
try try
{ {
@@ -877,12 +843,14 @@ namespace JR.Utils.GUI.Forms
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{ {
//Create a new instance of the FlexibleMessageBox form //Create a new instance of the FlexibleMessageBox form
var flexibleMessageBoxForm = new FlexibleMessageBoxForm(); var flexibleMessageBoxForm = new FlexibleMessageBoxForm
flexibleMessageBoxForm.ShowInTaskbar = false; {
ShowInTaskbar = false,
//Bind the caption and the message text //Bind the caption and the message text
flexibleMessageBoxForm.CaptionText = caption; CaptionText = caption,
flexibleMessageBoxForm.MessageText = text; MessageText = text
};
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm; flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
//Set the buttons visibilities and texts. Also set a default button. //Set the buttons visibilities and texts. Also set a default button.
@@ -914,15 +882,18 @@ namespace JR.Utils.GUI.Forms
/// <param name="icon">The icon.</param> /// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param> /// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns> /// <returns>The dialog result.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping buttons for legacy reasons")]
public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{ {
//Create a new instance of the FlexibleMessageBox form //Create a new instance of the FlexibleMessageBox form
var flexibleMessageBoxForm = new FlexibleMessageBoxForm(); var flexibleMessageBoxForm = new FlexibleMessageBoxForm
flexibleMessageBoxForm.ShowInTaskbar = false; {
ShowInTaskbar = false,
//Bind the caption and the message text //Bind the caption and the message text
flexibleMessageBoxForm.CaptionText = caption; CaptionText = caption,
flexibleMessageBoxForm.MessageText = text; MessageText = text
};
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm; flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
//Set the buttons visibilities and texts. Also set a default button. //Set the buttons visibilities and texts. Also set a default button.
+2
View File
@@ -66,6 +66,7 @@
<Compile Include="frmFormatCopy.Designer.cs"> <Compile Include="frmFormatCopy.Designer.cs">
<DependentUpon>frmFormatCopy.cs</DependentUpon> <DependentUpon>frmFormatCopy.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmFormatCopy.resx"> <EmbeddedResource Include="frmFormatCopy.resx">
@@ -179,6 +180,7 @@
<Content Include="fmtall\CPL_00all.xml" /> <Content Include="fmtall\CPL_00all.xml" />
<Content Include="fmtall\CPL_01all.xml" /> <Content Include="fmtall\CPL_01all.xml" />
<Content Include="fmtall\CPL_02all.xml" /> <Content Include="fmtall\CPL_02all.xml" />
<Content Include="fmtall\CPL_04all.xml" />
<Content Include="fmtall\CPL_03all.xml" /> <Content Include="fmtall\CPL_03all.xml" />
<Content Include="fmtall\CPSAMGDataall.xml" /> <Content Include="fmtall\CPSAMGDataall.xml" />
<Content Include="fmtall\CPSAMGDEVall.xml" /> <Content Include="fmtall\CPSAMGDEVall.xml" />
+8
View File
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
-1
View File
@@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
namespace Formats namespace Formats
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10 -19
View File
@@ -1,9 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@@ -28,7 +23,7 @@ namespace Formats
txbxPROMSFormatsPath.Text = savedFormatPath; txbxPROMSFormatsPath.Text = savedFormatPath;
else else
{ {
string curFolder = Environment.CurrentDirectory; // C:\development/PROMS/Formats/bin/debug string curFolder = Environment.CurrentDirectory; // .../PROMS/Formats/bin/debug
int idx = curFolder.ToUpper().IndexOf(@"\PROMS\"); int idx = curFolder.ToUpper().IndexOf(@"\PROMS\");
txbxPROMSFormatsPath.Text = curFolder.Substring(0, idx); txbxPROMSFormatsPath.Text = curFolder.Substring(0, idx);
} }
@@ -40,8 +35,7 @@ namespace Formats
DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo di = new DirectoryInfo(path);
if (di.Exists == false) //return; if (di.Exists == false) //return;
{ {
DialogResult dlgrslt = DialogResult.No; DialogResult dlgrslt = MessageBox.Show(string.Format("{0} does not exist. Create it?", path), "Create Folder?", MessageBoxButtons.YesNo);
dlgrslt = MessageBox.Show(string.Format("{0} does not exist. Create it?", path), "Create Folder?", MessageBoxButtons.YesNo);
if (dlgrslt == DialogResult.Yes) if (dlgrslt == DialogResult.Yes)
{ {
di.Create(); di.Create();
@@ -86,9 +80,10 @@ namespace Formats
private void btnBrowse_Click(object sender, EventArgs e) private void btnBrowse_Click(object sender, EventArgs e)
{ {
FolderBrowserDialog fbd = new FolderBrowserDialog(); FolderBrowserDialog fbd = new FolderBrowserDialog
{
fbd.SelectedPath = txbxPROMSFormatsPath.Text; SelectedPath = txbxPROMSFormatsPath.Text
};
if (fbd.ShowDialog() == DialogResult.OK) if (fbd.ShowDialog() == DialogResult.OK)
{ {
if (Directory.Exists(fbd.SelectedPath)) txbxPROMSFormatsPath.Text = fbd.SelectedPath + @"\"; if (Directory.Exists(fbd.SelectedPath)) txbxPROMSFormatsPath.Text = fbd.SelectedPath + @"\";
@@ -116,9 +111,9 @@ namespace Formats
if (!txbxPROMSFormatsPath.Text.EndsWith(@"\")) txbxPROMSFormatsPath.Text += @"\"; if (!txbxPROMSFormatsPath.Text.EndsWith(@"\")) txbxPROMSFormatsPath.Text += @"\";
// There should be a "fmtall" and "genmacall" folder in the delelopment project folder // There should be a "fmtall" and "genmacall" folder in the delelopment project folder
// ex: C:\development\PROMS\Formats\fmtall and C:\development\PROMS\Formats\genmacall // ex: ...\PROMS\Formats\fmtall and ...\PROMS\Formats\genmacall
string destFmtallPath = txbxPROMSFormatsPath.Text + @"fmtall\"; string destFmtallPath = $@"{txbxPROMSFormatsPath.Text}fmtall\";
string destGenmacallPath = txbxPROMSFormatsPath.Text + @"genmacall\"; string destGenmacallPath = $@"{txbxPROMSFormatsPath.Text}genmacall\";
string srcFmtallPath = @"..\..\"; // up to levels from startup path string srcFmtallPath = @"..\..\"; // up to levels from startup path
// clear the destination fmtall and genmacall folders // clear the destination fmtall and genmacall folders
@@ -156,14 +151,10 @@ namespace Formats
} }
Properties.Settings.Default.FormatPath = txbxPROMSFormatsPath.Text.Substring(0,txbxPROMSFormatsPath.Text.Length-1); // save the copy format path minus the ending backslash Properties.Settings.Default.FormatPath = txbxPROMSFormatsPath.Text.Substring(0,txbxPROMSFormatsPath.Text.Length-1); // save the copy format path minus the ending backslash
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
//if(MessageBox.Show("Do you want to end the Format Copier?","Formats Copied.", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)
Application.Exit(); Application.Exit();
} }
private void buttonX2_Click(object sender, EventArgs e) private void buttonX2_Click(object sender, EventArgs e) => Application.Exit();
{
Application.Exit();
}
} }
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
File diff suppressed because it is too large Load Diff
+40 -427
View File
@@ -1,11 +1,11 @@
using Microsoft.Win32;
using Read64bitRegistryFrom32bitApp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Reflection; using System.Reflection;
using Microsoft.Win32; using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Read64bitRegistryFrom32bitApp; using System.Windows.Forms;
namespace LBWordLibrary namespace LBWordLibrary
{ {
@@ -18,14 +18,8 @@ namespace LBWordLibrary
/// <param name="Background">boolean BackGround /// <param name="Background">boolean BackGround
/// If true - document will be printed in the background /// If true - document will be printed in the background
/// If false - document will be printed in the foreground</param> /// If false - document will be printed in the foreground</param>
public void PrintOut(Boolean Background) public void PrintOut(bool Background) => InvokeMethod("PrintOut", Background, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
{ public void Quit(bool save) => InvokeMethod("Quit", save, Missing.Value, Missing.Value);
InvokeMethod("PrintOut", Background, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
}
public void Quit(bool save)
{
InvokeMethod("Quit", save, Missing.Value, Missing.Value);
}
public bool VolianPDFInstalled public bool VolianPDFInstalled
{ {
get get
@@ -51,63 +45,23 @@ namespace LBWordLibrary
string keyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E5C161912A2A6C4C93C76678926C56C"; string keyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E5C161912A2A6C4C93C76678926C56C";
bool validKey = RegistryWOW6432.CheckRegKey64Valid(RegHive.HKEY_LOCAL_MACHINE, keyPath); bool validKey = RegistryWOW6432.CheckRegKey64Valid(RegHive.HKEY_LOCAL_MACHINE, keyPath);
_WordPDFExporterInstalled = validKey; _WordPDFExporterInstalled = validKey;
if(!validKey) if (!validKey)
_MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Missing"); _MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Missing");
//RegistryKey key = Registry.LocalMachine.OpenSubKey(keyPath, RegistryKeyPermissionCheck.ReadSubTree);
//if (key == null) return (bool)_WordPDFExporterInstalled;
//{
// RegistryKey localMachine64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
// key = localMachine64.OpenSubKey(keystring, RegistryKeyPermissionCheck.ReadSubTree);
//}
//if (key != null)
//{
// key.Close();
// _WordPDFExporterInstalled = true;
// return (bool) _WordPDFExporterInstalled;
//}
//_WordPDFExporterInstalled = FindEXP_PDF();
return (bool) _WordPDFExporterInstalled;
} }
catch (Exception ex) catch (Exception ex)
{ {
_MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Failure {0} - {1}", ex.GetType().Name, ex.Message); _MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Failure {0} - {1}", ex.GetType().Name, ex.Message);
_WordPDFExporterInstalled = false; _WordPDFExporterInstalled = false;
return (bool) _WordPDFExporterInstalled; return (bool)_WordPDFExporterInstalled;
} }
} }
return (bool) _WordPDFExporterInstalled; return (bool)_WordPDFExporterInstalled;
} }
} }
private static bool FindEXP_PDF()
{
bool retval = false;
DateTime dtStart = DateTime.Now;
try
{
//string keystr = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E5C161912A2A6C4C93C76678926C56C";
RegistryKey key = null;
string keystr = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components";
while (key == null && keystr != "")
{
key = Registry.LocalMachine.OpenSubKey(keystr, RegistryKeyPermissionCheck.ReadSubTree);
keystr = keystr.Substring(0, keystr.LastIndexOf("\\"));
}
if (FindKeys(key, "EXP_PDF.DLL"))
retval = true;
}
catch (Exception ex)
{
AddKeyFound(string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
}
finally
{
DateTime dtEnd = DateTime.Now;
TimeSpan ts = TimeSpan.FromTicks(dtEnd.Ticks - dtStart.Ticks);
AddKeyFound(string.Format("{0} Seconds", ts.TotalSeconds));
}
return retval;
}
private static bool FindKeys(RegistryKey key, string find) private static bool FindKeys(RegistryKey key, string find)
{ {
string[] keyNames = key.GetSubKeyNames(); string[] keyNames = key.GetSubKeyNames();
@@ -144,10 +98,7 @@ namespace LBWordLibrary
} }
return false; return false;
} }
private static void AddKeyFound(string str) private static void AddKeyFound(string str) => _MyLog.WarnFormat("RegistryKeySearch: {0}", str);
{
_MyLog.WarnFormat("RegistryKeySearch: {0}",str);
}
private bool CanCreatePDFFile(string pdfFileName) private bool CanCreatePDFFile(string pdfFileName)
{ {
System.IO.FileInfo file = new System.IO.FileInfo(pdfFileName); System.IO.FileInfo file = new System.IO.FileInfo(pdfFileName);
@@ -178,20 +129,18 @@ namespace LBWordLibrary
} }
throw new Exception("Cannot find a name to use"); throw new Exception("Cannot find a name to use");
} }
public string CreatePDF(string pdfFileName, bool openPDF,int DebugStatus) public string CreatePDF(string pdfFileName, bool openPDF, int DebugStatus)
{ {
pdfFileName = CreatePDF(pdfFileName, DebugStatus); pdfFileName = CreatePDF(pdfFileName, DebugStatus);
if (openPDF) OpenPDF(pdfFileName); if (openPDF) OpenPDF(pdfFileName);
return pdfFileName; return pdfFileName;
} }
static List<System.Diagnostics.Process> _AcrobatProcesses=new List<System.Diagnostics.Process>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static void OpenPDF(string pdfFileName) static List<System.Diagnostics.Process> _AcrobatProcesses = new List<System.Diagnostics.Process>();
{ private static void OpenPDF(string pdfFileName) => _AcrobatProcesses.Add(System.Diagnostics.Process.Start(pdfFileName));
_AcrobatProcesses.Add(System.Diagnostics.Process.Start(pdfFileName));
}
public static void ClosePDFs() public static void ClosePDFs()
{ {
foreach(System.Diagnostics.Process proc in _AcrobatProcesses) foreach (System.Diagnostics.Process proc in _AcrobatProcesses)
if (!proc.HasExited) if (!proc.HasExited)
KillAndWait(proc); KillAndWait(proc);
} }
@@ -206,7 +155,7 @@ namespace LBWordLibrary
Application.DoEvents(); Application.DoEvents();
} }
Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime
,TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds); , TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds);
} }
public string CreatePDF(string pdfFileName, int DebugStatus) public string CreatePDF(string pdfFileName, int DebugStatus)
{ {
@@ -223,12 +172,7 @@ namespace LBWordLibrary
_MyLog.WarnFormat("Using VolianPDFWriter - MSWord Version = '{0}'", Version); _MyLog.WarnFormat("Using VolianPDFWriter - MSWord Version = '{0}'", Version);
return CreatePDF2003BG(pdfFileName); return CreatePDF2003BG(pdfFileName);
} }
//else // Force PDF Export
//{
// _MyLog.WarnFormat("Force PDF Export for Michelle - MSWord Version = '{0}'", Version);
// return CreatePDF2007(pdfFileName, DebugStatus);
throw new Exception("No PDF Writer support installed for MS Word sections"); throw new Exception("No PDF Writer support installed for MS Word sections");
//}
} }
public string CreatePDF2003FG(string pdfFileName, bool openPDF) public string CreatePDF2003FG(string pdfFileName, bool openPDF)
{ {
@@ -299,12 +243,9 @@ namespace LBWordLibrary
if (openPDF) OpenPDF(pdfFileName); if (openPDF) OpenPDF(pdfFileName);
return pdfFileName; return pdfFileName;
} }
public string CreatePDF2007(string pdfFileName,int DebugStatus) public string CreatePDF2007(string pdfFileName, int DebugStatus)
{ {
pdfFileName = AvailableFileName(pdfFileName); pdfFileName = AvailableFileName(pdfFileName);
// Removed to support MSWord 2010 and beyond.
//if (!WordPDFExporterInstalled)
// throw new Exception("MS Word PDF Exporter is not installed");
try try
{ {
ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF, DebugStatus); ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF, DebugStatus);
@@ -318,14 +259,8 @@ namespace LBWordLibrary
} }
public partial class LBDocuments public partial class LBDocuments
{ {
public LBDocumentClass Open(string fileName, Boolean addToRecentFiles) public LBDocumentClass Open(string fileName, bool addToRecentFiles) => Open(fileName, Missing.Value, Missing.Value, addToRecentFiles);
{ private LBDocumentClass Open(params object[] myParams) => new LBDocumentClass(InvokeMethod("Open", myParams));
return Open(fileName, Missing.Value, Missing.Value, addToRecentFiles);
}
private LBDocumentClass Open(params object[] myParams)
{
return new LBDocumentClass(InvokeMethod("Open", myParams));
}
} }
public partial class LBDocumentClass : LBComObject public partial class LBDocumentClass : LBComObject
{ {
@@ -345,10 +280,7 @@ namespace LBWordLibrary
else else
SaveAs2000(fileName); SaveAs2000(fileName);
} }
public void SaveAs2000(params object[] myParams) public void SaveAs2000(params object[] myParams) => InvokeMethod("SaveAs2000", myParams);
{
InvokeMethod("SaveAs2000", myParams);
}
public void SaveAs(string fileName) public void SaveAs(string fileName)
{ {
if (fileName.ToUpper().EndsWith("DOC")) if (fileName.ToUpper().EndsWith("DOC"))
@@ -362,18 +294,9 @@ namespace LBWordLibrary
else else
SaveAs2(fileName, Missing.Value, Missing.Value, Missing.Value, false); SaveAs2(fileName, Missing.Value, Missing.Value, Missing.Value, false);
} }
public void SaveAs2(params object[] myParams) public void SaveAs2(params object[] myParams) => InvokeMethod("SaveAs", myParams);
{ public void SaveAs(string fileName, LBWdSaveFormat format) => SaveAs2(fileName, format, Missing.Value, Missing.Value, false);
InvokeMethod("SaveAs", myParams); public LBRange Range(int Start, int End) => new LBRange(InvokeMethod("Range", Start, End));
}
public void SaveAs(string fileName, LBWdSaveFormat format)
{
SaveAs2(fileName, format, Missing.Value, Missing.Value, false);
}
public LBRange Range(int Start, int End)
{
return new LBRange(InvokeMethod("Range", Start, End));
}
/// <summary> /// <summary>
/// Length is Pages and Partial Pages /// Length is Pages and Partial Pages
/// The integral part is the number of full pages /// The integral part is the number of full pages
@@ -393,11 +316,6 @@ namespace LBWordLibrary
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToAbsolute, 0); myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToAbsolute, 0);
float mytop = myRange.PageSetup.TopMargin; float mytop = myRange.PageSetup.TopMargin;
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100); myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
//float partial = (float) myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary);
// B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word.
// We now need to calculated the last row of text in the PROMS attachment differently.
// We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page
// this works with older versions of MS Word as well.
float partial = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) - mytop; float partial = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) - mytop;
partial += myRange.Font.Size; partial += myRange.Font.Size;
retval += partial / 7200; retval += partial / 7200;
@@ -414,7 +332,7 @@ namespace LBWordLibrary
return ReplaceSymbolCharacters(GetRangeText(myRange)); return ReplaceSymbolCharacters(GetRangeText(myRange));
} }
} }
private static string[] SymbolFontName = { "VolianDraw", "WingDings", "VESymb", "VESymbFix", "Symbol" }; private static readonly string[] SymbolFontName = { "VolianDraw", "WingDings", "VESymb", "VESymbFix", "Symbol" };
private static bool IsSymbolFont(string fontName) private static bool IsSymbolFont(string fontName)
{ {
foreach (string symbolFont in SymbolFontName) foreach (string symbolFont in SymbolFontName)
@@ -422,150 +340,6 @@ namespace LBWordLibrary
return true; return true;
return false; return false;
} }
/// <summary>
/// If document contains symbol characters, returns problem font.
/// </summary>
public string FontHasSymbolCharacters
{
get
{
LBRange myRange = Range();
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
myRange.Start = 0;
int end = myRange.End;
string myText = GetRangeText(myRange);
//return _RegFindSymbol.IsMatch(myText);
MatchCollection problems = _RegFindSymbol.Matches(myText);
int offset = 0;
List<string> alreadyProcessed = new List<string>();
List<string> fontHasSymbols = new List<string>();
foreach (Match problem in problems)
{
if (!alreadyProcessed.Contains(problem.Value))
{
myRange.Start = problem.Index + offset;
myRange.End = problem.Index + problem.Length + offset;
int newOffset = FindRangeOffset(myRange, problem, offset, end);
string fontName = myRange.Font.Name;
if (IsSymbolFont(fontName))
{
if( !fontHasSymbols.Contains(fontName))
{
fontHasSymbols.Add(fontName);
// Found symbol font
_MyLog.InfoFormat("Font '{0}' has Symbols", fontName);
}
//Console.WriteLine("Font '{0}' has Symbols", myRange.Font.Name);
//return true;
}
else
return myRange.Font.Name;
offset = newOffset;
alreadyProcessed.Add(problem.Value);
}
}
return null;
}
}
/// <summary>
/// Debug Tool - Return a string containing a list of the fonts that have symbol characters.
/// </summary>
public string FontsHaveSymbolCharacters
{
get
{
string sep = "";
StringBuilder sb = new StringBuilder();
List<string> fonts=new List<string>();
LBRange myRange = Range();
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
myRange.Start = 0;
int end = myRange.End;
string myText = GetRangeText(myRange);
//return _RegFindSymbol.IsMatch(myText);
MatchCollection problems = _RegFindSymbol.Matches(myText);
int offset = 0;
foreach (Match problem in problems)
{
myRange.Start = problem.Index + offset;
myRange.End = problem.Index + problem.Length + offset;
int newOffset = FindRangeOffset(myRange, problem, offset, end);
if (!fonts.Contains(myRange.Font.Name))
{
fonts.Add(myRange.Font.Name);
sb.Append(sep + "'" + myRange.Font.Name + "'");
sep = ",";
}
offset = newOffset;
}
if (sb.Length > 0) return sb.ToString();
return null;
}
}
/// <summary>
/// Debug Tool - Return a list of symbol characters using VESYMB font.
/// </summary>
public string FontsHaveSymbolCharacters2
{
get
{
try
{
Dictionary<string, List<int>> fonts = new Dictionary<string, List<int>>();
LBRange myRange = Range();
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
myRange.Start = 0;
int end = myRange.End;
string myText = GetRangeText(myRange);
//return _RegFindSymbol.IsMatch(myText);
MatchCollection problems = _RegFindSymbol.Matches(myText);
int offset = 0;
foreach (Match problem in problems)
{
myRange.Start = problem.Index + offset;
myRange.End = problem.Index + problem.Length + offset;
int newOffset = FindRangeOffset(myRange, problem, offset, end);
string sFont = myRange.Font.Name;
if (sFont.ToUpper().StartsWith("VESYM"))
{
if (!fonts.ContainsKey(sFont))
{
fonts.Add(sFont, new List<int>());
}
List<int> symbols = fonts[sFont];
string myTextSymb = GetRangeText(myRange);
foreach (char c in myTextSymb)
{
if (!symbols.Contains((int)c))
symbols.Add((int)c);
}
}
offset = newOffset;
}
if (fonts.Count > 0)
{
string sep = "";
StringBuilder sb = new StringBuilder();
foreach (string font in fonts.Keys)
{
sb.Append(sep + "'" + font + "'");
sep = ",";
foreach (int i in fonts[font])
{
sb.Append(sep);
sb.Append(i);
}
}
return sb.ToString();
}
}
catch (Exception ex)
{
Console.WriteLine("{0},{1},{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
}
return null;
}
}
/// <summary> /// <summary>
/// Checks to see if the document contains symbol characters /// Checks to see if the document contains symbol characters
@@ -580,7 +354,6 @@ namespace LBWordLibrary
myRange.Start = 0; myRange.Start = 0;
int end = myRange.End; int end = myRange.End;
string myText = GetRangeText(myRange); string myText = GetRangeText(myRange);
//return _RegFindSymbol.IsMatch(myText);
MatchCollection problems = _RegFindSymbol.Matches(myText); MatchCollection problems = _RegFindSymbol.Matches(myText);
int offset = 0; int offset = 0;
foreach (Match problem in problems) foreach (Match problem in problems)
@@ -591,7 +364,6 @@ namespace LBWordLibrary
if (IsSymbolFont(myRange.Font.Name)) if (IsSymbolFont(myRange.Font.Name))
{ {
Console.WriteLine("Font '{0}' has Symbols", myRange.Font.Name); Console.WriteLine("Font '{0}' has Symbols", myRange.Font.Name);
//return true;
} }
else else
return true; return true;
@@ -600,87 +372,8 @@ namespace LBWordLibrary
return false; return false;
} }
} }
Regex _RegFindSymbol = new Regex("[\\uF020-\\uF07F]+"); readonly Regex _RegFindSymbol = new Regex("[\\uF020-\\uF07F]+");
/// <summary>
/// FixSymbolCharacters - Fix any symbol characters in the document
/// </summary>
public void FixSymbolCharacters()
{
// Set up range object to be used to process text
LBRange myRange = Range();
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
int end = myRange.End;
myRange.Start = 0;
string myText = GetRangeText(myRange);
MatchCollection problems = _RegFindSymbol.Matches(myText);
int offset = 0;
foreach (Match problem in problems)
{
myRange.Start = problem.Index + offset;
myRange.End = problem.Index + problem.Length + offset;
int newOffset = FindRangeOffset(myRange, problem, offset, end);
if (myRange.Font.Name == "")
{
int wrdStart = myRange.Start;
int wrdEnd = myRange.End;
int wrdMiddle = wrdStart;
while (myRange.Font.Name == "")
{
do
{
myRange.End = ++wrdMiddle;
} while(myRange.Font.Name != "");
myRange.End = wrdMiddle - 1;
ReplaceSymbolCharacters(myRange);
myRange.Start = wrdMiddle -1;
myRange.End = wrdEnd;
}
ReplaceSymbolCharacters(myRange);
}
else
{
ReplaceSymbolCharacters(myRange);
}
offset = newOffset;
}
}
/// <summary>
/// Try to fix the first character in the symbol range F000 to F0FF. If it cannot be
/// fixed, it is an indicator that the font is not installed properly. Regardless of
/// whether there is success, the change is undone so that the document will not be
/// considered dirty, i.e. will not prompt user for save.
/// </summary>
/// <returns></returns>
public bool AttemptToFixASymbolCharacter()
{
// Set up range object to be used to process text
LBRange myRange = Range();
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
int end = myRange.End;
myRange.Start = 0;
string myText = GetRangeText(myRange);
MatchCollection problems = _RegFindSymbol.Matches(myText);
if (problems.Count>0)
{
Match problem = problems[0];
myRange.Start = problem.Index;
myRange.End = myRange.Start + 1;
if (IsSymbolFont(myRange.Font.Name)) return true; // if it's a symbol font already, no issue.
string before = GetRangeText(myRange);
string updated = ReplaceSymbolCharacters(before);
myRange.Text = updated;
string after = GetRangeText(myRange);
Undo(1);
//Console.WriteLine("Undo1 results = {0}", tst);
//tst = Undo(1);
//Console.WriteLine("Undo2 results = {0}", tst);
//tst = Undo(1);
//Console.WriteLine("Undo3 results = {0}", tst);
return (updated == after);
}
return true;
}
/// <summary> /// <summary>
/// Get the Range Text with error handling. myRange.Text sometimes will get a null reference exception. /// Get the Range Text with error handling. myRange.Text sometimes will get a null reference exception.
/// </summary> /// </summary>
@@ -688,7 +381,7 @@ namespace LBWordLibrary
/// <returns></returns> /// <returns></returns>
internal static string GetRangeText(LBRange myRange) internal static string GetRangeText(LBRange myRange)
{ {
string text=""; string text = "";
try try
{ {
if (myRange.Start == myRange.End)// If Start and End equal return an empty string. if (myRange.Start == myRange.End)// If Start and End equal return an empty string.
@@ -737,35 +430,6 @@ namespace LBWordLibrary
return myRange.Start - problem.Index; return myRange.Start - problem.Index;
} }
/// <summary> /// <summary>
/// ReplaceSymbolCharacters Replaces any symbol characters in the specified range
/// </summary>
/// <param name="myRange"></param>
private static void ReplaceSymbolCharacters(LBRange myRange)
{
try
{
if (IsSymbolFont(myRange.Font.Name))
return;
string before = GetRangeText(myRange);
string updated = ReplaceSymbolCharacters(before);
myRange.Text = updated;
string after = GetRangeText(myRange);
if (after != updated) // If the Word text doesn't match try including a character before and after and do it again.
{
Console.WriteLine("'TryEntireRange Failed',{0},{1},'{2}','{3}','{4}'", myRange.Start, myRange.End, before, updated, after);
int end = myRange.End;
myRange.Start = myRange.Start - 1;
myRange.End = end + 1;
myRange.Text = ReplaceSymbolCharacters(GetRangeText(myRange));
Console.WriteLine("'TryEntireRange Failed',{0},{1},'{2}'", myRange.Start, myRange.End, GetRangeText(myRange));
}
}
catch (Exception ex)
{
Console.WriteLine("'TryEntireRange Exception',{0},{1},'{2}'", myRange.Start, myRange.End, ex.Message);
}
}
/// <summary>
/// ReplaceSymbolCharacters processes the string returned and changes any symbols (0xF0??) to normal characters /// ReplaceSymbolCharacters processes the string returned and changes any symbols (0xF0??) to normal characters
/// </summary> /// </summary>
/// <param name="str"></param> /// <param name="str"></param>
@@ -786,10 +450,7 @@ namespace LBWordLibrary
/// Close the document /// Close the document
/// </summary> /// </summary>
/// <param name="SaveChanges">Save Changes</param> /// <param name="SaveChanges">Save Changes</param>
public void Close(bool SaveChanges) public void Close(bool SaveChanges) => InvokeMethod("Close", SaveChanges, Missing.Value, Missing.Value);
{
InvokeMethod("Close", SaveChanges, Missing.Value, Missing.Value);
}
} }
public partial class LBFind public partial class LBFind
{ {
@@ -810,33 +471,15 @@ namespace LBWordLibrary
} }
public partial class LBRange : LBComObject public partial class LBRange : LBComObject
{ {
public Object get_Information(LBWdInformation info) public object get_Information(LBWdInformation info) => GetProperty("Information", info);
{ public LBRange GoTo(LBWdGoToItem What, LBWdGoToDirection Which, int Count) => new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value));
return GetProperty("Information", info);
}
public LBRange GoTo(LBWdGoToItem What, LBWdGoToDirection Which, int Count)
{
return new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value));
}
} }
public partial class LBSelection : LBComObject public partial class LBSelection : LBComObject
{ {
public Object get_Information(LBWdInformation info) public object get_Information(LBWdInformation info) => GetProperty("Information", info);
{ public int MoveStart(LBWdUnits Unit, int Count) => InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
return GetProperty("Information", info); public int MoveEnd(LBWdUnits Unit, int Count) => InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
} public int EndKey(LBWdUnits Unit, bool Extend) => InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
public int MoveStart(LBWdUnits Unit, int Count)
{
return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
}
public int MoveEnd(LBWdUnits Unit, int Count)
{
return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
}
public int EndKey(LBWdUnits Unit, bool Extend)
{
return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
}
public bool LastWasUpper public bool LastWasUpper
{ {
get get
@@ -850,7 +493,7 @@ namespace LBWordLibrary
string previous = LBDocumentClass.GetRangeText(myRange); string previous = LBDocumentClass.GetRangeText(myRange);
if (Regex.IsMatch(previous, "[A-Z]")) return true; if (Regex.IsMatch(previous, "[A-Z]")) return true;
if (Regex.IsMatch(previous, "[a-z]")) return false; if (Regex.IsMatch(previous, "[a-z]")) return false;
start = start - 1; start--;
} }
return false; return false;
} }
@@ -858,21 +501,12 @@ namespace LBWordLibrary
} }
public partial class LBInlineShapes : LBComObjectList<LBInlineShapes, LBInlineShape> /* Collection */ public partial class LBInlineShapes : LBComObjectList<LBInlineShapes, LBInlineShape> /* Collection */
{ {
public LBInlineShape AddPicture(string FileName, LBRange Range) public LBInlineShape AddPicture(string FileName, LBRange Range) => new LBInlineShape(InvokeMethod("AddPicture", FileName, false, true, Range));
{
return new LBInlineShape(InvokeMethod("AddPicture", FileName, false, true, Range));
}
} }
public partial class LBShapes : LBComObjectList<LBShapes, LBShape> /* Collection */ public partial class LBShapes : LBComObjectList<LBShapes, LBShape> /* Collection */
{ {
public LBShape AddPicture(string FileName, float Left, float Top, LBRange Anchor) public LBShape AddPicture(string FileName, float Left, float Top, LBRange Anchor) => new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Anchor));
{ public LBShape AddPicture(string FileName, float Left, float Top) => new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Missing.Value));
return new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Anchor));
}
public LBShape AddPicture(string FileName, float Left, float Top)
{
return new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Missing.Value));
}
} }
public enum LBMsoTriState public enum LBMsoTriState
{ {
@@ -882,25 +516,4 @@ namespace LBWordLibrary
msoTriStateToggle = -3, msoTriStateToggle = -3,
msoTrue = -1 msoTrue = -1
} }
//public partial class ProcessKiller
//{
// System.Diagnostics.Process _MyProcess;
// private bool _Exited = false;
// public ProcessKiller(System.Diagnostics.Process myProcess)
// {
// _MyProcess = myProcess;
// _MyProcess.Exited += new EventHandler(_MyProcess_Exited);
// _MyProcess.Kill();
// DateTime next = DateTime.Now.AddMilliseconds(200);
// while (DateTime.Now < next)
// Application.DoEvents();
// while (!_Exited)
// Application.DoEvents();
// }
// void _MyProcess_Exited(object sender, EventArgs e)
// {
// Console.WriteLine("Exited");
// _Exited = true;
// }
//}
} }
+1
View File
@@ -79,6 +79,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="LBComObject.cs" /> <Compile Include="LBComObject.cs" />
<Compile Include="LBObjectExtension.cs" /> <Compile Include="LBObjectExtension.cs" />
<Compile Include="OutlookLBComObject.cs" /> <Compile Include="OutlookLBComObject.cs" />
+42 -139
View File
@@ -1,28 +1,22 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection; using System.Reflection;
namespace LBOutlookLibrary namespace LBOutlookLibrary
{ {
public abstract partial class LBComObject public abstract partial class LBComObject
{ {
private Object _Item; private object _Item;
internal Object Item internal object Item
{ {
get { return _Item; } get { return _Item; }
set set
{ {
_Item = value; _Item = value;
if (value != null) _MyType = _Item.GetType(); if (value != null) MyType = _Item.GetType();
} }
} }
private Type _MyType;
public Type MyType public Type MyType { get; set; }
{
get { return _MyType; }
set { _MyType = value; }
}
protected LBComObject() { } protected LBComObject() { }
protected LBComObject(string ProgID) protected LBComObject(string ProgID)
{ {
@@ -30,35 +24,22 @@ namespace LBOutlookLibrary
objClassType = Type.GetTypeFromProgID(ProgID); objClassType = Type.GetTypeFromProgID(ProgID);
Item = Activator.CreateInstance(objClassType); Item = Activator.CreateInstance(objClassType);
} }
protected LBComObject(Object item) protected LBComObject(object item) => Item = item;
{ private object DoInvokeMember(string name, object[] parameters, BindingFlags bf, Binder b)
Item = item;
}
private Object DoInvokeMember(string name, Object[] parameters, BindingFlags bf, Binder b)
{ {
try try
{ {
return _MyType.InvokeMember(name, bf, b, _Item, parameters); return MyType.InvokeMember(name, bf, b, _Item, parameters);
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", _MyType.Name, name), ex); throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", MyType.Name, name), ex);
} }
return null;
} }
protected void SetProperty(string propertyName, params Object[] parameters) protected void SetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
{ protected object GetProperty(string propertyName) => DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null); protected object GetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
} protected object InvokeMethod(string methodName, params object[] parameters)
protected Object GetProperty(string propertyName)
{
return DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
}
protected Object GetProperty(string propertyName, params Object[] parameters)
{
return DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
}
protected Object InvokeMethod(string methodName, params Object[] parameters)
{ {
if (parameters != null) if (parameters != null)
FixParameters(parameters); FixParameters(parameters);
@@ -71,44 +52,14 @@ namespace LBOutlookLibrary
if (parameters[i] is LBComObject) if (parameters[i] is LBComObject)
parameters[i] = (parameters[i] as LBComObject).Item; parameters[i] = (parameters[i] as LBComObject).Item;
} }
protected Object InvokeMethod(string methodName) protected object InvokeMethod(string methodName) => InvokeMethod(methodName, null);
{
return InvokeMethod(methodName, null);
}
}
public class LBComObjectList<TList, TItem> : LBComObject
where TList : LBComObjectList<TList, TItem>
where TItem : LBComObject, new()
{
//public new(Object item):base(item){}
public TItem Add()
{
TItem tmp = new TItem();
tmp.Item = InvokeMethod("Add");
return tmp;
}
//public TItem this[int item]
//{
// get
// {
// TItem tmp = new TItem();
// tmp.Item = GetProperty("Item", item);
// return tmp;
// }
//}
} }
public partial class LBApplicationClass : LBComObject public partial class LBApplicationClass : LBComObject
{ {
public LBApplicationClass() : base("Outlook.Application") { } public LBApplicationClass() : base("Outlook.Application") { }
public LBApplicationClass(Object item) : base(item) { } public LBApplicationClass(object item) : base(item) { }
public System.Object CreateItem(LBOlItemType ItemType) public object CreateItem(LBOlItemType ItemType) => InvokeMethod("CreateItem", ItemType);
{ public void Quit() => InvokeMethod("Quit");
return InvokeMethod("CreateItem", ItemType);
}
public void Quit()
{
InvokeMethod("Quit");
}
} }
public enum LBOlItemType public enum LBOlItemType
{ {
@@ -124,13 +75,13 @@ namespace LBOutlookLibrary
public partial class LBMailItem : LBComObject public partial class LBMailItem : LBComObject
{ {
public LBMailItem() { } public LBMailItem() { }
public LBMailItem(Object item) : base(item) { } public LBMailItem(object item) : base(item) { }
} }
public partial class LBMailItemClass : LBComObject public partial class LBMailItemClass : LBComObject
{ {
public LBMailItemClass() { } public LBMailItemClass() { }
public LBMailItemClass(Object item) : base(item) { } public LBMailItemClass(object item) : base(item) { }
public String Body public string Body
{ {
get { return (GetProperty("Body").ToString()); } get { return (GetProperty("Body").ToString()); }
set { SetProperty("Body", value); } set { SetProperty("Body", value); }
@@ -140,28 +91,19 @@ namespace LBOutlookLibrary
get { return (LBOlBodyFormat)GetProperty("BodyFormat"); } get { return (LBOlBodyFormat)GetProperty("BodyFormat"); }
set { SetProperty("BodyFormat", value); } set { SetProperty("BodyFormat", value); }
} }
public LBAttachments Attachments public LBAttachments Attachments => new LBAttachments(GetProperty("Attachments"));
{ public string Subject
get { return new LBAttachments(GetProperty("Attachments")); }
}
public String Subject
{ {
get { return (GetProperty("Subject").ToString()); } get { return (GetProperty("Subject").ToString()); }
set { SetProperty("Subject", value); } set { SetProperty("Subject", value); }
} }
public LBRecipients Recipients public LBRecipients Recipients => new LBRecipients(GetProperty("Recipients"));
{ public string To
get { return new LBRecipients(GetProperty("Recipients")); }
}
public String To
{ {
get { return (GetProperty("To").ToString()); } get { return (GetProperty("To").ToString()); }
set { SetProperty("To", value); } set { SetProperty("To", value); }
} }
public void Send() public void Send() => InvokeMethod("Send");
{
InvokeMethod("Send");
}
} }
public enum LBOlBodyFormat public enum LBOlBodyFormat
{ {
@@ -173,78 +115,39 @@ namespace LBOutlookLibrary
public partial class LBAttachments : LBComObject public partial class LBAttachments : LBComObject
{ {
public LBAttachments() { } public LBAttachments() { }
public LBAttachments(Object item) : base(item) { } public LBAttachments(object item) : base(item) { }
public int Count public int Count => (GetProperty("Count") as int? ?? 0);
{ public new LBAttachment Item => new LBAttachment(GetProperty("Item"));
get { return (GetProperty("Count") as int? ?? 0); } public LBAttachment Add(object Source) => new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
}
public LBAttachment Item
{
get { return new LBAttachment(GetProperty("Item")); }
}
public LBAttachment Add(object Source)
{
return new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
}
public LBAttachment Add(object Source, object Type, object Position, object DisplayName) public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
{ {
return new LBAttachment(InvokeMethod("Add", Source, Type, Position, DisplayName)); return new LBAttachment(InvokeMethod("Add", Source, Type, Position, DisplayName));
} }
public void Remove(int Index) public void Remove(int Index) => InvokeMethod("Remove", Index);
{
InvokeMethod("Remove", Index);
}
} }
public partial class LBRecipients : LBComObject public partial class LBRecipients : LBComObject
{ {
public LBRecipients() { } public LBRecipients() { }
public LBRecipients(Object item) : base(item) { } public LBRecipients(object item) : base(item) { }
public int Count public int Count => (GetProperty("Count") as int? ?? 0);
{ public new LBRecipient Item => new LBRecipient(GetProperty("Item"));
get { return (GetProperty("Count") as int? ?? 0); } public LBRecipient Add(string Name) => new LBRecipient(InvokeMethod("Add", Name));
} public void Remove(int Index) => InvokeMethod("Remove", Index);
public LBRecipient Item public bool ResolveAll() => InvokeMethod("ResolveAll") as bool? ?? false;
{
get { return new LBRecipient(GetProperty("Item")); }
}
public LBRecipient Add(string Name)
{
return new LBRecipient(InvokeMethod("Add", Name));
}
public void Remove(int Index)
{
InvokeMethod("Remove", Index);
}
public Boolean ResolveAll()
{
return InvokeMethod("ResolveAll") as Boolean? ?? false;
}
} }
public partial class LBAttachment : LBComObject public partial class LBAttachment : LBComObject
{ {
public LBAttachment() { } public LBAttachment() { }
public LBAttachment(Object item) : base(item) { } public LBAttachment(object item) : base(item) { }
public LBOlAttachmentType Type public LBOlAttachmentType Type => (LBOlAttachmentType)GetProperty("Type");
{
get { return (LBOlAttachmentType)GetProperty("Type"); }
}
} }
public partial class LBRecipient : LBComObject public partial class LBRecipient : LBComObject
{ {
public LBRecipient() { } public LBRecipient() { }
public LBRecipient(Object item) : base(item) { } public LBRecipient(object item) : base(item) { }
public String Address public string Address => (GetProperty("Address").ToString());
{ public string Name => (GetProperty("Name").ToString());
get { return (GetProperty("Address").ToString()); } public bool Resolve() => InvokeMethod("Resolve") as bool? ?? false;
}
public String Name
{
get { return (GetProperty("Name").ToString()); }
}
public Boolean Resolve()
{
return InvokeMethod("Resolve") as Boolean? ?? false;
}
} }
public enum LBOlAttachmentType public enum LBOlAttachmentType
{ {
+2 -10
View File
@@ -1,21 +1,13 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace LBOutlookLibrary namespace LBOutlookLibrary
{ {
public partial class LBApplicationClass public partial class LBApplicationClass
{ {
public LBMailItemClass CreateMailItem() public LBMailItemClass CreateMailItem() => new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
{
return new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
}
} }
public partial class LBMailItemClass public partial class LBMailItemClass
{ {
public void AddAttachment(string filename) public void AddAttachment(string filename) => Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
{
Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
}
} }
} }
+7 -21
View File
@@ -53,15 +53,9 @@ namespace Read64bitRegistryFrom32bitApp
#endregion #endregion
#region Functions #region Functions
static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, String inPropertyName) static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, string inPropertyName) => GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
{ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName); static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, RegSAM in32or64key, string inPropertyName)
}
static public string GetRegKey32Value(UIntPtr inHive, String inKeyName, String inPropertyName)
{
return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_32Key, inPropertyName);
}
static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, RegSAM in32or64key, String inPropertyName)
{ {
int hkey = 0; int hkey = 0;
try try
@@ -80,15 +74,10 @@ namespace Read64bitRegistryFrom32bitApp
if (0 != hkey) RegCloseKey(hkey); if (0 != hkey) RegCloseKey(hkey);
} }
} }
static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName) static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
{ static public bool GetRegKey32Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
} static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName, RegSAM in32or64key)
static public bool GetRegKey32Valid(UIntPtr inHive, String inKeyName)
{
return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
}
static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName, RegSAM in32or64key)
{ {
int hkey = 0; int hkey = 0;
try try
@@ -103,8 +92,5 @@ namespace Read64bitRegistryFrom32bitApp
} }
} }
#endregion #endregion
#region Enums
#endregion
} }
} }
@@ -844,8 +844,12 @@ namespace ROEditor
AccPageID = " "; AccPageID = " ";
WriteString(AccPageID); WriteString(AccPageID);
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
string moddt = ROdatabase.RODB_GetModDateTime(elem.GetAttribute("RecID"), elem.GetAttribute("Table"));
if (!string.IsNullOrEmpty(moddt)) WriteString(moddt);
// Save the ID and offset entry for the current ID // Save the ID and offset entry for the current ID
IdsAndOffsets.Add(RORecID,startFST); IdsAndOffsets.Add(RORecID, startFST);
// Save the RecID and Accessory Page id // Save the RecID and Accessory Page id
IdsAndAccPgIds[AccPageID] = RORecID; IdsAndAccPgIds[AccPageID] = RORecID;
@@ -355,6 +355,7 @@ namespace RODBInterface
public abstract string RODB_GetDBServerForAbout(); public abstract string RODB_GetDBServerForAbout();
public abstract string RODB_HasBeenConverted(); public abstract string RODB_HasBeenConverted();
public abstract bool RODB_WriteSqlConnectToAccess(string newConectStr); public abstract bool RODB_WriteSqlConnectToAccess(string newConectStr);
public abstract string RODB_GetModDateTime(string Recid, string table);
#endregion #endregion
public RODB() public RODB()
@@ -3082,6 +3083,27 @@ namespace RODBInterface
return GrpCnt; return GrpCnt;
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
//Get the Modification Date / Time for the RO
public override string RODB_GetModDateTime(string Recid, string table)
{
using (System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(strDatabaseConnectionCommand))
{
connection.Open();
using (System.Data.OleDb.OleDbCommand command = connection.CreateCommand())
{
//Unfortunately Access wont let you paramaterize the table name
command.CommandText = $"SELECT ModDateTime FROM {Regex.Replace(table, "[^a-zA-Z0-9]", "")} WHERE RecID = @Value";
command.Parameters.Add(new System.Data.OleDb.OleDbParameter
{
OleDbType = System.Data.OleDb.OleDbType.VarChar,
ParameterName = "@Value",
Value = Recid
});
return command.ExecuteScalar().ToString();
}
}
}
} }
} }
@@ -2653,6 +2653,34 @@ namespace RODBInterface
} }
return GrpCnt; return GrpCnt;
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
//Get the Modification Date / Time for the RO
public override string RODB_GetModDateTime(string Recid, string table)
{
using (SqlConnection connection = new SqlConnection(strDatabaseConnectionCommand))
{
connection.Open();
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = $"SELECT ModDateTime FROM ROALL WHERE RecID = @Value AND ROTable = @table";
command.Parameters.Add(new SqlParameter
{
SqlDbType = SqlDbType.VarChar,
ParameterName = "@Value",
Value = Recid
});
command.Parameters.Add(new SqlParameter
{
SqlDbType = SqlDbType.VarChar,
ParameterName = "@table",
Value = table
});
return command.ExecuteScalar().ToString();
}
}
}
#endregion #endregion
public static bool TestConnect(string constring) public static bool TestConnect(string constring)
{ {
@@ -19,11 +19,6 @@
*********************************************************************************************/ *********************************************************************************************/
using System; using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
//using ROProfiler; //don't forget to add VlnProfiler to the reference list
namespace VlnStatus namespace VlnStatus
{ {
@@ -35,11 +30,6 @@ namespace VlnStatus
private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label lblBar; private System.Windows.Forms.Label lblBar;
private System.Windows.Forms.Label StatMsg; private System.Windows.Forms.Label StatMsg;
// private string strLblLast="";
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public StatusBarFrm() public StatusBarFrm()
{ {
@@ -61,21 +51,6 @@ namespace VlnStatus
Text = StatusBoxTitle; Text = StatusBoxTitle;
} }
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
@@ -190,14 +165,6 @@ namespace VlnStatus
{ {
lblBar.Text = (Math.Round((decimal)(progressBar1.Value * 100) / progressBar1.Maximum)).ToString(); lblBar.Text = (Math.Round((decimal)(progressBar1.Value * 100) / progressBar1.Maximum)).ToString();
lblBar.Text += "% Complete"; lblBar.Text += "% Complete";
// if( lblBar.Text != strLblLast)
// {
// Profiler.Start("UpdateLabel");
lblBar.Refresh();
// lblBar.Update();
// Profiler.End("UpdateLabel");
// }
// strLblLast = lblBar.Text;
} }
public string StatusMessage public string StatusMessage
@@ -209,10 +176,7 @@ namespace VlnStatus
set set
{ {
StatMsg.Text = value; StatMsg.Text = value;
// Profiler.Start("StatusMessage");
StatMsg.Refresh(); StatMsg.Refresh();
// StatMsg.Update();
// Profiler.End("StatusMessage");
} }
} }
@@ -17,12 +17,6 @@
* Added overbounds check * Added overbounds check
*********************************************************************************************/ *********************************************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace VlnStatus namespace VlnStatus
{ {
/// <summary> /// <summary>
@@ -31,10 +25,6 @@ namespace VlnStatus
public class StatusMessageFrm : System.Windows.Forms.Form public class StatusMessageFrm : System.Windows.Forms.Form
{ {
private System.Windows.Forms.Label lblStatMsg; private System.Windows.Forms.Label lblStatMsg;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public StatusMessageFrm() public StatusMessageFrm()
{ {
@@ -54,21 +44,6 @@ namespace VlnStatus
Text = StatTitle; Text = StatTitle;
} }
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
@@ -33,7 +33,7 @@ namespace VlnStatus
/// </summary> /// </summary>
public class VlnStatusBar public class VlnStatusBar
{ {
StatusBarFrm StatBar; readonly StatusBarFrm StatBar;
private int Cnt; private int Cnt;
// Create a status window with the default title of "Status" // Create a status window with the default title of "Status"
@@ -53,8 +53,6 @@ namespace VlnStatus
// Increament the the status bar by the passed in value. // Increament the the status bar by the passed in value.
public void PerformStep(int val) public void PerformStep(int val)
{ {
// StatBar.Value = val;
// Cnt = val;
BarValue = val; BarValue = val;
StatBar.PerformStep(); StatBar.PerformStep();
} }
@@ -62,7 +60,6 @@ namespace VlnStatus
// Increament the the status bar by one // Increament the the status bar by one
public void PerformStep() public void PerformStep()
{ {
// StatBar.Value = StatBar.Value + 1;
Cnt++; Cnt++;
BarValue = Cnt; BarValue = Cnt;
StatBar.PerformStep(); StatBar.PerformStep();
@@ -13,8 +13,6 @@
* Added overbounds check * Added overbounds check
*********************************************************************************************/ *********************************************************************************************/
using System;
namespace VlnStatus namespace VlnStatus
{ {
/// <summary> /// <summary>
@@ -28,7 +26,7 @@ namespace VlnStatus
/// </summary> /// </summary>
public class VlnStatusMessage public class VlnStatusMessage
{ {
StatusMessageFrm StatusMessageBox; readonly StatusMessageFrm StatusMessageBox;
// Create a status window with the default title of "Status" // Create a status window with the default title of "Status"
public VlnStatusMessage() public VlnStatusMessage()
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
-3
View File
@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace RoAccessToSql namespace RoAccessToSql
+68 -103
View File
@@ -1,16 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Data.OleDb; using System.Data.OleDb;
using Volian.Base.Library;
[assembly: log4net.Config.XmlConfigurator(Watch = true)] [assembly: log4net.Config.XmlConfigurator(Watch = true)]
@@ -33,25 +27,11 @@ namespace RoAccessToSql
public partial class RoAccessToSql : Form public partial class RoAccessToSql : Form
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private string _MSAccessPath = null;
public string MSAccessPath public string MSAccessPath { get; set; } = null;
{ public string SqlServerName { get; set; } = null;
get { return _MSAccessPath; } public string SqlDatabaseName { get; set; } = null;
set { _MSAccessPath = value; } readonly bool _Initializing = false;
}
private string _SqlServerName = null;
public string SqlServerName
{
get { return _SqlServerName; }
set { _SqlServerName = value; }
}
private string _SqlDatabaseName = null;
public string SqlDatabaseName
{
get { return _SqlDatabaseName; }
set { _SqlDatabaseName = value; }
}
bool _Initializing = false;
public RoAccessToSql(string[] args) public RoAccessToSql(string[] args)
{ {
@@ -66,7 +46,7 @@ namespace RoAccessToSql
} }
else if (parm.StartsWith("/sqldb=")) else if (parm.StartsWith("/sqldb="))
{ {
SqlDatabaseName = parm.Substring(7) + "_RO"; SqlDatabaseName = $"{parm.Substring(7)}_RO";
} }
else if (parm.StartsWith("/server=")) else if (parm.StartsWith("/server="))
{ {
@@ -92,7 +72,7 @@ namespace RoAccessToSql
if (UserInRoEditor()) this.Close(); if (UserInRoEditor()) this.Close();
tbSqlDbName.Text = SqlDatabaseName; tbSqlDbName.Text = SqlDatabaseName;
_TmpFileForConnectStr = Path.GetTempPath(); _TmpFileForConnectStr = Path.GetTempPath();
_TmpFileForConnectStr = _TmpFileForConnectStr + @"\PromsConnect.txt"; _TmpFileForConnectStr += @"\PromsConnect.txt";
File.Delete(_TmpFileForConnectStr); File.Delete(_TmpFileForConnectStr);
_Initializing = false; _Initializing = false;
} }
@@ -100,7 +80,7 @@ namespace RoAccessToSql
private bool UserInRoEditor() private bool UserInRoEditor()
{ {
FileInfo fiown = null; FileInfo fiown = null;
FileStream fsown = null; FileStream fsown;
// The following code was taken from the roeditor. It uses the 'RoEditor.own' file to assure that // The following code was taken from the roeditor. It uses the 'RoEditor.own' file to assure that
// no one is in the roeditor. This file is located in the microsoft access database directory. // no one is in the roeditor. This file is located in the microsoft access database directory.
try try
@@ -119,7 +99,7 @@ namespace RoAccessToSql
fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
TextReader tr1 = new StreamReader(fsown); TextReader tr1 = new StreamReader(fsown);
string who1 = tr1.ReadToEnd(); string who1 = tr1.ReadToEnd();
MessageBox.Show(ex.Message + "\r\n\r\n" + who1, "RO Editor In Use", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); MessageBox.Show($"{ex.Message}\r\n\r\n{who1}", "RO Editor In Use", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
} }
fsown = fiown.Open(FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite); fsown = fiown.Open(FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
TextReader tr = new StreamReader(fsown); TextReader tr = new StreamReader(fsown);
@@ -142,7 +122,7 @@ namespace RoAccessToSql
tw.WriteLine("Current User: {0}, Date and Time Started: {1}", Environment.UserName.ToUpper(), DateTime.Now.ToString("MM/dd/yyyy @ hh:mm")); tw.WriteLine("Current User: {0}, Date and Time Started: {1}", Environment.UserName.ToUpper(), DateTime.Now.ToString("MM/dd/yyyy @ hh:mm"));
tw.Flush(); tw.Flush();
} }
catch (IOException ex) catch (IOException)
{ {
fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
TextReader tr = new StreamReader(fsown); TextReader tr = new StreamReader(fsown);
@@ -154,12 +134,8 @@ namespace RoAccessToSql
} }
return false; return false;
} }
static string _ErrorLogFileName;
public static string ErrorLogFileName public static string ErrorLogFileName { get; set; }
{
get { return _ErrorLogFileName; }
set { _ErrorLogFileName = value; }
}
// make error log file name (uses same logic as proms error log) // make error log file name (uses same logic as proms error log)
static bool ChangeLogFileName(string AppenderName, string NewFilename) static bool ChangeLogFileName(string AppenderName, string NewFilename)
{ {
@@ -168,11 +144,10 @@ namespace RoAccessToSql
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders()) foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
{ {
if (iApp.Name.CompareTo(AppenderName) == 0 if (iApp.Name.CompareTo(AppenderName) == 0
&& iApp is log4net.Appender.FileAppender) && iApp is log4net.Appender.FileAppender fApp)
{ {
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("prefix", "") + "_").TrimStart("_".ToCharArray()) + NewFilename; fApp.File = $@"{folderPath}\VEPROMS\{($"{Volian.Base.Library.VlnSettings.GetCommand("prefix", "")}_").TrimStart("_".ToCharArray())}{NewFilename}";
ErrorLogFileName = fApp.File; ErrorLogFileName = fApp.File;
fApp.ActivateOptions(); fApp.ActivateOptions();
return true; return true;
@@ -189,7 +164,7 @@ namespace RoAccessToSql
if (Directory.Exists(fbd.SelectedPath)) if (Directory.Exists(fbd.SelectedPath))
tbAccessPath.Text = fbd.SelectedPath; tbAccessPath.Text = fbd.SelectedPath;
else else
MessageBox.Show("Path doesn't exist " + tbAccessPath.Text); MessageBox.Show($"Path doesn't exist {tbAccessPath.Text}");
} }
} }
// Convert the data // Convert the data
@@ -212,7 +187,7 @@ namespace RoAccessToSql
{ {
DateTime dtSunday = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek)); DateTime dtSunday = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek));
ChangeLogFileName("LogFileAppender", SqlDatabaseName + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt"); ChangeLogFileName("LogFileAppender", $"{SqlDatabaseName} {dtSunday:yyyyMMdd} ErrorLog.txt");
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===={0}[SQL:{1:yyMM.ddHH}]====== User: {2}/{3} Started {4} ===============>{5}" _MyLog.InfoFormat("\r\nSession Beginning\r\n<===={0}[SQL:{1:yyMM.ddHH}]====== User: {2}/{3} Started {4} ===============>{5}"
, Application.ProductVersion, RevDate, DateTime.Now, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), ""); , Application.ProductVersion, RevDate, DateTime.Now, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), "");
} }
@@ -229,7 +204,7 @@ namespace RoAccessToSql
if (sqlConnection.State == ConnectionState.Open) if (sqlConnection.State == ConnectionState.Open)
{ {
// now try to open access db: // now try to open access db:
string strDatabaseConnectionCommand = "Provider=Microsoft.ACE.OLEDB.12.0;Password=\"\";User ID=Admin;Data Source=" + MSAccessPath + "\\ROMaster.mdb;Mode=Share Deny None;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; string strDatabaseConnectionCommand = $"Provider=Microsoft.ACE.OLEDB.12.0;Password=\"\";User ID=Admin;Data Source={MSAccessPath}\\ROMaster.mdb;Mode=Share Deny None;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
using (OleDbConnection accessConnection = new OleDbConnection(strDatabaseConnectionCommand)) using (OleDbConnection accessConnection = new OleDbConnection(strDatabaseConnectionCommand))
{ {
try try
@@ -251,13 +226,13 @@ namespace RoAccessToSql
} }
else else
{ {
_MyLog.Error("SQL Connection is not open. Check connection string: " + tbSqlDbName.Text); _MyLog.Error($"SQL Connection is not open. Check connection string: {tbSqlDbName.Text}");
MessageBox.Show("Check connection string: " + tbSqlDbName.Text, "SQL Connection is not open."); MessageBox.Show($"Check connection string: {tbSqlDbName.Text}", "SQL Connection is not open.");
} }
} }
catch (SqlException ex) catch (SqlException ex)
{ {
_MyLog.Error("SQL Connection is not open. Check connection string: " + tbSqlDbName.Text); _MyLog.Error($"SQL Connection is not open. Check connection string: {tbSqlDbName.Text}");
MessageBox.Show(ex.Message, "Unknown error when migrating RO data from MS Access to SQL"); MessageBox.Show(ex.Message, "Unknown error when migrating RO data from MS Access to SQL");
} }
} }
@@ -274,9 +249,8 @@ namespace RoAccessToSql
lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, 1, 0, 0, lastTimeDbs, false); lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, 1, 0, 0, lastTimeDbs, false);
lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, false); lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, false);
lastTimeDbs = ProgressBarUpdate(pBarDbs, "ROMaster Table", 0, 5, 0, 1, lastTimeDbs, false); lastTimeDbs = ProgressBarUpdate(pBarDbs, "ROMaster Table", 0, 5, 0, 1, lastTimeDbs, false);
OleDbDataReader reader = null;
OleDbCommand command = new OleDbCommand("select * from ROMaster", accessConnection); OleDbCommand command = new OleDbCommand("select * from ROMaster", accessConnection);
reader = command.ExecuteReader(); OleDbDataReader reader = command.ExecuteReader();
// Do access's romaster table first so that the list of other tables to process is found. While doing this, migrate this table's data. // Do access's romaster table first so that the list of other tables to process is found. While doing this, migrate this table's data.
int cntRo = 0; int cntRo = 0;
int cntDb = 0; int cntDb = 0;
@@ -303,10 +277,9 @@ namespace RoAccessToSql
maxCntDb++; maxCntDb++;
} }
} }
lastTimeRos = ProgressBarUpdate(pBarROs, "ROMaster", 0, maxCntRo, maxCntRo, 1, lastTimeRos, true); ProgressBarUpdate(pBarROs, "ROMaster", 0, maxCntRo, maxCntRo, 1, lastTimeRos, true);
lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, maxCntDb, 0, 0, lastTimeDbs, false); lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, maxCntDb, 0, 0, lastTimeDbs, false);
reader.Close(); reader.Close();
reader = null;
// now migrate all the tables that were found // now migrate all the tables that were found
foreach (string tableName in allTables) foreach (string tableName in allTables)
@@ -318,7 +291,7 @@ namespace RoAccessToSql
lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, true); lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, true);
lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[cntDb], 0, maxCntDb, cntDb, 1, lastTimeDbs, false); lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[cntDb], 0, maxCntDb, cntDb, 1, lastTimeDbs, false);
command = null; command = null;
command = new OleDbCommand("select * from " + tableName, accessConnection); command = new OleDbCommand($"select * from {tableName}", accessConnection);
reader = command.ExecuteReader(); reader = command.ExecuteReader();
while (reader.Read()) // read all of the records from the current access table while (reader.Read()) // read all of the records from the current access table
{ {
@@ -338,7 +311,7 @@ namespace RoAccessToSql
reader = null; reader = null;
lastTimeRos = ProgressBarUpdate(pBarROs, tableName, 0, maxCntRo, maxCntRo, 1, lastTimeRos, false); lastTimeRos = ProgressBarUpdate(pBarROs, tableName, 0, maxCntRo, maxCntRo, 1, lastTimeRos, false);
} }
lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[maxCntDb - 1], 0, maxCntDb, maxCntDb, 1, lastTimeDbs, false); ProgressBarUpdate(pBarDbs, allTablesText[maxCntDb - 1], 0, maxCntDb, maxCntDb, 1, lastTimeDbs, false);
pBarDbs.Text = "Referenced Object Tables Migration Completed"; pBarDbs.Text = "Referenced Object Tables Migration Completed";
pBarROs.Text = "Referenced Objects Migration Completed"; pBarROs.Text = "Referenced Objects Migration Completed";
btnConvert.Enabled = false; btnConvert.Enabled = false;
@@ -357,7 +330,7 @@ namespace RoAccessToSql
string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now); string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now);
string strInsert = "INSERT INTO ROMaster (RecID, RecType, ModDateTime, Info) "; string strInsert = "INSERT INTO ROMaster (RecID, RecType, ModDateTime, Info) ";
// note that '8' for rectype flags database converted: // note that '8' for rectype flags database converted:
strInsert = strInsert + " VALUES ('09999999', 8, '" + dt + "', '" + _SqlConnectStr + "');"; strInsert = $"{strInsert} VALUES ('09999999', 8, '{dt}', '{_SqlConnectStr}');";
OleDbCommand command = new OleDbCommand(strInsert, accessConnection); OleDbCommand command = new OleDbCommand(strInsert, accessConnection);
reader = command.ExecuteReader(); reader = command.ExecuteReader();
if (reader.Read()) return; if (reader.Read()) return;
@@ -367,7 +340,7 @@ namespace RoAccessToSql
MessageBox.Show(e.Message, "Error on insert to flag migration completed"); MessageBox.Show(e.Message, "Error on insert to flag migration completed");
} }
} }
private string _TmpFileForConnectStr = null; private readonly string _TmpFileForConnectStr = null;
private void WriteSqlPathToTempFile() private void WriteSqlPathToTempFile()
{ {
System.IO.File.WriteAllText(_TmpFileForConnectStr, _SqlConnectStr); System.IO.File.WriteAllText(_TmpFileForConnectStr, _SqlConnectStr);
@@ -375,12 +348,11 @@ namespace RoAccessToSql
// the following is used to update the progress bars, it finds how many records are in a table. // the following is used to update the progress bars, it finds how many records are in a table.
private int GetRecordCountForTable(string tableName, OleDbConnection accessConnection) private int GetRecordCountForTable(string tableName, OleDbConnection accessConnection)
{ {
OleDbDataReader reader = null;
int retcnt = 100; int retcnt = 100;
try try
{ {
OleDbCommand command = new OleDbCommand("SELECT COUNT (RecID) as cnt FROM " + tableName, accessConnection); OleDbCommand command = new OleDbCommand($"SELECT COUNT (RecID) as cnt FROM {tableName}", accessConnection);
reader = command.ExecuteReader(); OleDbDataReader reader = command.ExecuteReader();
if (reader.Read()) if (reader.Read())
{ {
retcnt = reader.GetInt32(0); retcnt = reader.GetInt32(0);
@@ -393,6 +365,7 @@ namespace RoAccessToSql
} }
return retcnt; return retcnt;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping min for Debugging")]
DateTime ProgressBarUpdate(DevComponents.DotNetBar.Controls.ProgressBarX pbi, string msg, int min, int max, int progress, int flag, DateTime lastUpdateDisplay, bool doTimeCheck) DateTime ProgressBarUpdate(DevComponents.DotNetBar.Controls.ProgressBarX pbi, string msg, int min, int max, int progress, int flag, DateTime lastUpdateDisplay, bool doTimeCheck)
{ {
if (flag == 0) // setup if (flag == 0) // setup
@@ -412,10 +385,12 @@ namespace RoAccessToSql
{ {
try try
{ {
SqlCommand command = new SqlCommand(); SqlCommand command = new SqlCommand
command.Connection = sqlConnection; {
command.CommandType = CommandType.StoredProcedure; Connection = sqlConnection,
command.CommandText = "insertAllRectypes"; CommandType = CommandType.StoredProcedure,
CommandText = "insertAllRectypes"
};
command.Parameters.AddWithValue("@RecType", RecType); command.Parameters.AddWithValue("@RecType", RecType);
if (AccPageID == null || AccPageID == "") if (AccPageID == null || AccPageID == "")
command.Parameters.AddWithValue("@AccPageID", string.Empty); command.Parameters.AddWithValue("@AccPageID", string.Empty);
@@ -428,7 +403,6 @@ namespace RoAccessToSql
command.Parameters.AddWithValue("@ModDateTime", ModDateTime); command.Parameters.AddWithValue("@ModDateTime", ModDateTime);
using (SqlDataReader reader = command.ExecuteReader()) using (SqlDataReader reader = command.ExecuteReader())
{ {
bool success = true;
} }
command = null; command = null;
} }
@@ -438,29 +412,12 @@ namespace RoAccessToSql
_MyLog.Error(msg, ex); _MyLog.Error(msg, ex);
} }
} }
private void btnExit_Click(object sender, EventArgs e) private void btnExit_Click(object sender, EventArgs e) => this.Close();
{
this.Close();
}
// the user selected the button to test the sql connection string // the user selected the button to test the sql connection string
private void btnTestConnect_Click(object sender, EventArgs e) private void btnTestConnect_Click(object sender, EventArgs e) => TestConnection(true);
{
TestConnection(true); public static DateTime RevDate { get; set; } = DateTime.MinValue;
} public static string RevDescription { get; set; } = "Unknown";
// the RevDate & RevDescription are found in a stored procedure, vesp_GetSQLCodeRevision, in the sql database. These get updated each
// time a revision is made to the sql database using ROFixes.sql script.
private static DateTime _RevDate = DateTime.MinValue;
public static DateTime RevDate
{
get { return _RevDate; }
set { _RevDate = value; }
}
private static string _RevDescription = "Unknown";
public static string RevDescription
{
get { return _RevDescription; }
set { _RevDescription = value; }
}
// This is called to test the sql connection, either from the button when pressed by user, or from the convert button, before // This is called to test the sql connection, either from the button when pressed by user, or from the convert button, before
// the conversion is done. See below for what is checked // the conversion is done. See below for what is checked
private bool TestConnection(bool notifyUser) private bool TestConnection(bool notifyUser)
@@ -486,10 +443,12 @@ namespace RoAccessToSql
if (connection.State == ConnectionState.Open) if (connection.State == ConnectionState.Open)
{ {
// now see if there is an roall table // now see if there is an roall table
SqlCommand command = new SqlCommand(); SqlCommand command = new SqlCommand
command.Connection = connection; {
command.CommandType = CommandType.Text; Connection = connection,
command.CommandText = "(SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))"; CommandType = CommandType.Text,
CommandText = "(SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))"
};
using (SqlDataReader reader = command.ExecuteReader()) using (SqlDataReader reader = command.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
@@ -509,10 +468,12 @@ namespace RoAccessToSql
{ {
// now see if there are stored procedures: // now see if there are stored procedures:
command = null; // reset command command = null; // reset command
command = new SqlCommand(); command = new SqlCommand
command.Connection = connection; {
command.CommandType = CommandType.Text; Connection = connection,
command.CommandText = "(SELECT count(*) FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)"; CommandType = CommandType.Text,
CommandText = "(SELECT count(*) FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)"
};
using (SqlDataReader reader = command.ExecuteReader()) using (SqlDataReader reader = command.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
@@ -533,10 +494,12 @@ namespace RoAccessToSql
{ {
// now test that the roall table is empty: // now test that the roall table is empty:
command = null; // reset command command = null; // reset command
command = new SqlCommand(); command = new SqlCommand
command.Connection = connection; {
command.CommandType = CommandType.Text; Connection = connection,
command.CommandText = "SELECT count(*) FROM roall"; CommandType = CommandType.Text,
CommandText = "SELECT count(*) FROM roall"
};
using (SqlDataReader reader = command.ExecuteReader()) using (SqlDataReader reader = command.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
@@ -557,16 +520,18 @@ namespace RoAccessToSql
{ {
// now test that the database version is ok // now test that the database version is ok
command = null; // reset command command = null; // reset command
command = new SqlCommand(); command = new SqlCommand
command.Connection = connection; {
command.CommandType = CommandType.StoredProcedure; Connection = connection,
command.CommandText = "vesp_GetSQLCodeRevision"; CommandType = CommandType.StoredProcedure,
CommandText = "vesp_GetSQLCodeRevision"
};
using (SqlDataReader reader = command.ExecuteReader()) using (SqlDataReader reader = command.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
{ {
_RevDate = reader.GetDateTime(0); RevDate = reader.GetDateTime(0);
_RevDescription = reader.GetString(1); RevDescription = reader.GetString(1);
dbsuc = true; dbsuc = true;
} }
else else
@@ -582,13 +547,13 @@ namespace RoAccessToSql
} }
catch (SqlException ex) catch (SqlException ex)
{ {
if (notifyUser) MessageBox.Show("Connection failed: " + ex, "Connection Failed"); if (notifyUser) MessageBox.Show($"Connection failed: {ex}", "Connection Failed");
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
if (notifyUser) MessageBox.Show("Connection failed: " + ex, "Connection Failed"); if (notifyUser) MessageBox.Show($"Connection failed: {ex}", "Connection Failed");
} }
if (notifyUser && success) MessageBox.Show("You have been successfully connected to the database!", "Connection Succeeded"); if (notifyUser && success) MessageBox.Show("You have been successfully connected to the database!", "Connection Succeeded");
+1
View File
@@ -66,6 +66,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="RoAccessToSql.cs"> <Compile Include="RoAccessToSql.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
+1 -1
View File
@@ -1817,7 +1817,7 @@ ALTER trigger [dbo].[tr_Contents_Delete] on [dbo].[Contents] instead of delete a
select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS
from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID
where ii.DeleteStatus > 0 where ii.DeleteStatus > 0
update ga set ga.contentauditid = (select max(auditid) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus) update ga set ga.contentauditid = (select ISNULL(max(auditid),0) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus)
from gridaudits ga join deleted dd on ga.contentid = dd.contentid where ga.contentauditid = 0 from gridaudits ga join deleted dd on ga.contentid = dd.contentid where ga.contentauditid = 0
end end
go go
+18 -113
View File
@@ -1,7 +1,4 @@
using System;
using System.Drawing; using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
namespace Accentra.Controls namespace Accentra.Controls
@@ -11,11 +8,6 @@ namespace Accentra.Controls
/// </summary> /// </summary>
public class TablePicker : System.Windows.Forms.Form public class TablePicker : System.Windows.Forms.Form
{ {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public TablePicker() public TablePicker()
{ {
// Activates double buffering // Activates double buffering
@@ -29,21 +21,6 @@ namespace Accentra.Controls
InitializeComponent(); InitializeComponent();
} }
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
@@ -75,80 +52,39 @@ namespace Accentra.Controls
} }
#endregion #endregion
private Pen BeigePen = new Pen(Color.Beige, 1); private readonly Brush BlackBrush = System.Drawing.Brushes.Black;
private Brush BeigeBrush = System.Drawing.Brushes.Beige; private readonly Brush WhiteBrush = System.Drawing.Brushes.White;
private Brush GrayBrush = System.Drawing.Brushes.Gray;
private Brush BlackBrush = System.Drawing.Brushes.Black;
private Brush WhiteBrush = System.Drawing.Brushes.White;
private Brush Jbrush = System.Drawing.Brushes.LightBlue; private readonly Brush Jbrush = System.Drawing.Brushes.LightBlue;
//private Brush Jbrush = System.Drawing.Brushes.LightSteelBlue;
//private Brush Jbrush = System.Drawing.Brushes.SteelBlue;
//private Brush Jbrush = System.Drawing.Brushes.PowderBlue;
private Pen BorderPen = new Pen(SystemColors.ControlDark); private readonly Pen BorderPen = new Pen(SystemColors.ControlDark);
private Pen BluePen = new Pen(Color.SlateGray, 1); private readonly Pen BluePen = new Pen(Color.SlateGray, 1);
private string DispText = "Esc to Cancel"; // Display text private string DispText = "Esc to Cancel"; // Display text
private int DispHeight = 40;//20; // Display ("Table 1x1", "Cancel") private readonly int DispHeight = 40; // Display ("Table 1x1", "Cancel")
private Font DispFont = new Font("Tahoma", 8.25F); private readonly Font DispFont = new Font("Tahoma", 8.25F);
private int SquareX = 20; // Width of squares private readonly int SquareX = 20; // Width of squares
private int SquareY = 20; // Height of squares private readonly int SquareY = 20; // Height of squares
private int SquareQX = 3; // Number of visible squares (X) private int SquareQX = 3; // Number of visible squares (X)
private int SquareQY = 3; // Number of visible squares (Y) private int SquareQY = 3; // Number of visible squares (Y)
private int SelQX = 1; // Number of selected squares (x) private int SelQX = 1; // Number of selected squares (x)
private int SelQY = 1; // Number of selected squares (y) private int SelQY = 1; // Number of selected squares (y)
private bool bHiding = false; public int MaxRows { get; set; } = -1;
private bool bCancel = true; // Determines whether to Cancel
// Added my Volian 4/27/11 public int MaxCols { get; set; } = -1;
private int _MaxRows = -1;
public int MaxRows
{
get { return _MaxRows; }
set { _MaxRows = value; }
}
private int _MaxCols = -1;
public int MaxCols
{
get { return _MaxCols; }
set { _MaxCols = value; }
}
/// <summary>
/// Similar to <code><see cref="DialogResult"/>
/// == <see cref="DialogResult.Cancel"/></code>,
/// but is used as a state value before the form
/// is hidden and cancellation is finalized.
/// </summary>
public bool Cancel {
get {
return bCancel;
}
}
/// <summary> /// <summary>
/// Returns the number of columns, or the horizontal / X count, /// Returns the number of columns, or the horizontal / X count,
/// of the selection. /// of the selection.
/// </summary> /// </summary>
public int SelectedColumns { public int SelectedColumns => SelQX;
get {
return SelQX;
}
}
/// <summary> /// <summary>
/// Returns the number of rows, or the vertical / Y count, /// Returns the number of rows, or the vertical / Y count,
/// of the selection. /// of the selection.
/// </summary> /// </summary>
public int SelectedRows { public int SelectedRows => SelQY;
get {
return SelQY;
}
}
private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
Graphics g = e.Graphics; Graphics g = e.Graphics;
@@ -162,8 +98,8 @@ namespace Accentra.Controls
if (SquareQX < 7) SquareQX = 7; if (SquareQX < 7) SquareQX = 7;
if (SquareQY < 5) SquareQY = 5; if (SquareQY < 5) SquareQY = 5;
if (_MaxRows > 0 && SquareQY > _MaxRows) SquareQY = _MaxRows; if (MaxRows > 0 && SquareQY > MaxRows) SquareQY = MaxRows;
if (_MaxCols > 0 && SquareQX > _MaxCols) SquareQX = _MaxCols; if (MaxCols > 0 && SquareQX > MaxCols) SquareQX = MaxCols;
// Second, expand the dimensions of this form according to the // Second, expand the dimensions of this form according to the
// number of visible squares. // number of visible squares.
@@ -177,14 +113,7 @@ namespace Accentra.Controls
// the text is left-justified, only the Y (vertical) position // the text is left-justified, only the Y (vertical) position
// is calculated. // is calculated.
int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4; int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4;
//if (this.Cancel) { DispText = $"{SelQY} Row{((SelQY > 1) ? "s" : "")} {SelQX} Column{((SelQX > 1) ? "s" : "")}\nEsc to Cancel";
// DispText = "Esc Key to Cancel";
//} else {
// DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table";
//}
//DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table\nEsc Key to Cancel";
//DispText = SelQY.ToString() + " Row"+((SelQY>1)?"s by ":" by ") + SelQX.ToString() + " Column"+((SelQX>1)?"s\nEsc Key to Cancel":"\nEsc Key to Cancel");
DispText = SelQY.ToString() + " Row" + ((SelQY > 1) ? "s" : "") + " " + SelQX.ToString() + " Column" + ((SelQX > 1) ? "s" : "")+ "\nEsc to Cancel";
g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2); g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2);
// Draw each of the squares and fill with the default color. // Draw each of the squares and fill with the default color.
@@ -198,7 +127,6 @@ namespace Accentra.Controls
// Go back and paint the squares with selection colors. // Go back and paint the squares with selection colors.
for (int x=0; x<SelQX; x++) { for (int x=0; x<SelQX; x++) {
for (int y=0; y<SelQY; y++) { for (int y=0; y<SelQY; y++) {
//g.FillRectangle(BeigeBrush, (x*SquareX) + 3, (y*SquareY) + 3, SquareX - 2, SquareY - 2);
g.FillRectangle(Jbrush, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2); g.FillRectangle(Jbrush, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2);
g.DrawRectangle(BluePen, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2); g.DrawRectangle(BluePen, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2);
} }
@@ -210,11 +138,6 @@ namespace Accentra.Controls
/// </summary> /// </summary>
private void TablePicker_Deactivate(object sender, System.EventArgs e) { private void TablePicker_Deactivate(object sender, System.EventArgs e) {
// bCancel = true
// and DialogResult = DialogResult.Cancel
// were previously already set in MouseLeave.
//this.Hide();
} }
/// <summary> /// <summary>
@@ -242,9 +165,6 @@ namespace Accentra.Controls
/// escaped (canceling) state. /// escaped (canceling) state.
/// </summary> /// </summary>
private void TablePicker_MouseLeave(object sender, System.EventArgs e) { private void TablePicker_MouseLeave(object sender, System.EventArgs e) {
//if (!bHiding) bCancel = true;
//this.DialogResult = DialogResult.Cancel;
//this.Invalidate();
if (this.DialogResult == DialogResult.None) if (this.DialogResult == DialogResult.None)
this.DialogResult = DialogResult.Cancel; this.DialogResult = DialogResult.Cancel;
} }
@@ -252,32 +172,17 @@ namespace Accentra.Controls
/// <summary> /// <summary>
/// Cancels the prior cancellation caused by MouseLeave. /// Cancels the prior cancellation caused by MouseLeave.
/// </summary> /// </summary>
private void TablePicker_MouseEnter(object sender, System.EventArgs e) { private void TablePicker_MouseEnter(object sender, System.EventArgs e) => this.Invalidate();
//bHiding = false;
//bCancel = false;
//this.DialogResult = DialogResult.OK;
this.Invalidate();
}
/// <summary> /// <summary>
/// Detects that the user made a selection by clicking. /// Detects that the user made a selection by clicking.
/// </summary> /// </summary>
private void TablePicker_Click(object sender, System.EventArgs e) { private void TablePicker_Click(object sender, System.EventArgs e) => this.DialogResult = DialogResult.OK;
//bHiding = true; // Not the same as Visible == false
// // because bHiding suggests that the control
// // is still "active" (not canceled).
//this.Hide();
this.DialogResult = DialogResult.OK;
}
private void TablePicker_KeyPress(object sender, KeyPressEventArgs e) private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == (char)Keys.Escape) if (e.KeyChar == (char)Keys.Escape)
{ {
//bHiding = true; // Not the same as Visible == false
//// because bHiding suggests that the control
//// is still "active" (not canceled).
//this.Hide();
this.DialogResult = DialogResult.Cancel; this.DialogResult = DialogResult.Cancel;
} }
} }
@@ -1395,7 +1395,7 @@ namespace VEPROMS
DoCreatePDF(); // create indivitual pdfs DoCreatePDF(); // create indivitual pdfs
if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath; if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath;
// C2021-063 pass in whether to generate Alarm Point List text when a merge is done // C2021-063 pass in whether to generate Alarm Point List text when a merge is done
if (!_MergedPfd.DoTheMerge(PromsPrinter.MergedLandscapePages,cbxAlmPtTxt.Checked)) return; // merge them together. if (!_MergedPfd.DoTheMerge(cbxAlmPtTxt.Checked)) return; // merge them together.
// if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done // if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done
if (_DocVersionConfig.Print_MergedPdfsViewAfter) if (_DocVersionConfig.Print_MergedPdfsViewAfter)
{ {
+303 -45
View File
@@ -5227,7 +5227,7 @@ CREATE PROCEDURE [dbo].[getRevisionByItemIDandRevisionNumberAndUnitID]
WITH EXECUTE AS OWNER WITH EXECUTE AS OWNER
AS AS
declare @RevisionID int declare @RevisionID int
set @RevisionID = (select revisionid from revisions rr cross apply rr.config.nodes('//Applicability') t1(r1) where itemid = @itemid and revisionnumber = @RevisionNumber and r1.value('@Index','int') = @UnitID) set @RevisionID = (select top 1 revisionid from revisions rr cross apply rr.config.nodes('//Applicability') t1(r1) where itemid = @itemid and revisionnumber = @RevisionNumber and r1.value('@Index','int') = @UnitID order by revisionid desc)
SELECT SELECT
[RevisionID], [RevisionID],
[ItemID], [ItemID],
@@ -5547,6 +5547,12 @@ ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
GO GO
------- -------
-- =============================================
-- Author: Matthew Schill
-- Modify date: 07/14/2026
-- Description: Reworked ve_GetParentItem for Performance improvement
-- =============================================
/****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/ /****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
DROP FUNCTION [ve_GetParentItem]; DROP FUNCTION [ve_GetParentItem];
@@ -5555,35 +5561,46 @@ GO
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved. Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/ *****************************************************************************/
CREATE FUNCTION [dbo].[ve_GetParentItem] (@ItemID int) RETURNS int CREATE OR ALTER FUNCTION [dbo].[ve_GetParentItem] (@ItemID int) RETURNS int
WITH EXECUTE AS OWNER WITH EXECUTE AS OWNER
AS AS
BEGIN BEGIN
DECLARE @ParentID int; DECLARE @ParentID int;
WITH Itemz([ItemID],[IsFound]) as WITH Itemz([ItemID]) as
( (
select ii.itemid,0 from items ii where ii.itemid = @ItemID select ii.itemid from items ii WITH (NOLOCK) where ii.itemid = @ItemID
union all union all
select ii.previousid,0 from items ii select ii.previousid from items ii WITH (NOLOCK)
join itemz zz on ii.itemid = zz.itemid join itemz zz on ii.itemid = zz.itemid
where ii.previousid is not null where ii.previousid is not null
and zz.isfound = 0
union all
select ii.itemid,1
from parts pp
join itemz zz on pp.itemid = zz.itemid
join items ii on ii.contentid = pp.contentid
) )
select top 1 @ParentID = itemid from itemz select top 1 @ParentID = ii.itemid
where isfound = 1 OPTION (MAXRECURSION 10000) from itemz
inner join parts pp WITH (NOLOCK) on pp.itemid = itemz.itemid
inner join items ii WITH (NOLOCK) on ii.contentid = pp.contentid
OPTION (MAXRECURSION 10000)
RETURN @ParentID RETURN @ParentID
END END
GO GO
IF (@@Error = 0) PRINT 'ScalerFunction [vefn_GetParentItem] Succeeded' IF (@@Error = 0) PRINT 'ScalerFunction [vefn_GetParentItem] Succeeded'
ELSE PRINT 'ScalerFunction [vefn_GetParentItem] Error on Creation' ELSE PRINT 'ScalerFunction [vefn_GetParentItem] Error on Creation'
go go
IF EXISTS (SELECT * FROM dbo.sysIndexes WHERE name like 'IX_PartsItemID')
DROP INDEX [IX_PartsItemID] ON [dbo].[tblParts];
GO
CREATE NONCLUSTERED INDEX IX_PartsItemID
ON [dbo].[tblParts] ([ItemID] ASC)
INCLUDE([ContentID],[DeleteStatus],[FromType]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
PRINT 'Added IX_PartsItemID Index. Speeds up Getting Parent Items'
GO
/****** Object: UserDefinedFunction [dbo].[vefn_CanTransitionBeCreated] Script Date: 10/14/2012 02:03:30 ******/ /****** Object: UserDefinedFunction [dbo].[vefn_CanTransitionBeCreated] Script Date: 10/14/2012 02:03:30 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_CanTransitionBeCreated]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_CanTransitionBeCreated]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
DROP FUNCTION [vefn_CanTransitionBeCreated]; DROP FUNCTION [vefn_CanTransitionBeCreated];
@@ -13541,34 +13558,6 @@ IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteAllDocVers
DROP PROCEDURE [deleteAllDocVersionPdfs]; DROP PROCEDURE [deleteAllDocVersionPdfs];
GO GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2017 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[deleteAllDocVersionPdfs]
(
@VersionID int
)
WITH EXECUTE AS OWNER
AS
BEGIN TRY -- Try Block
BEGIN TRANSACTION
DELETE [Pdfs]
WHERE [DocID] IN(select EE.DocID from vefn_GetVersionItems(cast(@VersionID as varchar(20))) VI
Join Entries EE ON EE.ContentID= VI.ContentID)
IF( @@TRANCOUNT > 0 ) COMMIT
END TRY
BEGIN CATCH -- Catch Block
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
EXEC vlnErrorHandler
END CATCH
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: deleteAllDocVersionPdfs Succeeded'
ELSE PRINT 'Procedure Creation: deleteAllDocVersionPdfs Error on Creation'
GO
/****** Object: StoredProcedure [addFiguresByROFstIDandImageIDs] ******/ /****** Object: StoredProcedure [addFiguresByROFstIDandImageIDs] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addFiguresByROFstIDandImageIDs]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[addFiguresByROFstIDandImageIDs]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [addFiguresByROFstIDandImageIDs]; DROP PROCEDURE [addFiguresByROFstIDandImageIDs];
@@ -17169,6 +17158,7 @@ GO
[roid] [varchar](50) NOT NULL, [roid] [varchar](50) NOT NULL,
[appid] [varchar](max) NULL, [appid] [varchar](max) NULL,
[value] [varchar](max) NULL, [value] [varchar](max) NULL,
[moddatetime] [datetime] NULL,
CONSTRAINT [PK_RofstChild] PRIMARY KEY CLUSTERED CONSTRAINT [PK_RofstChild] PRIMARY KEY CLUSTERED
( (
[RofstChildID] ASC [RofstChildID] ASC
@@ -17303,6 +17293,23 @@ GO
End -- Rofst Tables End -- Rofst Tables
Go Go
-- =============================================
-- Author: Matthew Schill
-- Create date: 03/30/2026
-- Description: Store RO Modification date/time
-- =============================================
--- Add Column to store RO Modification date/time if it does not already exist
IF NOT EXISTS(SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'RofstChild'
AND COLUMN_NAME = 'moddatetime')
ALTER TABLE RofstChild ADD moddatetime datetime NULL;
go
-- Display the status
IF (@@Error = 0) PRINT 'Altered table [RofstChild] Succeeded for moddatetime'
ELSE PRINT 'Altered table [RofstChild] Error on Alter for moddatetime'
go
/* /*
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
@@ -19705,6 +19712,7 @@ GO
@roid VarChar(50), @roid VarChar(50),
@appid VarChar(Max) = null, @appid VarChar(Max) = null,
@value VarChar(Max) = null, @value VarChar(Max) = null,
@ModDateTime DateTime = null,
@missingDefaultValue VarChar(Max) = null @missingDefaultValue VarChar(Max) = null
) )
With Execute as Owner With Execute as Owner
@@ -19722,8 +19730,8 @@ GO
Set @missingDefaultValue = '[TBD]'; Set @missingDefaultValue = '[TBD]';
-- Create Rofst Child/Group Record --> [Roid = (12) Digits] -- Create Rofst Child/Group Record --> [Roid = (12) Digits]
Insert Into RofstChild (RofstID, ID, ParentID, dbiID, [type], title, roid, appid, [value]) Insert Into RofstChild (RofstID, ID, ParentID, dbiID, [type], title, roid, appid, moddatetime, [value])
Values (@RofstID, @ID, @ParentID, @dbiID, @type, @title, @roid, @appid, REPLACE(REPLACE(@value, '&123;', '{'), '&125;', '}')); Values (@RofstID, @ID, @ParentID, @dbiID, @type, @title, @roid, @appid, @ModDateTime, REPLACE(REPLACE(@value, '&123;', '{'), '&125;', '}'));
-- Check for appid, if exists, then insert the default value for each return type if multi-value -- Check for appid, if exists, then insert the default value for each return type if multi-value
@@ -24777,6 +24785,256 @@ IF (@@Error = 0) PRINT 'Procedure Creation: [GetMissingDocsByUnit] Succeeded'
ELSE PRINT 'Procedure Creation: [GetMissingDocsByUnit] Error on Creation' ELSE PRINT 'Procedure Creation: [GetMissingDocsByUnit] Error on Creation'
GO GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_ROFST_changes]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
DROP FUNCTION [vefn_ROFST_changes];
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*
==========================================================================================================
Author: Matthew Schill
Create Date: 03/31/2026
Description: Function for ROs that updated in latest RO FST Load
==========================================================================================================
*/
CREATE FUNCTION [dbo].[vefn_ROFST_changes](@OrigFSTID int, @NewFSTid int, @VersionID int)
RETURNS @ROIDs TABLE
(
[roid] varchar(50)
)
WITH EXECUTE AS OWNER
AS
BEGIN
insert into @ROIDs
SELECT DISTINCT ISNULL(RofstChild.roid,previous.roid)
FROM
(SELECT * FROM RofstChild where RofstChild.RofstID = @NewFSTid) RofstChild
FULL OUTER JOIN
(SELECT * FROM RofstChild previous where previous.RofstID = @OrigFSTID) previous
ON previous.dbiID = RofstChild.dbiID AND previous.ID = RofstChild.ID
where
ISNULL(previous.RofstID,'') != ISNULL(RofstChild.RofstID,'')
AND
(
(RofstChild.RofstID = @NewFSTid OR RofstChild.RofstID IS NULL)
AND
(previous.RofstID = @OrigFSTID OR previous.RofstID IS NULL)
)
AND
(previous.moddatetime IS NULL
OR RofstChild.moddatetime IS NULL
OR RofstChild.moddatetime != previous.moddatetime
OR RofstChild.title != previous.title
OR RofstChild.value != previous.value
)
RETURN
END
go
IF (@@Error = 0) PRINT 'TableFunction [vefn_ROFST_changes] Succeeded'
ELSE PRINT 'TableFunction [vefn_ROFST_changes] Error on Creation'
go
/****** Object: StoredProcedure [deleteDocVersionPdfsWithNewROs] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteDocVersionPdfsWithNewROs]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [deleteDocVersionPdfsWithNewROs];
GO
/*
==========================================================================================================
Author: Matthew Schill
Create Date: 03/31/2026
Description: Delete all PDFs with ROs that will need re-resolved
==========================================================================================================
*/
CREATE PROCEDURE [dbo].[deleteDocVersionPdfsWithNewROs]
(
@VersionID int,
@OrigFSTid int,
@NewFSTid int
)
WITH EXECUTE AS OWNER
AS
BEGIN
DELETE [Pdfs]
WHERE [DocID] IN
(
select EE.DocID from vefn_GetVersionItems(cast(@VersionID as varchar(20))) VI
Join Entries EE ON EE.ContentID= VI.ContentID
Join DRoUsages ON DRoUsages.DocID = EE.DocID
Join dbo.vefn_ROFST_changes(@OrigFSTID, @NewFSTid, @VersionID) ROFST_changes on LEFT(DRoUsages.ROID,12) = ROFST_changes.roid
)
RETURN
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: deleteDocVersionPdfsWithNewROs Succeeded'
ELSE PRINT 'Procedure Creation: deleteDocVersionPdfsWithNewROs Error on Creation'
GO
/****** Object: StoredProcedure [getItemsWithNewROs] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemsWithNewROs]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getItemsWithNewROs];
GO
/*
==========================================================================================================
Author: Matthew Schill
Create Date: 03/31/2026
Description: Get Items with New ROs that will need resolved
==========================================================================================================
*/
CREATE PROCEDURE [dbo].[getItemsWithNewROs]
(
@VersionID int,
@OrigFSTid int,
@NewFSTid int
)
WITH EXECUTE AS OWNER
AS
BEGIN
select DISTINCT tblItems.ItemID FROM
dbo.vefn_ROFST_changes(@OrigFSTID, @NewFSTid, @VersionID) ROFST_changes
INNER JOIN RoUsages ON LEFT(RoUsages.ROID,12) = ROFST_changes.roid
INNER JOIN tblItems ON RoUsages.ContentID = tblItems.ContentID
OUTER APPLY (Select VersionID = dbo.vefn_GetVersionIDByItemID(tblItems.ItemID)) ver
INNER JOIN DocVersions DV ON DV.VersionID = ver.VersionID
INNER JOIN Associations ON Associations.VersionID = DV.VersionID
where ver.VersionID = @VersionID
RETURN
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: getItemsWithNewROs Succeeded'
ELSE PRINT 'Procedure Creation: getItemsWithNewROs Error on Creation'
GO
/****** Object: StoredProcedure [dbo].[getRevisionByItemIDandRevisionNumber] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[getRevisionByItemIDandRevisionNumber]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[getRevisionByItemIDandRevisionNumber];
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[getRevisionByItemIDandRevisionNumber]
(
@ItemID int,
@RevisionNumber nvarchar(50)
)
WITH EXECUTE AS OWNER
AS
declare @RevisionID int
set @RevisionID = (select top 1 revisionid from revisions where itemid = @itemid and revisionnumber = @RevisionNumber order by revisionid desc)
SELECT
[RevisionID],
[ItemID],
[TypeID],
[RevisionNumber],
[RevisionDate],
[Notes],
[Config],
[DTS],
[UserID],
[LastChanged],
(SELECT COUNT(*) FROM [Checks] WHERE [Checks].[RevisionID]=[Revisions].[RevisionID]) [CheckCount],
(SELECT COUNT(*) FROM [Versions] WHERE [Versions].[RevisionID]=[Revisions].[RevisionID]) [VersionCount]
FROM [Revisions]
WHERE [RevisionID]=@RevisionID
SELECT
[Checks].[CheckID],
[Checks].[RevisionID],
[Checks].[StageID],
[Checks].[ConsistencyChecks],
[Checks].[DTS],
[Checks].[UserID],
[Checks].[LastChanged],
[Stages].[Name] [Stage_Name],
[Stages].[Description] [Stage_Description],
[Stages].[IsApproved] [Stage_IsApproved],
[Stages].[DTS] [Stage_DTS],
[Stages].[UserID] [Stage_UserID]
FROM [Checks]
JOIN [Stages] ON
[Stages].[StageID]=[Checks].[StageID]
WHERE
[Checks].[RevisionID]=@RevisionID
SELECT
[Versions].[VersionID],
[Versions].[RevisionID],
[Versions].[StageID],
[Versions].[DTS],
[Versions].[UserID],
[Versions].[LastChanged],
[Versions].[PDF],
[Versions].[SummaryPDF],
[Stages].[Name] [Stage_Name],
[Stages].[Description] [Stage_Description],
[Stages].[IsApproved] [Stage_IsApproved],
[Stages].[DTS] [Stage_DTS],
[Stages].[UserID] [Stage_UserID]
FROM [Versions]
JOIN [Stages] ON
[Stages].[StageID]=[Versions].[StageID]
WHERE
[Versions].[RevisionID]=@RevisionID
RETURN
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: getRevisionByItemIDandRevisionNumber Succeeded'
ELSE PRINT 'Procedure Creation: getRevisionByItemIDandRevisionNumber Error on Creation'
GO
/*
==========================================================================================================
Author: Matthew Schill
Create Date: 06/29/2026
Description: Added an ISNULL check when setting GridAudits.contentauditid.
Was Causing Deletion of some Grids to fail.
==========================================================================================================
*/
/****** Object: Trigger [tr_Contents_Delete] ******/
ALTER trigger [dbo].[tr_Contents_Delete] on [dbo].[Contents] instead of delete as
begin
update ii set DeleteStatus = (select max(DeleteID) from DeleteLog where SPID = @@spid), ActionDTS = getdate(),
UserID = (select top 1 UserID from DeleteLog where SPID = @@spid order by deleteid desc)
from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID
insert into ContentAudits(ContentID,Number,Text,Type,FormatID,Config,DTS,UserID,DeleteStatus,ActionDTS)
select ii.ContentID,ii.Number,ii.Text,ii.Type,ii.FormatID,ii.Config,ii.DTS,ii.UserID,ii.DeleteStatus,ii.ActionDTS
from tblContents ii inner join deleted dd on dd.ContentID = ii.ContentID
where ii.DeleteStatus > 0
update ga set ga.contentauditid = (select ISNULL(max(auditid),0) from contentaudits where contentid = ga.contentid and deletestatus = ga.deletestatus)
from gridaudits ga join deleted dd on ga.contentid = dd.contentid where ga.contentauditid = 0
end
go
-- Display the status of Trigger alter
IF (@@Error = 0) PRINT 'Trigger Alteration: tr_Contents_Delete Succeeded'
ELSE PRINT 'Trigger Alteration: tr_Contents_Delete Error on Creation'
GO
/* /*
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
| ADD New Code Before this Block | | ADD New Code Before this Block |
@@ -24810,8 +25068,8 @@ BEGIN TRY -- Try Block
DECLARE @RevDate varchar(255) DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255) DECLARE @RevDescription varchar(255)
set @RevDate = '03/13/2026 7:00 AM' set @RevDate = '07/16/2026 8:30 AM'
set @RevDescription = 'Added Get Missing Docs by Unit for Generating Pdf table' set @RevDescription = 'Reworked ve_GetParentItem for Performance improvement'
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
@@ -67,6 +67,7 @@ namespace VEPROMS
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing _MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave; ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave;
_MyApproval.SavedSlave = ApplicabilityIndex;
this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest); this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest); this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
_MyDocVersion = myDocVersion; _MyDocVersion = myDocVersion;
@@ -292,6 +293,7 @@ namespace VEPROMS
expAddProcConChk.Expanded = true; expAddProcConChk.Expanded = true;
_initializing = true; _initializing = true;
ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave; ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave;
_MyApproval.SavedSlave = ApplicabilityIndex;
InitializePanelApprove(); InitializePanelApprove();
InitializePanelSelect(); InitializePanelSelect();
_initializing = false; _initializing = false;
@@ -306,6 +308,7 @@ namespace VEPROMS
_MyDocVersion = myProcedure.MyDocVersion; _MyDocVersion = myProcedure.MyDocVersion;
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list _MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
ApplicabilityIndex = _MyDocVersion.DocVersionConfig.SelectedSlave; // B2022-033 set the child being approved or workflow so other procedure list can populate ApplicabilityIndex = _MyDocVersion.DocVersionConfig.SelectedSlave; // B2022-033 set the child being approved or workflow so other procedure list can populate
_MyApproval.SavedSlave = ApplicabilityIndex;
InitializeComponent(); InitializeComponent();
FlexGridAddEvents(); FlexGridAddEvents();
SetupComboBoxes(); SetupComboBoxes();
@@ -914,6 +917,11 @@ namespace VEPROMS
get { return _MyProcedures; } get { return _MyProcedures; }
//set { _MyProcedures = value; } //set { _MyProcedures = value; }
} }
//B2026-058 - If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit.
// this will save the SectedSlave in case a refresh causes it to get lost
public int SavedSlave { get; set; } = 0;
public ApprovalInfo(frmVEPROMS myFrmVEPROMS) public ApprovalInfo(frmVEPROMS myFrmVEPROMS)
{ {
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
@@ -1173,9 +1181,14 @@ namespace VEPROMS
string pdfPath = string.Format(@"{0}\{1}", VlnSettings.TemporaryFolder, pdfTmp); string pdfPath = string.Format(@"{0}\{1}", VlnSettings.TemporaryFolder, pdfTmp);
if (!TryToDelete(summaryPDF, "Change Summary")) break; if (!TryToDelete(summaryPDF, "Change Summary")) break;
if (!TryToDelete(pdfPath,revisionStage)) break; if (!TryToDelete(pdfPath,revisionStage)) break;
if (SavedSlave > 0 && ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave < 1)
{
//B2026-058 - If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit.
ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave = SavedSlave;
}
procsApproved.Add(ap.ProcInfo.DisplayNumber + " " + ap.ProcInfo.DisplayText); procsApproved.Add(ap.ProcInfo.DisplayNumber + " " + ap.ProcInfo.DisplayText);
RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID); RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID);
// RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID); // RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID);
DateTime myDTS = pi.DTS; // pi.DTS is date of last approval DateTime myDTS = pi.DTS; // pi.DTS is date of last approval
string cbDTS = (pi.MyConfig as ProcedureConfig).Print_ChangeBarDate; string cbDTS = (pi.MyConfig as ProcedureConfig).Print_ChangeBarDate;
// pi.DTS was the field that was used to store the approval date before master/slave code was added. Use ChangeBarDate if it is set - this is set either manually if no approval date (from treeview menu) or // pi.DTS was the field that was used to store the approval date before master/slave code was added. Use ChangeBarDate if it is set - this is set either manually if no approval date (from treeview menu) or
@@ -1343,6 +1356,8 @@ namespace VEPROMS
//// so change bars update //// so change bars update
//// on any open StepPanel //// on any open StepPanel
newproc = ItemInfo.ResetProcedure(pi.ItemID);
//B2026-019 Attempt to prevent an Access Error by utilizing a different Refresh if a Procedure is Open //B2026-019 Attempt to prevent an Access Error by utilizing a different Refresh if a Procedure is Open
DisplayTabItem dti = MyFrmVEPROMS.GetTabContainingProcedure(pi.ItemID); DisplayTabItem dti = MyFrmVEPROMS.GetTabContainingProcedure(pi.ItemID);
if (dti != null) if (dti != null)
@@ -1350,19 +1365,9 @@ namespace VEPROMS
if (!dti.MyStepTabPanel.MyStepPanel.ContainsFocus) if (!dti.MyStepTabPanel.MyStepPanel.ContainsFocus)
dti.MyStepTabPanel.MyStepPanel.Focus(); dti.MyStepTabPanel.MyStepPanel.Focus();
foreach (EditItem eitm in dti.MyStepTabPanel.MyStepPanel.Controls.OfType<EditItem>())
{
eitm.ChangeBar = eitm.MyItemInfo.HasChangeBar;
}
dti.MyStepTabPanel.MyStepTabRibbon.RefreshProcedure(); dti.MyStepTabPanel.MyStepTabRibbon.RefreshProcedure();
Application.DoEvents(); Application.DoEvents();
newproc = ProcedureInfo.Get(pi.ItemID);
}
else
{
newproc = ItemInfo.ResetProcedure(pi.ItemID);
} }
//since in a separate form, need to update the tree view //since in a separate form, need to update the tree view
@@ -1478,19 +1483,34 @@ namespace VEPROMS
{ {
ProcedureConfig pc = procedureInfo.MyConfig as ProcedureConfig; ProcedureConfig pc = procedureInfo.MyConfig as ProcedureConfig;
if (pc == null) return; if (pc == null) return;
pc.SelectedSlave = selectedSlave; pc.SelectedSlave = selectedSlave;
pc.Print_Rev = revNumber; pc.Print_Rev = revNumber;
//AppRevDate Change //AppRevDate Change
pc.Print_RevDate = revDate.ToString("MM/dd/yyyy"); pc.Print_RevDate = revDate.ToString("MM/dd/yyyy");
pc.Print_ChangeBarDate = dts.ToString("MM/dd/yyyy HH:mm:ss"); pc.Print_ChangeBarDate = dts.ToString("MM/dd/yyyy HH:mm:ss"); //this is needed to set the changebar date for an indeividual unit also
using (Item itm = Item.Get(procedureInfo.ItemID)) using (Item itm = Item.Get(procedureInfo.ItemID))
{ {
itm.MyContent.Config = pc.ToString(); itm.MyContent.Config = pc.ToString();
//itm.DTS = dts; //itm.DTS = dts;
itm.UserID = Volian.Base.Library.VlnSettings.UserID; itm.UserID = Volian.Base.Library.VlnSettings.UserID;
itm.Save(); itm.Save();
}
//C2026-015 set overall change bar date
if (selectedSlave > 0)
{
pc.SelectedSlave = 0;
pc.Print_Rev = revNumber;
pc.Print_RevDate = revDate.ToString("MM/dd/yyyy");
pc.Print_ChangeBarDate = dts.ToString("MM/dd/yyyy HH:mm:ss"); //this is needed to set the changebar date for an indeividual unit also
using (Item itm2 = Item.Get(procedureInfo.ItemID))
{
itm2.MyContent.Config = pc.ToString();
itm2.UserID = Volian.Base.Library.VlnSettings.UserID;
itm2.Save();
}
}
}
} }
} }
public class RevType public class RevType
@@ -68,8 +68,26 @@ namespace VEPROMS
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");// ("MM/dd/yyyy HH:mm:ss"); MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");// ("MM/dd/yyyy HH:mm:ss");
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History //CSM - C2026-010 - Add Audit Record for Change Bar Audit History
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({ dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss")}) by ({ VlnSettings.UserID}) on ({DateTime.Now})", DateTime.Now, VlnSettings.UserID, 0); ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss")}) by ({VlnSettings.UserID}) on ({DateTime.Now})", DateTime.Now, VlnSettings.UserID, 0);
//CSM C2026-014 if multi-unit, set for each unit
System.Data.DataTable dt = RevisionData.GetRevisionDataByUnit(MyProcInfo.ItemID);
if (RevisionData.HasUnits(dt))
{
//Change the ChangeBarDate for each unit
foreach (DataRow r in dt.Rows)
{
if (!r.IsNull("UnitID"))
{
MyProcConfig.SelectedSlave = Convert.ToInt32(r["UnitID"]);
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss")}) by ({VlnSettings.UserID}) on ({DateTime.Now}) for (Unit {r["UnitName"]})", DateTime.Now, VlnSettings.UserID, MyProcConfig.SelectedSlave);
}
}
MyProcConfig.SelectedSlave = 0;
}
} }
@@ -107,9 +125,12 @@ namespace VEPROMS
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append($" The Procedure Viewer Change Bar Date will be set to ({maxDTS})."); sb.Append($" The Procedure Viewer Change Bar Date will be set to ({maxDTS}).");
foreach (DataRow r in dt.Rows) foreach (DataRow r in dt.Rows)
{
if (!r.IsNull("UnitID"))
{ {
sb.Append($"\r\n The Change Bar Date for Unit ({r["UnitName"]}) will be set to ({Convert.ToDateTime(r["DTS"]):MM/dd/yyyy HH:mm:ss})."); sb.Append($"\r\n The Change Bar Date for Unit ({r["UnitName"]}) will be set to ({Convert.ToDateTime(r["DTS"]):MM/dd/yyyy HH:mm:ss}).");
} }
}
sb.Append("\r\n Any Change Bars for Units not listed above will use the Overall/Procedure Viewer Change Bar Date (as these Units have no approvals)."); sb.Append("\r\n Any Change Bars for Units not listed above will use the Overall/Procedure Viewer Change Bar Date (as these Units have no approvals).");
@@ -121,12 +142,14 @@ namespace VEPROMS
//Change the ChangeBarDate for each unit //Change the ChangeBarDate for each unit
foreach (DataRow r in dt.Rows) foreach (DataRow r in dt.Rows)
{ {
if (!r.IsNull("UnitID"))
{
MyProcConfig.SelectedSlave = Convert.ToInt32(r["UnitID"]); MyProcConfig.SelectedSlave = Convert.ToInt32(r["UnitID"]);
MyProcConfig.Print_ChangeBarDate = Convert.ToDateTime(r["DTS"]).ToString("MM / dd / yyyy HH: mm: ss"); MyProcConfig.Print_ChangeBarDate = Convert.ToDateTime(r["DTS"]).ToString("MM / dd / yyyy HH: mm: ss");
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History //CSM - C2026-010 - Add Audit Record for Change Bar Audit History
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Reset ChangeBars performed by ({VlnSettings.UserID}) on ({DateTime.Now}). ChangeBars reset to show since last approval ({Convert.ToDateTime(r["DTS"]):MM/dd/yyyy HH:mm:ss}) for (Unit {r["UnitName"]})", DateTime.Now, VlnSettings.UserID, MyProcConfig.SelectedSlave); ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Reset ChangeBars performed by ({VlnSettings.UserID}) on ({DateTime.Now}). ChangeBars reset to show since last approval ({Convert.ToDateTime(r["DTS"]):MM/dd/yyyy HH:mm:ss}) for (Unit {r["UnitName"]})", DateTime.Now, VlnSettings.UserID, MyProcConfig.SelectedSlave);
}
} }
MyProcConfig.SelectedSlave = 0; MyProcConfig.SelectedSlave = 0;
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
@@ -1036,6 +1036,9 @@ namespace VEPROMS
ROFstInfo roFstInfo = dq.DocVersionAssociations[0].MyROFst; ROFstInfo roFstInfo = dq.DocVersionAssociations[0].MyROFst;
string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst"; string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
//must get id before ROFST gets updated so know what to refresh later
int origfstid = roFstInfo.ROFstID;
//if (!pathExists(rofstPath)) //if (!pathExists(rofstPath))
if (!File.Exists(rofstPath)) if (!File.Exists(rofstPath))
{ {
@@ -1063,8 +1066,28 @@ namespace VEPROMS
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = dq.DocVersionAssociations[0].MyROFst; roFstInfo = dq.DocVersionAssociations[0].MyROFst;
} }
else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID)
{
//Handle issue where load failed without completing update
//previous RO FST did not load, get last loaded ID
//if none, use -1 which will check all ROs in the Working Draft
string cfg = dv.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
if (dv.DocVersionAssociations[0]?.MyROFst != null)
{
if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid))
{
origfstid = -1;
}
}
else
{
origfstid = -1;
}
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, txtProcess); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, txtProcess, roFstInfo, origfstid, roFstInfo.ROFstID);
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
} }
@@ -1316,9 +1339,9 @@ namespace VEPROMS
{ {
if (ProgressBar == null) return; if (ProgressBar == null) return;
ProgressBar.Value = 100;
ProgressBar.Maximum = 100;
ProgressBar.Text = value; ProgressBar.Text = value;
ProgressBar.Maximum = 100;
ProgressBar.Value = 100;
txtProcess.AppendText(value); txtProcess.AppendText(value);
txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(Environment.NewLine);
+1 -12
View File
@@ -83,7 +83,6 @@ namespace VEPROMS
this.lblUser = new DevComponents.DotNetBar.LabelItem(); this.lblUser = new DevComponents.DotNetBar.LabelItem();
this.lblLastChange = new DevComponents.DotNetBar.LabelItem(); this.lblLastChange = new DevComponents.DotNetBar.LabelItem();
this.btnStepRTF = new DevComponents.DotNetBar.ButtonItem(); this.btnStepRTF = new DevComponents.DotNetBar.ButtonItem();
this.btnFixMSWord = new DevComponents.DotNetBar.ButtonItem();
this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel(); this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel();
this.ctrlAnnotationDetails = new Volian.Controls.Library.AnnotationDetails(); this.ctrlAnnotationDetails = new Volian.Controls.Library.AnnotationDetails();
this.btnAnnoDetailsPushPin = new DevComponents.DotNetBar.ButtonX(); this.btnAnnoDetailsPushPin = new DevComponents.DotNetBar.ButtonX();
@@ -541,8 +540,7 @@ namespace VEPROMS
this.btnEditItem, this.btnEditItem,
this.lblUser, this.lblUser,
this.lblLastChange, this.lblLastChange,
this.btnStepRTF, this.btnStepRTF});
this.btnFixMSWord});
this.bottomBar.Location = new System.Drawing.Point(5, 573); this.bottomBar.Location = new System.Drawing.Point(5, 573);
this.bottomBar.Name = "bottomBar"; this.bottomBar.Name = "bottomBar";
this.bottomBar.Size = new System.Drawing.Size(1185, 25); this.bottomBar.Size = new System.Drawing.Size(1185, 25);
@@ -728,14 +726,6 @@ namespace VEPROMS
this.btnStepRTF.Text = "Step RTF"; this.btnStepRTF.Text = "Step RTF";
this.btnStepRTF.Click += new System.EventHandler(this.btnStepRTF_Click); this.btnStepRTF.Click += new System.EventHandler(this.btnStepRTF_Click);
// //
// btnFixMSWord
//
this.btnFixMSWord.ForeColor = System.Drawing.Color.Black;
this.btnFixMSWord.Name = "btnFixMSWord";
this.btnFixMSWord.Text = "Fix Symbol Fonts";
this.btnFixMSWord.Visible = false;
this.btnFixMSWord.Click += new System.EventHandler(this.btnFixMSWord_Click);
//
// epAnnotations // epAnnotations
// //
this.epAnnotations.CanvasColor = System.Drawing.SystemColors.Control; this.epAnnotations.CanvasColor = System.Drawing.SystemColors.Control;
@@ -1775,7 +1765,6 @@ namespace VEPROMS
private DevComponents.DotNetBar.ButtonItem btnItemInfo; private DevComponents.DotNetBar.ButtonItem btnItemInfo;
private DevComponents.DotNetBar.ButtonItem btnFilter; private DevComponents.DotNetBar.ButtonItem btnFilter;
private DevComponents.DotNetBar.TextBoxItem txtFilter; private DevComponents.DotNetBar.TextBoxItem txtFilter;
private DevComponents.DotNetBar.ButtonItem btnFixMSWord;
private Volian.Controls.Library.DisplayBookMarks displayBookMarks; private Volian.Controls.Library.DisplayBookMarks displayBookMarks;
//private DevComponents.DotNetBar.LabelItem lblLocked; //private DevComponents.DotNetBar.LabelItem lblLocked;
private DevComponents.DotNetBar.ButtonItem btnShortCuts; private DevComponents.DotNetBar.ButtonItem btnShortCuts;
+87 -33
View File
@@ -246,6 +246,10 @@ namespace VEPROMS
tc.MyCopyStep = myParent.tc.MyCopyStep; // copy the copystep info to the child window tc.MyCopyStep = myParent.tc.MyCopyStep; // copy the copystep info to the child window
//B2026 - 048 View Only Mode freezes PROMS if last tab closed
tc.EnableDisableStepProperties -= EnableDisableStepProperties;
tc.EnableDisableStepProperties += new StepTabRibbonEvent(EnableDisableStepProperties);
(tv.Nodes[0] as VETreeNode).InChildWindow = true; // tells us this folder's tree nodes are in the child window (tv.Nodes[0] as VETreeNode).InChildWindow = true; // tells us this folder's tree nodes are in the child window
} }
@@ -352,6 +356,7 @@ namespace VEPROMS
displayRO.TabControl = tc; // B2019-043 this was being passed in as a parameter for DisplayRO which caused issues with the Visual Studio designer displayRO.TabControl = tc; // B2019-043 this was being passed in as a parameter for DisplayRO which caused issues with the Visual Studio designer
bottomProgBar.ValueChanged += new EventHandler(bottomProgBar_ValueChanged); bottomProgBar.ValueChanged += new EventHandler(bottomProgBar_ValueChanged);
tc.EnableDisableStepProperties += new StepTabRibbonEvent(EnableDisableStepProperties);
// When creating an XY Plot, a System.Drawing.Graphics is needed and it requires a form. Use the main form. // When creating an XY Plot, a System.Drawing.Graphics is needed and it requires a form. Use the main form.
if (VlnSettings.DebugMode) if (VlnSettings.DebugMode)
@@ -964,7 +969,18 @@ namespace VEPROMS
{ {
pnl.ApplDisplayMode = displayApplicability.ViewMode; pnl.ApplDisplayMode = displayApplicability.ViewMode;
displayHistory.ApplDisplayMode = pnl.ApplDisplayMode; displayHistory.ApplDisplayMode = pnl.ApplDisplayMode;
//C2026-021 Expand Functionality of Viewing Mode
if (pnl.ApplDisplayMode > 0 && pnl.VwMode != E_ViewMode.View)
{
pnl.VwMode = E_ViewMode.View;
EnableDisableStepProperties(sender, new StepTabRibbonEventArgs(tc.SelectedDisplayTabItem.MyItemInfo, 0, pnl.VwMode));
MessageBox.Show("Changing to View Only Mode. Applicability Viewing Mode must be Master to return to Edit Mode. View Mode can be toggled off via the Ribbon->View tab.", "Changing to View Mode", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
pnl.MyStepTabPanel.MyStepTabRibbon.RefreshProcedure();
}
} }
void tv_ViewPDF(object sender, vlnTreeViewPdfArgs args) void tv_ViewPDF(object sender, vlnTreeViewPdfArgs args)
@@ -985,7 +1001,7 @@ namespace VEPROMS
fs.Close(); fs.Close();
System.Diagnostics.Process.Start(fileName); System.Diagnostics.Process.Start(fileName);
} }
catch (Exception ex) catch (Exception)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -1594,7 +1610,7 @@ namespace VEPROMS
displayRO.MyROFST = SelectedROFst; displayRO.MyROFST = SelectedROFst;
// B2023-021: force Load of Step Prop/RO panel RO tree by passing in // B2023-021: force Load of Step Prop/RO panel RO tree by passing in
// true to LoadTree // true to LoadTree
displayRO.LoadTree(true); if (!_WeAreExitingPROMS) displayRO.LoadTree(true);
} }
} }
@@ -1751,7 +1767,7 @@ namespace VEPROMS
} }
else if (args.TypesSelected == "Complete RO Report") else if (args.TypesSelected == "Complete RO Report")
{ {
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.CompleteROReport, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize); Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize);
myReport.Build(); myReport.Build();
} }
else if (args.TypesSelected == "RO Summary Report") else if (args.TypesSelected == "RO Summary Report")
@@ -2132,7 +2148,7 @@ namespace VEPROMS
//C2019-036 View Only mode work with Checked Out Procedures //C2019-036 View Only mode work with Checked Out Procedures
// View Only Mode is no longer checked out, so no longer has an OwnerID // View Only Mode is no longer checked out, so no longer has an OwnerID
// This will keep those tabs from auto-closing based on the timer // This will keep those tabs from auto-closing based on the timer
if (!myList.Contains(dti.OwnerID) && dti.MyStepTabPanel.MyStepPanel.VwMode != E_ViewMode.View) if (!myList.Contains(dti.OwnerID) && dti?.MyStepTabPanel?.MyStepPanel?.VwMode != E_ViewMode.View)
{ {
MyCloseTabList.PushDTI(dti); MyCloseTabList.PushDTI(dti);
} }
@@ -2395,6 +2411,7 @@ namespace VEPROMS
tv.MySessionInfo = MySessionInfo; tv.MySessionInfo = MySessionInfo;
tv.MyUserInfo = MyUserInfo; tv.MyUserInfo = MyUserInfo;
StepTabRibbon.MySessionInfo = MySessionInfo; StepTabRibbon.MySessionInfo = MySessionInfo;
displayRO.MySessionInfo = MySessionInfo;
// Initialize Caption with Server name and Database name. // Initialize Caption with Server name and Database name.
SetCaption(tv.TopNode as VETreeNode); SetCaption(tv.TopNode as VETreeNode);
@@ -3561,6 +3578,7 @@ namespace VEPROMS
{ {
if (parameter.StartsWith("/P=")) if (parameter.StartsWith("/P="))
{ {
BaseLnSettings.blBaseLine = true;
MSWordToPDF.Automatic = true; MSWordToPDF.Automatic = true;
PromsPrinter.BaselineTesting = true;// Set Baseline Testing property for PROMsPrinter PromsPrinter.BaselineTesting = true;// Set Baseline Testing property for PROMsPrinter
string[] dvstrs = parameter.Substring(3).Split(",".ToCharArray()); string[] dvstrs = parameter.Substring(3).Split(",".ToCharArray());
@@ -3606,7 +3624,7 @@ namespace VEPROMS
} }
ranAuto = true; ranAuto = true;
} }
BaseLnSettings.blBaseLine = false;
if (ranAuto) if (ranAuto)
{ {
this.Close(); this.Close();
@@ -4482,7 +4500,6 @@ namespace VEPROMS
{ {
infoPanel.Expanded = true; infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTags; infoTabs.SelectedTab = infotabTags;
displayTags.HighlightChangeStep();
} }
else if (args.PanelTabName == "Change Image Size") else if (args.PanelTabName == "Change Image Size")
{ {
@@ -4553,6 +4570,15 @@ namespace VEPROMS
SetCaption(tv.SelectedNode as VETreeNode); SetCaption(tv.SelectedNode as VETreeNode);
displayApplicability.MyDisplayTabItem = tc.SelectedDisplayTabItem; displayApplicability.MyDisplayTabItem = tc.SelectedDisplayTabItem;
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
// DisplayTab was changed
// need to clear the RTB selected
// without resetting the DVI or FST
// (those will be set manually / individually)
// this will prevent DVI and FST from changing to null then back again
// which will trigger reloads
displayRO.ClearRTB();
if (tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.DocVersionAssociationCount > 0) if (tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.DocVersionAssociationCount > 0)
{ {
displayRO.MyROFST = tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst; displayRO.MyROFST = tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
@@ -4562,9 +4588,24 @@ namespace VEPROMS
displayRO.MyROFST = null; displayRO.MyROFST = null;
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
// set the DocVersionInfo so that the FST and docversion are in sync
SelectedDVI = tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion;
if (displayRO.MyDvi != SelectedDVI)
{
displayRO.MyDvi = SelectedDVI;
}
Application.DoEvents();
// B2022-026 RO Memory reduction coding (Jakes Merge) // B2022-026 RO Memory reduction coding (Jakes Merge)
// B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures. (Added True for the forceLoad parameter) // B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures. (Added True for the forceLoad parameter)
displayRO.LoadTree(true); //C2026-008 Re-Architect RO.FST to include RO Modification date/time
// if ROFST got updated,
// set the Selected FST so it is in sync
if (!_WeAreExitingPROMS && displayRO.LoadTree(true))
{
SelectedROFst = displayRO.MyROFST;
}
lblUser.Text = tc.SelectedDisplayTabItem.MyUserRole; lblUser.Text = tc.SelectedDisplayTabItem.MyUserRole;
@@ -4579,7 +4620,7 @@ namespace VEPROMS
// also change the text on the buttons to read either Find or Find/Replace // also change the text on the buttons to read either Find or Find/Replace
// also toggle the Replace tab on the dialog based on the user's accessibility to the procedure // also toggle the Replace tab on the dialog based on the user's accessibility to the procedure
bool isReviewer = !MyUserInfo.IsAllowedToEdit(tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion); bool isReviewer = !MyUserInfo.IsAllowedToEdit(tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion);
pnl.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true); pnl.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling();
this.dlgFindReplace.ToggleReplaceTab(isReviewer ? E_ViewMode.View : E_ViewMode.Edit); this.dlgFindReplace.ToggleReplaceTab(isReviewer ? E_ViewMode.View : E_ViewMode.Edit);
pnl.MyStepTabPanel.MyStepTabRibbon.ToggleFindReplaceToolTip(isReviewer); pnl.MyStepTabPanel.MyStepTabRibbon.ToggleFindReplaceToolTip(isReviewer);
} }
@@ -4628,8 +4669,6 @@ namespace VEPROMS
if (args != null && args.MyEditItem != null && !args.MyEditItem.MyStepPanel.ContainsFocus) if (args != null && args.MyEditItem != null && !args.MyEditItem.MyStepPanel.ContainsFocus)
return; return;
btnFixMSWord.Visible = (args != null && (args.MyItemInfo != null && args.MyEditItem == null));
if (_LastStepRTB != null && !_LastStepRTB.Disposing && !_LastStepRTB.Closed) if (_LastStepRTB != null && !_LastStepRTB.Disposing && !_LastStepRTB.Closed)
_LastStepRTB.EditModeChanged -= new StepRTBEvent(_LastStepRTB_EditModeChanged); _LastStepRTB.EditModeChanged -= new StepRTBEvent(_LastStepRTB_EditModeChanged);
@@ -4767,7 +4806,13 @@ namespace VEPROMS
// B2022-026 RO Memory reduction coding (Jakes Merge) // B2022-026 RO Memory reduction coding (Jakes Merge)
displayRO.ProgressBar = bottomProgBar; displayRO.ProgressBar = bottomProgBar;
displayRO.MyRTB = args.MyEditItem.MyStepRTB; displayRO.MyRTB = args.MyEditItem.MyStepRTB;
displayRO.LoadTree(); //C2026-008 Re-Architect RO.FST to include RO Modification date/time
// if ROFST got updated,
// set the Selected FST so it is in sync
if (!_WeAreExitingPROMS && displayRO.LoadTree())
{
SelectedROFst = displayRO.MyROFST;
}
displayBookMarks.MyEditItem = args.MyEditItem; displayBookMarks.MyEditItem = args.MyEditItem;
displayHistory.MyEditItem = args.MyEditItem; displayHistory.MyEditItem = args.MyEditItem;
@@ -4797,7 +4842,7 @@ namespace VEPROMS
// B2022-026 RO Memory reduction coding (Jakes Merge) // B2022-026 RO Memory reduction coding (Jakes Merge)
displayRO.SetFindDocROButton(false); displayRO.SetFindDocROButton(false);
displayRO.LoadTree(); if (!_WeAreExitingPROMS) displayRO.LoadTree();
//C2019-036 View Only mode work with Checked Out Procedures //C2019-036 View Only mode work with Checked Out Procedures
//In View Only Mode - Step Properties should be disabled //In View Only Mode - Step Properties should be disabled
@@ -4838,15 +4883,31 @@ namespace VEPROMS
//In View Only Mode - Step Properties should be disabled //In View Only Mode - Step Properties should be disabled
public void EnableDisableStepProperties(object sender, StepTabRibbonEventArgs args) public void EnableDisableStepProperties(object sender, StepTabRibbonEventArgs args)
{ {
if (args.ViewMode == E_ViewMode.View && (infoTabs.Enabled || infoTabs.SelectedTab != infotabTags)) //C2026 - 021 Expand Functionality of Viewing Mode
//B2026 - 048 View Only Mode freezes PROMS if last tab closed
if (args.ViewMode == E_ViewMode.View && (infotabControlPanelTags.Enabled || (infoTabs.SelectedTab != infotabTags && infoTabs.SelectedTab != infotabApplicability)))
{
if (infoTabs.SelectedTab != infotabApplicability)
{ {
infoTabs.Enabled = true;
infoTabs.SelectedTab = infotabTags; infoTabs.SelectedTab = infotabTags;
infoTabs.Enabled = false;
} }
else if (args.ViewMode != E_ViewMode.View && !infoTabs.Enabled)
infotabControlPanelTags.Enabled = false;
infotabControlPanelRO.Enabled = false;
infotabControlPanelTransitions.Enabled = false;
tabControlPanel1.Enabled = false;
displayApplicability.SetEnableDisableItemSelection(false);
tcpFoldoutMaint.Enabled = false;
}
else if (args.ViewMode != E_ViewMode.View && !infotabControlPanelTags.Enabled)
{ {
infoTabs.Enabled = true; infotabControlPanelTags.Enabled = true;
infotabControlPanelRO.Enabled = true;
infotabControlPanelTransitions.Enabled = true;
tabControlPanel1.Enabled = true;
displayApplicability.SetEnableDisableItemSelection(true);
tcpFoldoutMaint.Enabled = true;
} }
} }
@@ -4931,7 +4992,13 @@ namespace VEPROMS
displayRO.CurROLink = args.MyLinkText.MyRoUsageInfo; displayRO.CurROLink = args.MyLinkText.MyRoUsageInfo;
// B2022-026 RO Memory reduction coding (Jakes Merge) // B2022-026 RO Memory reduction coding (Jakes Merge)
displayRO.LoadTree(); //C2026-008 Re-Architect RO.FST to include RO Modification date/time
// if ROFST got updated,
// set the Selected FST so it is in sync
if (displayRO.LoadTree())
{
SelectedROFst = displayRO.MyROFST;
}
} }
#endregion #endregion
@@ -5199,8 +5266,8 @@ namespace VEPROMS
{ {
if (SelectedDVI != null) if (SelectedDVI != null)
displayReports.Mydocversion = SelectedDVI; displayReports.Mydocversion = SelectedDVI;
displayReports.advTreeProcSetsFillIn(reportFocus); displayReports.advTreeProcSetsFillIn();
displayReports.advTreeROFillIn(reportFocus); displayReports.advTreeROFillIn();
displayReports.SelectReferencedObjectTab(); // to enable RO selection displayReports.SelectReferencedObjectTab(); // to enable RO selection
} }
} }
@@ -5241,19 +5308,6 @@ namespace VEPROMS
Clipboard.SetDataObject(mydo); Clipboard.SetDataObject(mydo);
} }
} }
private void btnFixMSWord_Click(object sender, EventArgs e)
{
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null)
{
string btnText = btnFixMSWord.Text;
btnFixMSWord.FixedSize = btnFixMSWord.Size;
btnFixMSWord.Text = "Processing ...";
this.Cursor = Cursors.WaitCursor;
tc.SelectedDisplayTabItem.MyDSOTabPanel.FixSymbolCharacters();
btnFixMSWord.Text = btnText;
this.Cursor = Cursors.Default;
}
}
private void epAnnotations_Resize(object sender, EventArgs e) private void epAnnotations_Resize(object sender, EventArgs e)
{ {
@@ -899,9 +899,9 @@ namespace VEPROMS
set set
{ {
if (ProgressBar == null) return; if (ProgressBar == null) return;
ProgressBar.Text = value;
ProgressBar.Maximum = 100; ProgressBar.Maximum = 100;
ProgressBar.Value = 100; ProgressBar.Value = 100;
ProgressBar.Text = value;
Application.DoEvents(); Application.DoEvents();
} }
} }
@@ -1527,6 +1527,9 @@ namespace VEPROMS
Cursor = Cursors.WaitCursor; Cursor = Cursors.WaitCursor;
//must get id before ROFST gets updated so know what to refresh later
int origfstid = SelectedROFst.ROFstID;
// RO changes placed in file in the Documents\VEPROMS folder // RO changes placed in file in the Documents\VEPROMS folder
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(_DocVersionConfig.MyDocVersion.MyDocVersionInfo)); swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(_DocVersionConfig.MyDocVersion.MyDocVersionInfo));
DocVersion dv = _DocVersionConfig.MyDocVersion; DocVersion dv = _DocVersionConfig.MyDocVersion;
@@ -1536,11 +1539,30 @@ namespace VEPROMS
ROFstInfo.UpdateRoFst(SelectedROFst.MyRODb, dv, SelectedROFst, DoProgressBarRefresh); ROFstInfo.UpdateRoFst(SelectedROFst.MyRODb, dv, SelectedROFst, DoProgressBarRefresh);
SelectedROFst = null; // set to null to force getting the updated ROfst SelectedROFst = null; // set to null to force getting the updated ROfst
} }
else if (!dv.ROfstLastCompleted && origfstid == SelectedROFst.ROFstID)
{
//Handle issue where load failed without completing update
//previous RO FST did not load, get last loaded ID
//if none, use -1 which will check all ROs in the Working Draft
string cfg = dv.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
if (dv.DocVersionAssociations[0]?.MyROFst != null)
{
if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid))
{
origfstid = -1;
}
}
else
{
origfstid = -1;
}
}
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.RefreshROFst(_DocVersionConfig.MyDocVersion, SelectedROFst, DoProgressBarRefresh, null); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, SelectedROFst, origfstid, SelectedROFst.ROFstID);
ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange; ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange;
SelectedROFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); SelectedROFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
@@ -124,6 +124,23 @@ namespace VEPROMS.CSLA.Library
_Xp["ROUpdate", "LoadingFigures"] = value; // save selected value _Xp["ROUpdate", "LoadingFigures"] = value; // save selected value
} }
} }
[Category("RO Update")]
[DisplayName("Previous ROFSTID")]
[RefreshProperties(RefreshProperties.All)]
[Description("Previous ROFSTID")]
public string ROUpdate_PrevROFSTID
{
get
{
string s = _Xp["ROUpdate", "PrevROFSTID"];// get the saved value
return s;
}
set
{
_Xp["ROUpdate", "PrevROFSTID"] = value; // save selected value
}
}
#endregion // ROUpdate #endregion // ROUpdate
#region ToString #region ToString
public override string ToString() public override string ToString()
+169 -95
View File
@@ -8,7 +8,6 @@ using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using static System.Net.Mime.MediaTypeNames;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -61,6 +60,7 @@ namespace VEPROMS.CSLA.Library
#region Structs / Internal Classes #region Structs / Internal Classes
[Serializable] [Serializable]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Keep Older Pre-existing naming conventions")]
public struct roHdr public struct roHdr
{ {
public int hSize; public int hSize;
@@ -78,6 +78,7 @@ namespace VEPROMS.CSLA.Library
}; };
[Serializable] [Serializable]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Keep Older Pre-existing naming conventions")]
public struct rodbi public struct rodbi
{ {
public int dbiID; public int dbiID;
@@ -91,16 +92,19 @@ namespace VEPROMS.CSLA.Library
}; };
[Serializable] [Serializable]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Keep Older Pre-existing naming conventions")]
public struct rogrp public struct rogrp
{ {
public string value; public string value;
public string appid; public string appid;
public int ID; public int ID;
public int ParentID; public int ParentID;
public DateTime? ModDateTime; //C2026-008 Re-Architect RO.FST to include RO Modification date/time
public rochild[] children; public rochild[] children;
}; };
[Serializable] [Serializable]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Keep Older Pre-existing naming conventions")]
public struct rochild public struct rochild
{ {
public int ID; public int ID;
@@ -110,6 +114,7 @@ namespace VEPROMS.CSLA.Library
public string roid; // roid unique identifier public string roid; // roid unique identifier
public string appid; // accessory page id - user specified unique id public string appid; // accessory page id - user specified unique id
public string value; // return value, can be multiple values public string value; // return value, can be multiple values
public DateTime? ModDateTime; //C2026-008 Re-Architect RO.FST to include RO Modification date/time
public rochild[] children; public rochild[] children;
}; };
@@ -131,7 +136,7 @@ namespace VEPROMS.CSLA.Library
private List<string> _baseAccPageKeys; private List<string> _baseAccPageKeys;
// RofstLookup/Conversion Variables // RofstLookup/Conversion Variables
private int _rofstID; private readonly int _rofstID;
private DocVersionInfo _myDocVersionInfo; private DocVersionInfo _myDocVersionInfo;
private int _selectedSlave; private int _selectedSlave;
private string _otherChild = string.Empty; private string _otherChild = string.Empty;
@@ -147,7 +152,7 @@ namespace VEPROMS.CSLA.Library
// B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database // B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database
private frmRofstLoadStatus _frmRofstLoadStatus = null; private frmRofstLoadStatus _frmRofstLoadStatus = null;
private Dictionary<int, int> _dicRoCounts = null; private Dictionary<int, int> _dicRoCounts = null;
private bool _showLoadingStatus = true; private readonly bool _showLoadingStatus = true;
private int _curRoCnt = 0; private int _curRoCnt = 0;
private int _dbRoCnt = 0; private int _dbRoCnt = 0;
@@ -412,7 +417,6 @@ namespace VEPROMS.CSLA.Library
ROFSTLookup.rochild rc = RofstDataGetChildByAccPageID(_rofstID, accPageBase); ROFSTLookup.rochild rc = RofstDataGetChildByAccPageID(_rofstID, accPageBase);
//if (rc.ID >=0 && rc.roid.Length < 16 && Regex.IsMatch(accPageKey, @".*\.[A-Z]") && rc.children != null && rc.children.Count() > 0)
if (rc.ID >= 0 && rc.roid.Length < 16 && !string.IsNullOrEmpty(accPageExt) && rc.children != null && rc.children.Count() > 0) if (rc.ID >= 0 && rc.roid.Length < 16 && !string.IsNullOrEmpty(accPageExt) && rc.children != null && rc.children.Count() > 0)
{ {
// Check if AccPageID/Key has a return value specific extension. Try to find the RoChild record with the specific return value type, // Check if AccPageID/Key has a return value specific extension. Try to find the RoChild record with the specific return value type,
@@ -505,8 +509,6 @@ namespace VEPROMS.CSLA.Library
// B2023-037: Handle <=, >=, +-, -> and <- symbols. Convert to unicode for output, i.e. print and edit/view (when editing // B2023-037: Handle <=, >=, +-, -> and <- symbols. Convert to unicode for output, i.e. print and edit/view (when editing
// step, will show as 2 characters, not unicode, unless ro inserted when code replaced link text with unicode. // step, will show as 2 characters, not unicode, unless ro inserted when code replaced link text with unicode.
//(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue ||
// _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue))
bool arrows1 = myiteminfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue; bool arrows1 = myiteminfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue;
bool arrows2 = myiteminfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue; bool arrows2 = myiteminfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue;
@@ -679,13 +681,16 @@ namespace VEPROMS.CSLA.Library
if (minutes > 0) duration = string.Format("{0} min(s) ", minutes.ToString("n0")); if (minutes > 0) duration = string.Format("{0} min(s) ", minutes.ToString("n0"));
if (secs < 0) secs = 0.00; if (secs < 0) secs = 0.00;
duration = duration + string.Format("{0,10:#####0.00} sec(s)", secs).Trim(); duration += string.Format("{0,10:#####0.00} sec(s)", secs).Trim();
return duration; return duration;
//return string.Format("{0,10:#####0.00}", TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalSeconds);
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
//return new ROFstID if there is a newer ID that matches the same ROFSTDB
public int GetNewerFSTID() => RofstGetLatestID(RofstID);
#endregion #endregion
#endregion #endregion
@@ -888,7 +893,7 @@ namespace VEPROMS.CSLA.Library
} }
} }
private void RofstChildInsert(int rofstID, int id, int parentID, int dbiID, int type, string title, string roid, string appid, string value) private void RofstChildInsert(int rofstID, int id, int parentID, int dbiID, int type, string title, string roid, string appid, string value, DateTime? dt = null)
{ {
try try
{ {
@@ -917,6 +922,9 @@ namespace VEPROMS.CSLA.Library
if (!string.IsNullOrEmpty(this.RoMissingDefaultValue)) if (!string.IsNullOrEmpty(this.RoMissingDefaultValue))
cmd.Parameters.Add(new SqlParameter("@missingDefaultValue", SqlDbType.VarChar)).Value = this.RoMissingDefaultValue; cmd.Parameters.Add(new SqlParameter("@missingDefaultValue", SqlDbType.VarChar)).Value = this.RoMissingDefaultValue;
if (dt != null)
cmd.Parameters.Add(new SqlParameter("@ModDateTime", SqlDbType.DateTime)).Value = dt;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@@ -1299,6 +1307,32 @@ namespace VEPROMS.CSLA.Library
} }
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
//return new ROFstID if there is a newer ID that matches the same ROFSTDB
private int RofstGetLatestID(int rofstID)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cmd = cn.CreateCommand())
{
cmd.CommandTimeout = 0;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT ISNULL((SELECT TOP 1 ROFsts.ROFstID FROM ROFsts INNER JOIN ROFsts curFST ON curFST.RODbID = ROFsts.RODbID WHERE curFST.ROFstID = @FSTid order by ROFsts.DTS desc),-1)";
cmd.Parameters.Add(new SqlParameter("@FSTid", SqlDbType.Int)).Value = rofstID;
return (int) cmd.ExecuteScalar();
}
}
}
catch (Exception ex)
{
throw new DbCslaException("RofstData.RofstGetLatestID", ex);
}
}
#endregion #endregion
#region (Core/Base logic for RO Values & UnitInfo RO Values) #region (Core/Base logic for RO Values & UnitInfo RO Values)
@@ -1440,19 +1474,20 @@ namespace VEPROMS.CSLA.Library
private ROFSTLookup.roHdr ConvertFst2Objects(byte[] ab) private ROFSTLookup.roHdr ConvertFst2Objects(byte[] ab)
{ {
ROFSTLookup.roHdr roh = new ROFSTLookup.roHdr(); ROFSTLookup.roHdr roh = new ROFSTLookup.roHdr
{
roh.hSize = BitConverter.ToInt32(ab, 0); hSize = BitConverter.ToInt32(ab, 0),
roh.hYear = BitConverter.ToInt16(ab, 4); hYear = BitConverter.ToInt16(ab, 4),
roh.hMonth = ab[6]; hMonth = ab[6],
roh.hDay = ab[7]; hDay = ab[7],
roh.hcYear = BitConverter.ToInt16(ab, 8); hcYear = BitConverter.ToInt16(ab, 8),
roh.hcMonth = ab[10]; hcMonth = ab[10],
roh.hcDay = ab[11]; hcDay = ab[11],
roh.hcHour = ab[12]; hcHour = ab[12],
roh.hcMin = ab[13]; hcMin = ab[13],
roh.hcSec = ab[14]; hcSec = ab[14],
roh.hcHund = ab[15]; hcHund = ab[15]
};
int hdrOffset = BitConverter.ToInt32(ab, 16); int hdrOffset = BitConverter.ToInt32(ab, 16);
int dbs = BitConverter.ToInt16(ab, hdrOffset + 4); int dbs = BitConverter.ToInt16(ab, hdrOffset + 4);
@@ -1490,10 +1525,11 @@ namespace VEPROMS.CSLA.Library
private ROFSTLookup.rogrp LoadGroup(byte[] ab, int offset, int tableID) private ROFSTLookup.rogrp LoadGroup(byte[] ab, int offset, int tableID)
{ {
ROFSTLookup.rogrp myGrp = new ROFSTLookup.rogrp(); ROFSTLookup.rogrp myGrp = new ROFSTLookup.rogrp
{
myGrp.ID = BitConverter.ToInt32(ab, offset); ID = BitConverter.ToInt32(ab, offset),
myGrp.ParentID = BitConverter.ToInt32(ab, offset + 4); ParentID = BitConverter.ToInt32(ab, offset + 4)
};
int numChildren = BitConverter.ToInt16(ab, offset + 8); int numChildren = BitConverter.ToInt16(ab, offset + 8);
@@ -1523,6 +1559,10 @@ namespace VEPROMS.CSLA.Library
tmp.appid = tmpg.appid; tmp.appid = tmpg.appid;
tmp.roid = tableID.ToString("X4") + tmp.ID.ToString("X8"); tmp.roid = tableID.ToString("X4") + tmp.ID.ToString("X8");
tmp.children = tmpg.children; tmp.children = tmpg.children;
if (tmpg.ModDateTime != null)
{
tmp.ModDateTime = tmpg.ModDateTime;
}
int j; int j;
@@ -1542,6 +1582,12 @@ namespace VEPROMS.CSLA.Library
int slen2 = StringLength(ab, offset + 13 + slen); int slen2 = StringLength(ab, offset + 13 + slen);
myGrp.appid = Encoding.Default.GetString(ab, offset + 13 + slen, slen2); myGrp.appid = Encoding.Default.GetString(ab, offset + 13 + slen, slen2);
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
if (myGrp.value != "" && DateTime.TryParseExact(Encoding.Default.GetString(ab, offset + 14 + slen + slen2, 14), "yyyyMMddHHmmss", null, System.Globalization.DateTimeStyles.None, out DateTime dt))
{
myGrp.ModDateTime = dt;
}
_dbRoCnt++; _dbRoCnt++;
} }
@@ -1615,7 +1661,7 @@ namespace VEPROMS.CSLA.Library
} }
// Update Progress Bar Accordingly // Update Progress Bar Accordingly
if (_totalRoCnt > 0) _pctComplete = _pctComplete + ((Convert.ToDouble(_dbRoCnt) / Convert.ToDouble(_totalRoCnt)) * 80.0); if (_totalRoCnt > 0) _pctComplete += ((Convert.ToDouble(_dbRoCnt) / Convert.ToDouble(_totalRoCnt)) * 80.0);
OnProgressChanged(displayText, Convert.ToInt32(_pctComplete), 100); OnProgressChanged(displayText, Convert.ToInt32(_pctComplete), 100);
} }
@@ -1655,7 +1701,7 @@ namespace VEPROMS.CSLA.Library
private void LoadChild(int rofstID, int dbiID, ROFSTLookup.rochild child) private void LoadChild(int rofstID, int dbiID, ROFSTLookup.rochild child)
{ {
//Insert Rofst Child //Insert Rofst Child
RofstChildInsert(rofstID, child.ID, child.ParentID, dbiID, child.type, child.title, child.roid, child.appid, child.value); RofstChildInsert(rofstID, child.ID, child.ParentID, dbiID, child.type, child.title, child.roid, child.appid, child.value, child.ModDateTime);
//Increment RO Count if RoChild has a return value //Increment RO Count if RoChild has a return value
if (!string.IsNullOrEmpty(child.value)) _curRoCnt++; if (!string.IsNullOrEmpty(child.value)) _curRoCnt++;
@@ -1675,15 +1721,13 @@ namespace VEPROMS.CSLA.Library
protected virtual void OnProgressChanged(string title, string displayText, int curVal = 0, int maxVal = 100) protected virtual void OnProgressChanged(string title, string displayText, int curVal = 0, int maxVal = 100)
{ {
// If frmRofstLoadStatus is not null then call Update Progress Method // If frmRofstLoadStatus is not null then call Update Progress Method
if (_frmRofstLoadStatus != null) _frmRofstLoadStatus?.UpdateProgress(title, displayText, curVal, maxVal);
_frmRofstLoadStatus.UpdateProgress(title, displayText, curVal, maxVal);
} }
protected virtual void OnProgressChanged(string displayText, int curVal = 0, int maxVal = 100) protected virtual void OnProgressChanged(string displayText, int curVal = 0, int maxVal = 100)
{ {
// If frmRofstLoadStatus is not null then call Update Progress Method // If frmRofstLoadStatus is not null then call Update Progress Method
if (_frmRofstLoadStatus != null) _frmRofstLoadStatus?.UpdateProgress(_frmRofstLoadStatus.Title, displayText, curVal, maxVal);
_frmRofstLoadStatus.UpdateProgress(_frmRofstLoadStatus.Title, displayText, curVal, maxVal);
} }
#endregion #endregion
@@ -1694,19 +1738,20 @@ namespace VEPROMS.CSLA.Library
private ROFSTLookup.roHdr ConvertToRoHdrObject(SafeDataReader dr, bool loadChildren) private ROFSTLookup.roHdr ConvertToRoHdrObject(SafeDataReader dr, bool loadChildren)
{ {
ROFSTLookup.roHdr rh = new ROFSTLookup.roHdr(); ROFSTLookup.roHdr rh = new ROFSTLookup.roHdr
{
rh.hSize = (int)dr.GetValue("hSize"); hSize = (int)dr.GetValue("hSize"),
rh.hYear = (int)dr.GetValue("hYear"); hYear = (int)dr.GetValue("hYear"),
rh.hMonth = (byte)dr.GetValue("hMonth"); hMonth = (byte)dr.GetValue("hMonth"),
rh.hDay = (byte)dr.GetValue("hDay"); hDay = (byte)dr.GetValue("hDay"),
rh.hcYear = (int)dr.GetValue("hcYear"); hcYear = (int)dr.GetValue("hcYear"),
rh.hcMonth = (byte)dr.GetValue("hcMonth"); hcMonth = (byte)dr.GetValue("hcMonth"),
rh.hcDay = (byte)dr.GetValue("hcDay"); hcDay = (byte)dr.GetValue("hcDay"),
rh.hcHour = (byte)dr.GetValue("hcHour"); hcHour = (byte)dr.GetValue("hcHour"),
rh.hcMin = (byte)dr.GetValue("hcMin"); hcMin = (byte)dr.GetValue("hcMin"),
rh.hcSec = (byte)dr.GetValue("hcSec"); hcSec = (byte)dr.GetValue("hcSec"),
rh.hcHund = (byte)dr.GetValue("hcHund"); hcHund = (byte)dr.GetValue("hcHund")
};
if (loadChildren) if (loadChildren)
{ {
@@ -1718,15 +1763,16 @@ namespace VEPROMS.CSLA.Library
private ROFSTLookup.rodbi ConvertToRodbiObject(SafeDataReader dr, bool loadChildren, bool loadAllChildren) private ROFSTLookup.rodbi ConvertToRodbiObject(SafeDataReader dr, bool loadChildren, bool loadAllChildren)
{ {
ROFSTLookup.rodbi rd = new ROFSTLookup.rodbi(); ROFSTLookup.rodbi rd = new ROFSTLookup.rodbi
{
rd.dbiID = (int)dr.GetValue("dbiID"); dbiID = (int)dr.GetValue("dbiID"),
rd.dbiType = (int)dr.GetValue("dbiType"); dbiType = (int)dr.GetValue("dbiType"),
rd.dbiAW = (int)dr.GetValue("dbiAW"); dbiAW = (int)dr.GetValue("dbiAW"),
rd.dbiAP = (string)dr.GetValue("dbiAP"); dbiAP = (string)dr.GetValue("dbiAP"),
rd.dbiTitle = (string)dr.GetValue("dbiTitle"); dbiTitle = (string)dr.GetValue("dbiTitle"),
rd.ID = (int)dr.GetValue("ID"); ID = (int)dr.GetValue("ID"),
rd.ParentID = (int)dr.GetValue("ParentID"); ParentID = (int)dr.GetValue("ParentID")
};
if (loadChildren || loadAllChildren) if (loadChildren || loadAllChildren)
{ {
@@ -1738,13 +1784,14 @@ namespace VEPROMS.CSLA.Library
private ROFSTLookup.rochild ConvertToRochildObject(SafeDataReader dr, bool loadChildren, bool loadAllChildren) private ROFSTLookup.rochild ConvertToRochildObject(SafeDataReader dr, bool loadChildren, bool loadAllChildren)
{ {
ROFSTLookup.rochild rc = new ROFSTLookup.rochild(); ROFSTLookup.rochild rc = new ROFSTLookup.rochild
{
rc.ID = (int)dr.GetValue("ID"); ID = (int)dr.GetValue("ID"),
rc.ParentID = (int)dr.GetValue("ParentID"); ParentID = (int)dr.GetValue("ParentID"),
rc.type = (int)dr.GetValue("type"); type = (int)dr.GetValue("type"),
rc.title = (string)dr.GetValue("title"); title = (string)dr.GetValue("title"),
rc.roid = (string)dr.GetValue("roid"); roid = (string)dr.GetValue("roid")
};
if (!string.IsNullOrEmpty((string)dr.GetValue("appid"))) if (!string.IsNullOrEmpty((string)dr.GetValue("appid")))
{ {
@@ -1766,11 +1813,12 @@ namespace VEPROMS.CSLA.Library
private ROFSTLookup.RoExtension ConvertToRoExtensionObject(SafeDataReader dr) private ROFSTLookup.RoExtension ConvertToRoExtensionObject(SafeDataReader dr)
{ {
ROFSTLookup.RoExtension re = new ROFSTLookup.RoExtension(); ROFSTLookup.RoExtension re = new ROFSTLookup.RoExtension
{
re.Offset = (int)dr.GetValue("Offset"); Offset = (int)dr.GetValue("Offset"),
re.RoidExt = (string)dr.GetValue("RoidExt"); RoidExt = (string)dr.GetValue("RoidExt"),
re.AccPageExt = (string)dr.GetValue("AccPageExt"); AccPageExt = (string)dr.GetValue("AccPageExt")
};
return re; return re;
} }
@@ -1830,7 +1878,6 @@ namespace VEPROMS.CSLA.Library
// Instead of returning the RoChildBase object with a single RoReturnVal object attached, just return the single Ro ReturnValue object. // Instead of returning the RoChildBase object with a single RoReturnVal object attached, just return the single Ro ReturnValue object.
var roRetVal = child.children.First(); var roRetVal = child.children.First();
//child.title = roRetVal.title;
child.appid = roRetVal.appid; child.appid = roRetVal.appid;
child.roid = roRetVal.roid; child.roid = roRetVal.roid;
child.value = roRetVal.value; child.value = roRetVal.value;
@@ -2084,41 +2131,68 @@ namespace VEPROMS.CSLA.Library
return ProcessRO(match, multiRtnVal); return ProcessRO(match, multiRtnVal);
} }
private string ProcessMacros(string str)
{
// Takes the RO text value and sees if a macro has been used. // Takes the RO text value and sees if a macro has been used.
// If so it will perform the macro operation on the substring in the text value // If so it will perform the macro operation on the substring in the text value
// Note** Right now the only macro is @HSP(), where every space between the "(" and ")" will be replaced with a hard space // Note** Right now the only macro is @HSP(), where every space between the "(" and ")" will be replaced with a hard space
private static string ProcessMacros(string str)
{
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str) || str.ToUpper().IndexOf("@HSP(") < 0)
return str; return str;
string rtnstr = str;
int indx;
while ((indx = rtnstr.ToUpper().IndexOf("@HSP(")) > -1) string processingstr = str; //holds current string being processed
{ int indx; //current position of @HSP( in string
string resstr = rtnstr.Substring(0, indx); int endpos = 0; //end of last parens
int endHsp = rtnstr.IndexOf(")", indx);
//B2026 - 002 handle if parens inside a HSP StringBuilder sb = new StringBuilder();
int startpos = indx + 5; Stack<char> endparens = new Stack<char>();
while (rtnstr.Substring(startpos, endHsp - startpos).Contains("("))
while ((indx = processingstr.ToUpper().IndexOf("@HSP(")) > -1)
{ {
startpos = rtnstr.IndexOf("(", startpos + 1, endHsp - startpos) + 1; sb.Append(processingstr.Substring(0, indx)); // initial string before @HSP(
endHsp = rtnstr.IndexOf(")", endHsp + 1);
for (int i = indx + 5; i < processingstr.Length; i++)
{
char ch = processingstr[i];
if (ch == '(')
{
//if opening paren inside HSP add it to the stack to look for a closing parens
endparens.Push(ch);
}
else if (ch == ')' && endparens.Count > 0)
{
//if cloing parens and it matches an opening parens inside of HSP, remove a level
_ = endparens.Pop();
}
else if (ch == ')' && endparens.Count == 0)
{
//if closing parens and at same level as HSP, break out since found correct closing parens
endpos = i;
break;
}
else if (i == processingstr.Length - 1)
{
//if hit the end of the string and no matching closing parens found, take to the end of the string
endpos = processingstr.Length;
}
} }
string tmpstr = rtnstr.Substring(indx + 5, endHsp - indx - 5); //Add the text inside the @HSP(...)
string tmpstr = processingstr.Substring(indx + 5, endpos - indx - 5);
// B2017-012 Don't convert space to hard spaces for XY Plots. // B2017-012 Don't convert space to hard spaces for XY Plots.
if (!tmpstr.Contains("<<G")) tmpstr = tmpstr.Replace(" ", @"\u160?"); if (!tmpstr.Contains("<<G")) tmpstr = tmpstr.Replace(" ", @"\u160?");
sb.Append(tmpstr);
resstr = resstr + tmpstr; //Set the processing string to after the ending parens found in case multiple @HSP
rtnstr = resstr + rtnstr.Substring(endHsp + 1); processingstr = endpos + 1 >= processingstr.Length ? "" : processingstr.Substring(endpos + 1);
} }
return rtnstr; //add text after last end parens
sb.Append(processingstr);
return sb.ToString();
} }
private int StringLength(byte[] ab, int offset) private int StringLength(byte[] ab, int offset)
@@ -2230,7 +2304,7 @@ namespace VEPROMS.CSLA.Library
{ {
rc.roid = FormatRoidKey(roid).Substring(0, 12); rc.roid = FormatRoidKey(roid).Substring(0, 12);
DocVersionConfig dvc = (_myDocVersionInfo != null) ? _myDocVersionInfo.DocVersionConfig : null; DocVersionConfig dvc = _myDocVersionInfo?.DocVersionConfig;
if (dvc != null) dvc.SelectedSlave = this.SelectedSlave; if (dvc != null) dvc.SelectedSlave = this.SelectedSlave;
switch (rc.roid) switch (rc.roid)
@@ -2238,49 +2312,49 @@ namespace VEPROMS.CSLA.Library
case "FFFF00000001": case "FFFF00000001":
rc.title = "Number"; rc.title = "Number";
rc.appid = "U-NUMBER"; rc.appid = "U-NUMBER";
rc.value = (dvc != null) ? dvc.Unit_Number : null; rc.value = dvc?.Unit_Number;
break; break;
case "FFFF00000002": case "FFFF00000002":
rc.title = "Other Number"; rc.title = "Other Number";
rc.appid = "U-OTHERNUMBER"; rc.appid = "U-OTHERNUMBER";
rc.value = (dvc != null) ? dvc.Other_Unit_Number : null; rc.value = dvc?.Other_Unit_Number;
break; break;
case "FFFF00000003": case "FFFF00000003":
rc.title = "Text"; rc.title = "Text";
rc.appid = "U-TEXT"; rc.appid = "U-TEXT";
rc.value = (dvc != null) ? dvc.Unit_Text : null; rc.value = dvc?.Unit_Text;
break; break;
case "FFFF00000004": case "FFFF00000004":
rc.title = "Other Text"; rc.title = "Other Text";
rc.appid = "U-OTHERTEXT"; rc.appid = "U-OTHERTEXT";
rc.value = (dvc != null) ? dvc.Other_Unit_Text : null; rc.value = dvc?.Other_Unit_Text;
break; break;
case "FFFF00000005": case "FFFF00000005":
rc.title = "ID"; rc.title = "ID";
rc.appid = "U-ID"; rc.appid = "U-ID";
rc.value = (dvc != null) ? dvc.Unit_ID : null; rc.value = dvc?.Unit_ID;
break; break;
case "FFFF00000006": case "FFFF00000006":
rc.title = "Other ID"; rc.title = "Other ID";
rc.appid = "U-OTHERID"; rc.appid = "U-OTHERID";
rc.value = (dvc != null) ? dvc.Other_Unit_ID : null; rc.value = dvc?.Other_Unit_ID;
break; break;
case "FFFF00000007": case "FFFF00000007":
rc.title = "Name"; rc.title = "Name";
rc.appid = "U-NAME"; rc.appid = "U-NAME";
rc.value = (dvc != null) ? dvc.Unit_Name : null; rc.value = dvc?.Unit_Name;
break; break;
case "FFFF00000008": case "FFFF00000008":
rc.title = "Other Name"; rc.title = "Other Name";
rc.appid = "U-OTHERNAME"; rc.appid = "U-OTHERNAME";
rc.value = (dvc != null) ? dvc.Other_Unit_Name : null; rc.value = dvc?.Other_Unit_Name;
break; break;
} }
@@ -90,7 +90,7 @@ namespace VEPROMS.CSLA.Library
{ {
string itemTitle = Regex.Replace(this.Path, "^..+?\\u0007", ""); string itemTitle = Regex.Replace(this.Path, "^..+?\\u0007", "");
itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-").Replace(@"\u9586?",@"\"); itemTitle = itemTitle.Replace("\x11", itemTitle[0] == '\x11' ? "" : " - ").Replace("\\u8209?", "-").Replace(@"\u9586?",@"\");
return string.Format("{4} item {0} by {1} on {2} @ {3}", this.ActionWhat, this.UserID, this.ActionWhen == DateTime.MinValue ? this.DTS.ToShortDateString() : this.ActionWhen.ToShortDateString(), this.ActionWhen == DateTime.MinValue ? this.DTS.ToShortTimeString() : this.ActionWhen.ToShortTimeString(), itemTitle); return string.Format("{4} item {0} by {1} on {2} @ {3}", this.ActionWhat, this.UserID, this.ActionWhen == DateTime.MinValue ? this.DTS.ToShortDateString() : this.ActionWhen.ToShortDateString(), this.ActionWhen == DateTime.MinValue ? this.DTS.ToString("HH:mm:ss") : this.ActionWhen.ToString("HH:mm:ss"), itemTitle);
//return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss")); //return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
//return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted"); //return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
} }
@@ -177,7 +177,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
return string.Format("{0}{1} deleted by {2} on {3} @ {4}", this.Level == 0 ? "Previous " : this.Level == 1 ? "Next " : "", this.ItemType, this.UserID, this.DTS.ToShortDateString(), this.DTS.ToShortTimeString()); return string.Format("{0}{1} deleted by {2} on {3}", this.Level == 0 ? "Previous " : this.Level == 1 ? "Next " : "", this.ItemType, this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
// return string.Format("Deleted by {0} on {1} @ {2}", this.UserID, this.DTS.ToShortDateString(), this.DTS.ToShortTimeString()); // return string.Format("Deleted by {0} on {1} @ {2}", this.UserID, this.DTS.ToShortDateString(), this.DTS.ToShortTimeString());
// return string.Format("(ItemID: {4}, DeleteID: {5}, {0} by {1} on {2} Level: {3}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"), Level.ToString(), this.ItemID.ToString(), this.DeleteStatus.ToString()); // return string.Format("(ItemID: {4}, DeleteID: {5}, {0} by {1} on {2} Level: {3}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"), Level.ToString(), this.ItemID.ToString(), this.DeleteStatus.ToString());
// return string.Format("Level: {3}, {0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted", this.Level.ToString()); // return string.Format("Level: {3}, {0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted", this.Level.ToString());
@@ -2163,9 +2163,13 @@ namespace VEPROMS.CSLA.Library
// move past that text and try the Word Find function again. // move past that text and try the Word Find function again.
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections // B2022-088: [JPR] Find Doc Ro button not working in Word Sections
// B2022-098: [JPR] ROs not being resolved in Word Sections // B2022-098: [JPR] ROs not being resolved in Word Sections
// B2026-070: When there is a less-then sign (<) followed by a numeric value in a Word attachment (inside of a table), PROMS thinks the user put in an RO token will generate an RO not found error in the following table row who's text contains <U-Name>.
if (executeResult && !string.IsNullOrEmpty(sel.Text) && !sel.Text.StartsWith("<") && !sel.Text.EndsWith(">")) if (executeResult && !string.IsNullOrEmpty(sel.Text) && !sel.Text.StartsWith("<") && !sel.Text.EndsWith(">"))
{ {
sel.MoveStart(LBWdUnits.wdCharacter, sel.Text.Length - 1); int location = sel.Start + sel.Text.Length - 1; //do not do this inline - this needs captured before WholeStory
sel.WholeStory();
sel.MoveStart(LBWdUnits.wdCharacter, location);
tryagain = true; tryagain = true;
} }
} while (tryagain); } while (tryagain);
@@ -1093,6 +1093,15 @@ namespace VEPROMS.CSLA.Library
} }
} }
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
//Refresh at item level
public static void RefreshReferenceObjects(ItemInfo tmp, ROFstInfo origROFst)
{
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshReferenceObjects(tmp, null, tmp.GetSectionInfo(), tmp.MyDocVersion, origROFst);
}
// B2022-026 RO Memory Reduction code - pass in ROFstInfo // B2022-026 RO Memory Reduction code - pass in ROFstInfo
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, ROFstInfo origROFst) internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, ROFstInfo origROFst)
{ {
@@ -1219,6 +1228,22 @@ namespace VEPROMS.CSLA.Library
return true; return true;
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
public static List<ItemInfo> GetItemInfoWithChangedROs(int docversionid, int origfstid, int newfstid)
{
List<ItemInfo> lst = new List<ItemInfo>();
foreach (DataRow r in Data_GetItemsWithChangedROs(docversionid, origfstid, newfstid).Rows)
{
using (ItemInfo itm = Get((int)r["ItemID"]))
{
lst.Add(itm);
}
}
return lst;
}
#region Debug Code #region Debug Code
//private static void ShowDifference(string oldText, string newText) //private static void ShowDifference(string oldText, string newText)
@@ -1890,6 +1915,40 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo itemInfo in partInfo.MyItems) foreach (ItemInfo itemInfo in partInfo.MyItems)
itemInfo.SpinThroughChildren(); itemInfo.SpinThroughChildren();
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
private static DataTable Data_GetItemsWithChangedROs(int docversionid, int origfstid, int newfstid)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getItemsWithNewROs";
cm.Parameters.AddWithValue("@VersionID", docversionid);
cm.Parameters.AddWithValue("@OrigFSTid", origfstid);
cm.Parameters.AddWithValue("@NewFSTid", newfstid);
cm.CommandTimeout = Database.DefaultTimeout;
using (SqlDataAdapter da = new SqlDataAdapter(cm))
{
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}
}
}
catch (Exception ex)
{
Database.LogException("ItemInfoList.Data_GetItemsWithChangedROs", ex);
throw new DbCslaException("ItemInfoList.Data_GetItemsWithChangedROs", ex);
}
}
#endregion #endregion
#region LoadAtOnce #region LoadAtOnce
// Method to Get Item and children // Method to Get Item and children
@@ -4054,6 +4113,9 @@ namespace VEPROMS.CSLA.Library
// date). Print_ViewableAfterChangeBarDate was created to get only that user specified date, if it exists. If it does exist, we compare // date). Print_ViewableAfterChangeBarDate was created to get only that user specified date, if it exists. If it does exist, we compare
// that with the Content datetime, otherwise we proceed as before. // that with the Content datetime, otherwise we proceed as before.
DateTime? viewableStartingDateTime = (MyProcedure.MyConfig as ProcedureConfig).Print_ViewableStartingChangeBarDate; DateTime? viewableStartingDateTime = (MyProcedure.MyConfig as ProcedureConfig).Print_ViewableStartingChangeBarDate;
// B2026-060 & B2026-061 removed the check of SelectedSlave (aka the selected child) from the IF statement,
// This was causing some step to print with change bars when there should not have been - because of the use of
// the Show Change Bars After date. The logic we need is built into the get of ChangeBarDate and Print_ViewableStartingChangeBarDate.
if (viewableStartingDateTime != null && viewableStartingDateTime > MyProcedure.ChangeBarDate) if (viewableStartingDateTime != null && viewableStartingDateTime > MyProcedure.ChangeBarDate)
return (MyContent.DTS > viewableStartingDateTime); return (MyContent.DTS > viewableStartingDateTime);
return (MyContent.DTS > MyProcedure.ChangeBarDate); return (MyContent.DTS > MyProcedure.ChangeBarDate);
@@ -6215,6 +6277,11 @@ namespace VEPROMS.CSLA.Library
if (!SectionHasCheckOffs()) return null; if (!SectionHasCheckOffs()) return null;
int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined
if (stpCoIndx == -1) return null; if (stpCoIndx == -1) return null;
//B2026-040 - Signoff/Checkoffs not printing unless set to Section Default
if (stpCoIndx > 1)
{
return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; // DO override of CheckOffList[]
}
int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default. int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default.
if (sectCoIndx == -1) return null; if (sectCoIndx == -1) return null;
@@ -8059,6 +8126,10 @@ namespace VEPROMS.CSLA.Library
} }
set { _ChangeBarDate = value; } set { _ChangeBarDate = value; }
} }
//C2026-021 Expand Functionality of Viewing Mode
public void ResetChangeBar() => _ChangeBarDate = null;
public Dictionary<int, ItemInfo> MyLookup = null; public Dictionary<int, ItemInfo> MyLookup = null;
public override void SetupTags() public override void SetupTags()
{ {
+12 -22
View File
@@ -61,35 +61,25 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Pdf.DataPortal_Delete", ex); throw new DbCslaException("Pdf.DataPortal_Delete", ex);
} }
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
// used to remove word section PDFs to force ROs to be updated when printed or saved // used to remove word section PDFs to force ROs to be updated when printed or saved
public static void DeleteAllDocVersion(int versionID) public static void DeleteDocVersionPDFsWithNewROs(int versionID, int origfstid, int newfstid)
{ {
if (!CanDeleteObject()) if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Pdf"); throw new System.Security.SecurityException("User not authorized to remove a Pdf");
try try
{ {
DataPortal.Delete(new VersionIDCriteria(versionID)); DeleteWithNewROs(versionID, origfstid, newfstid);
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new DbCslaException("Error on Pdf.DeleteAllDocVersion", ex); throw new DbCslaException("Error on Pdf.DeleteAllDocVersion", ex);
} }
} }
[Serializable()]
protected class VersionIDCriteria static private void DeleteWithNewROs(int docversionID, int origfstid, int newfstid)
{ {
private int _VersionID;
public int VersionID
{ get { return _VersionID; } }
public VersionIDCriteria(int versionID)
{
_VersionID = versionID;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(VersionIDCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Pdf.DataPortal_Delete", GetHashCode());
try try
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -98,20 +88,20 @@ namespace VEPROMS.CSLA.Library
{ {
cm.CommandType = CommandType.StoredProcedure; cm.CommandType = CommandType.StoredProcedure;
cm.CommandTimeout = Database.SQLTimeout; cm.CommandTimeout = Database.SQLTimeout;
cm.CommandText = "deleteAllDocVersionPdfs"; cm.CommandText = "deleteDocVersionPdfsWithNewROs";
cm.Parameters.AddWithValue("@VersionID", criteria.VersionID); cm.Parameters.AddWithValue("@VersionID", docversionID);
cm.Parameters.AddWithValue("@OrigFSTid", origfstid);
cm.Parameters.AddWithValue("@NewFSTid", newfstid);
cm.ExecuteNonQuery(); cm.ExecuteNonQuery();
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
if (_MyLog.IsErrorEnabled) _MyLog.Error("Pdf.DataPortal_Delete", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("Pdf.DeleteWithNewROs", ex);
_ErrorMessage = ex.Message; throw new DbCslaException("Pdf.DeleteWithNewROs", ex);
throw new DbCslaException("Pdf.DataPortal_Delete", ex);
} }
} }
} }
public partial class PdfInfo public partial class PdfInfo
{ {
+57 -221
View File
@@ -225,38 +225,61 @@ namespace VEPROMS.CSLA.Library
} }
} }
// B2022-026 RO Memory Reduction code - pass in the ROFstInfo //C2026-008 Re-Architect RO.FST to include RO Modification date/time
public static int RefreshROFst(DocVersionInfo dvi, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus, ROFstInfo origROFst) // Refresh at item level
public static int RefreshROFstAtItemLevel(DocVersionInfo dvi, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus, ROFstInfo localROFst, int origfstid, int newfstid)
{ {
int fixedROs = 0; int fixedROs = 0;
if (dvi.DocVersionConfig.SelectedSlave <= 0) if (dvi.DocVersionConfig.SelectedSlave <= 0)
{ {
myProgressBarRefresh(1, 100, "Update MS Word ROs"); // remove word section PDFs to force update of RO values when printed
myProgressBarRefresh(1, 100, "Updating MS Word ROs In Progress");
Pdf.DeleteDocVersionPDFsWithNewROs(dvi.VersionID, origfstid, newfstid);
Pdf.DeleteAllDocVersion(dvi.VersionID); // remove word section PDFs to force update of RO values when printed //Loop Through ROs in this docversion that are different than the previous fst
myProgressBarRefresh(50, 100, "Updating ROs In PROMS Steps In Progress");
int i = 0; int i = 0;
List<ItemInfo> list = ItemInfo.GetItemInfoWithChangedROs(dvi.VersionID, origfstid, newfstid);
foreach (ProcedureInfo proc in dvi.Procedures) foreach (ItemInfo itm in list)
{ {
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
ProcedureInfo.ResetROCounters(); ItemInfo.ResetROCounters();
myProgressBarRefresh(++i, dvi.Procedures.Count, string.Format("{0} ({1}/{2} ROs {3})", proc.DisplayNumber, i, dvi.Procedures.Count, fixedROs)); myProgressBarRefresh(++i, list.Count, string.Format("{0} ({1}/{2} ROs {3})", itm.MyProcedure.DisplayNumber, i, list.Count, fixedROs));
ProcedureInfo.RefreshReferenceObjects(proc, origROFst); ItemInfo.RefreshReferenceObjects(itm, localROFst);
fixedROs += ProcedureInfo.ROFixCount; fixedROs += ItemInfo.ROFixCount;
TimeSpan ts = DateTime.Now - start; TimeSpan ts = DateTime.Now - start;
if (tbStatus != null) if (tbStatus != null)
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects{0}, Fixed {3} Referenced Objects{0}, Elapsed Seconds:{4}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.ROCheckCount, ProcedureInfo.ROFixCount, ts.TotalSeconds)); tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects{0}, Fixed {3} Referenced Objects{0}, Elapsed Seconds:{4}{0}{0}", Environment.NewLine, itm.MyProcedure.DisplayNumber, ItemInfo.ROCheckCount, ItemInfo.ROFixCount, ts.TotalSeconds));
}
//Update the DocVersion Associations to link to the new RO FST id and current date/time
using (DocVersion dv = DocVersion.Get(dvi.VersionID))
{
if (dvi.DocVersionAssociations[0].MyROFst.ROFstID != newfstid)
{
dv.DocVersionAssociations[0].MyROFst = localROFst.GetJustROFst();
}
// B2026-066 moved this out of if statement above
// - was not resetting the datetime and thus not disabling the Update RO Values button and menu item
SetAssociationLastCompleted(dv, DateTime.Now.ToString());
} }
} }
// pop up a message window telling the user the RO Update has completed and how many ROs were updated
// If we are updating RO from the Admin Tools (from the V button) and we are updating more than on procedure set, then just append the "RO Update Complete" text
// To the MessageList. Once completed will all procedure sets, Admin Tools will display one message box with all the results in it.
if (MessageList == null)
FlexibleMessageBox.Show(fixedROs == 0 ? "No ROs Required Updating" : string.Format("{0} ROs Updated for {1}", fixedROs, dvi.MyFolder.Name), "RO Update Complete");
else
MessageList.AppendLine((fixedROs == 0 ? "No ROs Required Updating for " : string.Format("{0} ROs Updated for ", fixedROs)) + dvi.MyFolder.Name);
return fixedROs; return fixedROs;
} }
//C2022-028 for Admin tool to check for bad RO links //C2022-028 for Admin tool to check for bad RO links
//B2022-144 we now loop through checked procedures list from Admin Tools and call this method for each procedure we want to process //B2022-144 we now loop through checked procedures list from Admin Tools and call this method for each procedure we want to process
public static int CheckROLinksInThisProcedure(ProcedureInfo proc, System.Windows.Forms.TextBox tbStatus) public static int CheckROLinksInThisProcedure(ProcedureInfo proc, System.Windows.Forms.TextBox tbStatus)
@@ -291,34 +314,6 @@ namespace VEPROMS.CSLA.Library
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\ROUpdateReport_" + ValidFileName.FixFileName(dvi.MyFolder.Name.Replace(" ", "_") + "_" + DateTime.Now.ToString("MM-dd-yyyy_HH-mm-ss") + ".txt"); return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\ROUpdateReport_" + ValidFileName.FixFileName(dvi.MyFolder.Name.Replace(" ", "_") + "_" + DateTime.Now.ToString("MM-dd-yyyy_HH-mm-ss") + ".txt");
} }
// B2022-026 RO Memory Reduction code - moved the call to UpdateROFst() to before we call RefreshROFst
// so that we used the correct ROFstInfo which as the needed event methods set when updated RO Table types
public static ROFst RefreshROFst(DocVersion docver, ROFstInfo origROFst, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus)
{
ROFst rofst = null;
rofst = docver.DocVersionAssociations[0].MyROFst;
DocVersionInfo dvi = DocVersionInfo.Get(docver.VersionID);
SetAssociationLastCompleted(docver, string.Empty);
int fixedROs = RefreshROFst(dvi, myProgressBarRefresh, tbStatus, origROFst);
SetAssociationLastCompleted(docver, DateTime.Now.ToString()); // RO Update completed successfully and un-interrupted, save the date/time to the Doc Version Association config
myProgressBarRefresh(100, 100, "RO Update Complete"); // update the progress bar
System.Windows.Forms.Application.DoEvents();
// pop up a message window telling the user the RO Update has completed and how many ROs were updated
// If we are updating RO from the Admin Tools (from the V button) and we are updating more than on procedure set, then just append the "RO Update Complete" text
// To the MessageList. Once completed will all procedure sets, Admin Tools will display one message box with all the results in it.
if (MessageList == null)
FlexibleMessageBox.Show(fixedROs == 0 ? "No ROs Required Updating" : string.Format("{0} ROs Updated for {1}", fixedROs, dvi.MyFolder.Name), "RO Update Complete");
else
MessageList.AppendLine((fixedROs == 0 ? "No ROs Required Updating for " : string.Format("{0} ROs Updated for ", fixedROs)) + dvi.MyFolder.Name);
return rofst;
}
/// <summary> /// <summary>
/// Updates an ro.fst into a sql database. /// Updates an ro.fst into a sql database.
/// </summary> /// </summary>
@@ -333,8 +328,12 @@ namespace VEPROMS.CSLA.Library
// all of the calls aways set the flags to not update the RO values // all of the calls aways set the flags to not update the RO values
public static ROFst UpdateRoFst(RODbInfo rdi, DocVersion docver, ROFstInfo origROFst, ROFstInfoProgressBarRefresh myProgressBarRefresh) public static ROFst UpdateRoFst(RODbInfo rdi, DocVersion docver, ROFstInfo origROFst, ROFstInfoProgressBarRefresh myProgressBarRefresh)
{ {
ROWorkingDraftAsk.ClearWorkingDrafts();
if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update"); if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update");
int origFSTid = origROFst.ROFstID;
DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); DirectoryInfo di = new DirectoryInfo(rdi.FolderPath);
string rofstfilepath = rdi.FolderPath + @"\ro.fst"; string rofstfilepath = rdi.FolderPath + @"\ro.fst";
FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
@@ -361,6 +360,7 @@ namespace VEPROMS.CSLA.Library
docver.DocVersionAssociations[0].MyROFst = rofst; docver.DocVersionAssociations[0].MyROFst = rofst;
SetAssociationLastCompleted(docver, string.Empty); SetAssociationLastCompleted(docver, string.Empty);
SetPrevFSTID(docver, origFSTid); // //C2026-008 Re-Architect RO.FST to include RO Modification date/time
return rofst; return rofst;
} }
@@ -384,6 +384,9 @@ namespace VEPROMS.CSLA.Library
// Keep a list of ROIDs for Images that have changed. // Keep a list of ROIDs for Images that have changed.
List<string> MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, rodb, myLookup, docver); List<string> MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, rodb, myLookup, docver);
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
SetPrevFSTID(docver, origFSTid);
return rofst; return rofst;
} }
} }
@@ -484,6 +487,20 @@ namespace VEPROMS.CSLA.Library
docver.Save(); docver.Save();
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
// Place the previous ROFSTID in the config in case network error or computer crashes while updating RO Values
private static void SetPrevFSTID(DocVersion docver, int value)
{
if (docver.DocVersionAssociations[0]?.MyROFst != null && value != -1)
{
string cfg = docver.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
ac.ROUpdate_PrevROFSTID = value.ToString();
docver.DocVersionAssociations[0].Config = ac.ToString();
docver.Save();
}
}
// Place the status of loading the RO Figures when updating RO Values // Place the status of loading the RO Figures when updating RO Values
private static void SetAssociationROFiguresLoading(DocVersion docver, string value) private static void SetAssociationROFiguresLoading(DocVersion docver, string value)
{ {
@@ -670,187 +687,6 @@ namespace VEPROMS.CSLA.Library
return sb.ToString(); return sb.ToString();
} }
private static void UpdateROValuesText(ROFstInfo origROFstInfo, ROFst newROFst, DocVersionInfo dvi, ROFstInfoProgressBarRefresh myProgressBarRefresh, List<string> MyChangedFigureROIDs)
{
if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Update Ro Values");
string versionList = dvi.VersionID.ToString();
ROFSTLookup origLookup = new ROFSTLookup(origROFstInfo.ROFstID, dvi);
ROFSTLookup newLookup = new ROFSTLookup(newROFst.ROFstID, dvi);
List<string> delList = new List<string>();
List<string> chgList = newLookup.GetValueDifferences(origROFstInfo.ROFstID, ref delList);
// Any figures which have been changed will be included in the list of values that have changed.
if (MyChangedFigureROIDs != null)
{
foreach (string roid in MyChangedFigureROIDs)
{
if (!chgList.Contains(roid)) chgList.Add(roid);
}
}
string RoidList = GetRoidList(newROFst.RODbID, chgList);
if (myProgressBarRefresh != null) myProgressBarRefresh(0, chgList.Count, "Getting List of ROs Used");
List<string> activeRoids = BuildActiveROIDsForRoUsages12(RoidList, versionList);
if (myProgressBarRefresh != null) myProgressBarRefresh(0, chgList.Count, "Updating RO Values");
int iCount = 0;
if (activeRoids.Count > 0)
{
foreach (string chg in chgList)
{
if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Updating RO Values");
if (activeRoids.Contains(chg.Substring(0, 12)))
{
ROFSTLookup.rochild roch = newLookup.GetRoChild(chg);
string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLookup.GetRoChild(chg).value, roch.value);
// roid's are stored in database as 16 characters long in the RoUsages table. They may be stored as 12 characters in the ro.fst.
// string padroid = chg.Length <= 12 ? chg + "0000" : chg;
// B2022-088: Find Doc Ro button not working in Word Sections
string padroid = ROFSTLookup.FormatRoidKey(chg, true);
using (RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed", versionList))
{
foreach (RoUsageInfo roUsg in affected)
{
using (Content content = Content.Get(roUsg.MyContent.ContentID))
{
foreach (ItemInfo ii in roUsg.MyContent.ContentItems)
{
string val = newLookup.GetTranslatedRoValue(padroid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, ii.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false, ii);
content.FixContentText(roUsg, val, roch.type, origROFstInfo, true);
if (content.IsDirty)
{
// Update UserID and DTS when RO Value is updated.
content.UserID = Volian.Base.Library.VlnSettings.UserID;
content.DTS = DateTime.Now;
content.Save();
if (content.MyGrid != null)
{
GridInfo.Refresh(content.MyGrid);
}
}
}
}
}
}
}
}
}
if (myProgressBarRefresh != null) myProgressBarRefresh(0, chgList.Count, "Getting List of ROs Used");
List<string> activeDRoids = BuildActiveROIDsForDRoUsages12(RoidList, versionList);
iCount = 0;
if (activeDRoids.Count > 0)
{
foreach (string chg in chgList)
{
// B2022-088: Find Doc Ro button not working in Word Sections
// string padroid = chg.Length <= 12 ? chg + "0000" : chg;
string padroid = ROFSTLookup.FormatRoidKey(chg, true);
if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Updating RO Values");
if (activeDRoids.Contains(chg.Substring(0, 12)))
{
ROFSTLookup.rochild roch = newLookup.GetRoChild(chg);
string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLookup.GetRoChild(chg).value, roch.value);
// roid's are stored in database as 16 characters long in the rousages table. They may be stored as 12 characters in the ro.fst.
using (DROUsageInfoList affected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed", versionList))
{
foreach (DROUsageInfo droUsg in affected)
{
Pdf.DeleteAll(droUsg.DocID);
}
}
}
}
}
iCount = 0;
string RoidDelList = GetRoidList(newROFst.RODbID, delList);
if (myProgressBarRefresh != null) myProgressBarRefresh(0, chgList.Count, "Getting List of ROs Used");
activeRoids = BuildActiveROIDsForRoUsages12(RoidDelList, versionList);
if (activeRoids.Count > 0)
{
foreach (string del in delList)
{
// B2022-088: Find Doc Ro button not working in Word Sections
//string padroiddel = del.Length <= 12 ? del + "0000" : del;
string padroiddel = ROFSTLookup.FormatRoidKey(del, true);
if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Removing Old RO Values");
string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoChild(del).value);
if (activeRoids.Contains(del.Substring(0, 12).ToUpper()))
{
using (RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroiddel, desc, "Deleted", versionList))
{
foreach (RoUsageInfo roUsg in affected)
{
using (Content content = Content.Get(roUsg.MyContent.ContentID))
{
content.FixContentText(roUsg, "?", 0, origROFstInfo);
if (content.IsDirty)
{
// Update UserID and DTS when RO Value is updated.
content.UserID = Volian.Base.Library.VlnSettings.UserID;
content.DTS = DateTime.Now;
content.Save();
}
}
}
}
}
}
}
if (myProgressBarRefresh != null) myProgressBarRefresh(0, chgList.Count, "Getting List of ROs Used");
activeDRoids = BuildActiveROIDsForDRoUsages12(RoidDelList, versionList);
iCount = 0;
if (activeDRoids.Count > 0)
{
foreach (string del in delList)
{
// B2022-088: Find Doc Ro button not working in Word Sections
string padroiddel = ROFSTLookup.FormatRoidKey(del, true);
if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Removing Old RO Values");
string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoChild(del).value);
// If there's an issue then maybe try getting the RoChild with the Padded roid instead
//string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoChild(padroiddel).value);
if (activeDRoids.Contains(del.Substring(0, 12).ToUpper()))
{
using (DROUsageInfoList Daffected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroiddel, desc, "Deleted", versionList))
{
foreach (DROUsageInfo droUsg in Daffected)
{
if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Removing Old RO Values");
Pdf.DeleteAll(droUsg.DocID);
}
}
}
}
}
if (myProgressBarRefresh != null) myProgressBarRefresh(100, 100, "RO Values Updated");
}
private static DateTime ShowDuration(DateTime dtLast, string message) private static DateTime ShowDuration(DateTime dtLast, string message)
{ {
DateTime dtNext = DateTime.Now; DateTime dtNext = DateTime.Now;
@@ -0,0 +1,18 @@

using System.Collections.Generic;
namespace VEPROMS.CSLA.Library
{
public static class ROWorkingDraftAsk
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<int> WorkingDrafts = new List<int>();
public static void AddWorkingDrafts(int wd) => WorkingDrafts.Add(wd);
public static void ClearWorkingDrafts() => WorkingDrafts.Clear();
public static bool ContainsWorkingDraft(int wd) => WorkingDrafts.Contains(wd);
}
}
@@ -396,6 +396,7 @@
<Compile Include="Minimal\UserReports.cs" /> <Compile Include="Minimal\UserReports.cs" />
<Compile Include="Minimal\UserSettings.cs" /> <Compile Include="Minimal\UserSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Session\ROWorkingDraftAsk.cs" />
<Compile Include="VEObjects\VEDrillDown.cs" /> <Compile Include="VEObjects\VEDrillDown.cs" />
<Compile Include="VEObjects\VETreeNode.cs" /> <Compile Include="VEObjects\VETreeNode.cs" />
</ItemGroup> </ItemGroup>
+11 -132
View File
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing; using System.Drawing;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
using iTextSharp.text.factories;
using Microsoft.Win32;
using Volian.Base.Library; using Volian.Base.Library;
namespace VG namespace VG
@@ -25,22 +20,11 @@ namespace VG
} }
public partial class VGOut_Graphics: IVGOutput public partial class VGOut_Graphics: IVGOutput
{ {
private int _DebugStatus = 0; public int DebugStatus { get; set; } = 0;
public int DebugStatus private readonly Graphics _VGOutput;
{ public VGOut_Graphics(Graphics vgOutput) => _VGOutput = vgOutput;
get { return _DebugStatus; } public float Scale => 1;
set { _DebugStatus = value; } public void DrawLine(Pen pn, float startx, float starty, float endx, float endy) => _VGOutput.DrawLine(pn, startx, starty, endx, endy);
}
private Graphics _VGOutput;
//public Graphics VGOutput
//{ get { return _VGOutput; } }
public VGOut_Graphics(Graphics vgOutput)
{ _VGOutput = vgOutput; }
public float Scale
{ get { return 1; } }
//{ get { return _VGOutput.Transform.Elements[0]; } }
public void DrawLine(Pen pn, float startx, float starty, float endx, float endy)
{ _VGOutput.DrawLine(pn, startx, starty, endx, endy); }
public void DrawRectangle(Pen pn, RectangleF rectf) public void DrawRectangle(Pen pn, RectangleF rectf)
{ {
_VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; _VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
@@ -48,118 +32,13 @@ namespace VG
_VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; _VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
_VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height); _VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height);
} }
public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy) public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy) => _VGOutput.DrawEllipse(pn, cx, cy, dx, dy);
{ _VGOutput.DrawEllipse(pn, cx, cy, dx, dy); } public void DrawImage(Bitmap bm, RectangleF rectf) => _VGOutput.DrawImage(bm, rectf);
public void DrawImage(Bitmap bm, RectangleF rectf) public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf) => _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic);
{ _VGOutput.DrawImage(bm, rectf); } public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle) => _VGOutput.DrawArc(pn, rectf, startAngle, sweepAngle);
public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf) public SizeF MeasureString(string text, Font myFont) => _VGOutput.MeasureString(text, myFont, new PointF(0, 0), StringFormat.GenericTypographic);
{ _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic); }
public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle)
{ _VGOutput.DrawArc(pn, rectf, startAngle, sweepAngle); }
public SizeF MeasureString(string text, Font myFont)
{ return _VGOutput.MeasureString(text, myFont, new PointF(0, 0), StringFormat.GenericTypographic); }
public void Save(string fileName) public void Save(string fileName)
{ ;/* Don't do anything*/ } { ;/* Don't do anything*/ }
public float FontSizeAdjust public float FontSizeAdjust => .71f * 96f / _VGOutput.DpiX; // Changed to adjust for Screen DPI Setting
{ get { return .71f * 96f / _VGOutput.DpiX; } } // Changed to adjust for Screen DPI Setting
}
public partial class VGOut_ITextSharp : IVGOutput
{
private int _DebugStatus = 0;
public int DebugStatus
{
get { return _DebugStatus; }
set { _DebugStatus = value; }
}
private PdfContentByte _VGOutput;
//public Graphics VGOutput
//{ get { return _VGOutput; } }
public VGOut_ITextSharp(PdfContentByte vgOutput)
{ _VGOutput = vgOutput; }
public float Scale
{ get { return 1; } }
public void DrawLine(Pen pn, float startx, float starty, float endx, float endy)
{
_VGOutput.SaveState();
SetStrokeData(pn);
_VGOutput.MoveTo(startx, ScaleY(starty));
_VGOutput.LineTo(endx, ScaleY(endy));
_VGOutput.Stroke();
_VGOutput.RestoreState();
}
private void SetStrokeData(Pen pn)
{
_VGOutput.SetLineWidth(pn.Width);
_VGOutput.SetColorStroke(new iTextSharp.text.Color(pn.Color.R, pn.Color.G, pn.Color.B, pn.Color.A));
}
public void DrawRectangle(Pen pn, RectangleF rectf)
{
_VGOutput.SaveState();
SetStrokeData(pn);
_VGOutput.Rectangle(rectf.X, ScaleY(rectf.Y), rectf.Width, -rectf.Height);
_VGOutput.Stroke();
_VGOutput.RestoreState();
}
public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy)
{
_VGOutput.SaveState();
SetStrokeData(pn);
_VGOutput.Ellipse(cx, ScaleY(cy), dx, -dy);
_VGOutput.Stroke();
_VGOutput.RestoreState();
}
public void DrawImage(Bitmap bm, RectangleF rectf)
{
_VGOutput.SaveState();
// TODO: Determine how I can create an iTextSharp.text.Image
//_VGOutput.AddImage(new iTextSharp.text.Image(
_VGOutput.RestoreState();
}
public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf)
{
_VGOutput.SaveState();
_VGOutput.BeginText();
iTextSharp.text.Font itFont = GetFont(myFont.Name);
iTextSharp.text.pdf.BaseFont baseFont = itFont.BaseFont;
// _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic);
_VGOutput.MoveText(rectf.X, ScaleY(rectf.Y) - myFont.SizeInPoints);
_VGOutput.SetFontAndSize(baseFont, myFont.SizeInPoints);
_VGOutput.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
_VGOutput.ShowTextKerned(text);
_VGOutput.EndText();
_VGOutput.RestoreState();
}
public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle)
{
_VGOutput.SaveState();
SetStrokeData(pn);
_VGOutput.Arc(rectf.X, ScaleY(rectf.Y), rectf.X + rectf.Width, ScaleY(rectf.Y + rectf.Height), -startAngle, -sweepAngle);
_VGOutput.Stroke();
_VGOutput.RestoreState();
}
public SizeF MeasureString(string text, Font myFont)
{
iTextSharp.text.Font itFont = GetFont(myFont.Name);
iTextSharp.text.pdf.BaseFont baseFont = itFont.BaseFont;
return new SizeF(baseFont.GetWidthPoint(text,myFont.SizeInPoints)
, baseFont.GetAscentPoint(text, myFont.SizeInPoints) + baseFont.GetDescentPoint(text, myFont.SizeInPoints));
}
public void Save(string fileName)
{ ;/* Don't do anything*/ }
public float FontSizeAdjust
{ get { return 1; } } // Changed to adjust for Screen DPI Setting
public static iTextSharp.text.Font GetFont(string fontName)
{
/// <summary>
/// B2019-116 Volian.Base.Library This is a generic class for dealing with iTextSharp Fonts
/// Code moved and consolidated from Volian.Print.Library Volian PDF.Library and VG
/// </summary>
VlnItextFont.RegisterFont(fontName);
return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
}
private float ScaleY(float y)
{
return _VGOutput.PdfWriter.PageSize.Height - y;
}
} }
} }
+32 -161
View File
@@ -20,64 +20,34 @@ namespace VG
// Temporary page class to store portrait/landscape, Left Margin, Vertical offset, etc // Temporary page class to store portrait/landscape, Left Margin, Vertical offset, etc
public class Page public class Page
{ {
private bool _Portrait = true; public bool Portrait { get; set; } = true;
public bool Portrait public float LeftMargin { get; set; } = 0;
{ public float TopMargin { get; set; } = 0;
get { return _Portrait; } public float RightMargin { get; set; } = 0;
set { _Portrait = value; } public float BottomMargin { get; set; } = 0;
}
private float _LeftMargin = 0;
public float LeftMargin
{
get { return _LeftMargin; }
set { _LeftMargin = value; }
}
private float _TopMargin = 0;
public float TopMargin
{
get { return _TopMargin; }
set { _TopMargin = value; }
}
private float _RightMargin = 0;
public float RightMargin
{
get { return _RightMargin; }
set { _RightMargin = value; }
}
private float _BottomMargin = 0;
public float BottomMargin
{
get { return _BottomMargin; }
set { _BottomMargin = value; }
}
public Page(bool portrait, float leftMargin, float topMargin, float rightMargin, float bottomMargin) public Page(bool portrait, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
{ {
_Portrait = portrait; Portrait = portrait;
_LeftMargin = leftMargin; LeftMargin = leftMargin;
_TopMargin = topMargin; TopMargin = topMargin;
_RightMargin = rightMargin; RightMargin = rightMargin;
_BottomMargin = bottomMargin; BottomMargin = bottomMargin;
} }
public Page(bool portrait, float leftMargin, float topMargin) public Page(bool portrait, float leftMargin, float topMargin)
{ {
_Portrait = portrait; Portrait = portrait;
_LeftMargin = leftMargin; LeftMargin = leftMargin;
_TopMargin = topMargin; TopMargin = topMargin;
} }
} }
public class VG public class VG
{ {
private static Brush _BlackBrush = Brushes.Black; public static Brush BlackBrush { get; set; } = Brushes.Black;
public static Brush BlackBrush
{
get { return _BlackBrush; }
set { _BlackBrush = value; }
}
private static Color _BlackColor = Color.Black; private static Color _BlackColor = Color.Black;
public static Color BlackColor public static Color BlackColor
{ {
get { return _BlackColor; } get { return _BlackColor; }
set { _BlackColor = value; _BlackBrush = new SolidBrush(value); } set { _BlackColor = value; BlackBrush = new SolidBrush(value); }
} }
// Values of vector graphics items are stored as twips (1440 twips in an inch) // Values of vector graphics items are stored as twips (1440 twips in an inch)
public int cx; public int cx;
@@ -105,16 +75,12 @@ namespace VG
MoveAbsolute = ima; MoveAbsolute = ima;
pg = ipg; pg = ipg;
} }
public float ToPoints(float twip) public float ToPoints(float twip) => (float)(((float)twip) * 0.05f);
{
float r = ((float)twip) * 0.05f;
return r;
}
public void UpdatePageInfo(Page pa) public void UpdatePageInfo(Page pa)
{ {
pg.LeftMargin = pa.LeftMargin; pg.LeftMargin = pa.LeftMargin;
pg.Portrait = pa.Portrait; // RHM 20081003 - This had been pg.portrait=pg.portrait pg.Portrait = pa.Portrait;
pg.TopMargin = pa.TopMargin; // RHM 20081003 - This had been pg.VertOffset=pg.VertOffset pg.TopMargin = pa.TopMargin;
} }
public string AddRTFBUI(string origStr, string bold, string underline, string italics) public string AddRTFBUI(string origStr, string bold, string underline, string italics)
{ {
@@ -145,7 +111,6 @@ namespace VG
int B1 = (int)(colorFraction * color.B); int B1 = (int)(colorFraction * color.B);
int B2 = (int)((1 - colorFraction) * Color.White.B); int B2 = (int)((1 - colorFraction) * Color.White.B);
pn = new Pen(Color.FromArgb(R1 + R2, G1 + G2, B1 + B2), scaleWid); pn = new Pen(Color.FromArgb(R1 + R2, G1 + G2, B1 + B2), scaleWid);
//pn = new Pen(color, wid*wid);
} }
else else
pn = new Pen(color, scaleWid); pn = new Pen(color, scaleWid);
@@ -217,74 +182,14 @@ namespace VG
vgOutput.DrawRectangle(pn, rc); vgOutput.DrawRectangle(pn, rc);
} }
} }
public class VG_Image : VG
{
private int Scale;
private string FileName;
// Image is defined as starting point, scale factor (defaults to 1) & image file name
public VG_Image(int sx, int sy, int iscale, string fname)
{
cx = sx;
cy = sy;
Scale = 1;
FileName = fname;
}
public VG_Image(XmlElement svg, Page ipg)
{
cx = System.Convert.ToInt32(svg.GetAttribute("x"));
cy = System.Convert.ToInt32(svg.GetAttribute("y"));
Scale = 1;
if (svg.HasAttribute("scale")) Scale = System.Convert.ToInt32(svg.GetAttribute("scale"));
FileName = svg.GetAttribute("bname");
pg = ipg;
}
public void Draw(IVGOutput vgOutput)
{
Pen pn = new Pen(VG.BlackBrush, lnwid);
Bitmap bm = new Bitmap(FileName);
RectangleF rc = new RectangleF();
rc.Height = ToPoints((bm.Height * Scale) * 4.8f);
rc.Width = ToPoints((bm.Width * Scale) * 4.8f);
rc.X = ToPoints(pg.LeftMargin + cx);
rc.Y = ToPoints(pg.TopMargin + cy);
// TODO: grfx.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale);
}
}
public class VG_Ellipse : VG
{
// Ellipse (circle) is defined by a bounding rectangle specified by a coordinate pair, a width, and a height
public VG_Ellipse(int sx, int sy, int ex, int ey, int w, Page ipg)
{
cx = sx;
cy = sy;
dx = ex;
dy = ey;
lnwid = w;
pg = ipg;
}
public VG_Ellipse(XmlElement svg, Page ipg)
{
cx = System.Convert.ToInt32(svg.GetAttribute("cx"));
cy = System.Convert.ToInt32(svg.GetAttribute("cy"));
dx = System.Convert.ToInt32(svg.GetAttribute("rx"));
dy = System.Convert.ToInt32(svg.GetAttribute("ry"));
lnwid = System.Convert.ToInt32(svg.GetAttribute("stroke-width"));
pg = ipg;
}
public void Draw(IVGOutput vgOutput)
{
Pen pn = new Pen(VG.BlackBrush, ToPoints(lnwid));
vgOutput.DrawEllipse(pn, ToPoints(pg.LeftMargin + cx), ToPoints(pg.TopMargin + cy), ToPoints(dx), ToPoints(dy));
}
}
public class VG_Text : VG public class VG_Text : VG
{ {
private string FontName; private readonly string FontName;
private int FontSize; private readonly int FontSize;
private string Bold; private readonly string Bold;
private string Underline; private readonly string Underline;
private string Italics; private readonly string Italics;
private string Text; private readonly string Text;
// Text is defined by a starting location, attributes & the string // Text is defined by a starting location, attributes & the string
public VG_Text(int sx, int sy, int fs, string txt, string fn, string ibold, string iunder, string iitalics, Page ipg) public VG_Text(int sx, int sy, int fs, string txt, string fn, string ibold, string iunder, string iitalics, Page ipg)
{ {
@@ -297,48 +202,28 @@ namespace VG
Underline = iunder; Underline = iunder;
Italics = iitalics; Italics = iitalics;
pg = ipg; pg = ipg;
// TODO: The following were in the 16-bit code - we may need to use these, wait and see
// strokeWidth = stroke;
// strokeWidthBold = strokebold;
// ULOffset = UnderlineOffset;
// ULWidth = UnderlineWidth;
}
public VG_Text(XmlElement svg, Page ipg)
{
cx = System.Convert.ToInt32(svg.GetAttribute("x"));
cy = System.Convert.ToInt32(svg.GetAttribute("y"));
FontSize = System.Convert.ToInt32(svg.GetAttribute("font-size"));
Bold = svg.GetAttribute("font-weight");
Underline = svg.GetAttribute("text-decoration");
Italics = svg.GetAttribute("font-style");
FontName = svg.GetAttribute("font-family");
Text = svg.InnerText;
pg = ipg;
} }
public void Draw(IVGOutput vgOutput) public void Draw(IVGOutput vgOutput)
{ {
// TODO: Font myfont = new Font(FontName, (FontSize*9)/10); // TODO: Font myfont = new Font(FontName, (FontSize*9)/10);
Font myfont = new Font(FontName, FontSize * vgOutput.FontSizeAdjust); // TODO: Trying 80% Font myfont = new Font(FontName, FontSize * vgOutput.FontSizeAdjust); // TODO: Trying 80%
RectangleF rc = new RectangleF(); RectangleF rc = new RectangleF
{
// the returned value from c1 grfx code is already in points, // the returned value from c1 grfx code is already in points,
// so need to convert the size. // so need to convert the size.
rc.Size = vgOutput.MeasureString(Text, myfont); // TODO: 500 or pagewidth, or what Size = vgOutput.MeasureString(Text, myfont), // TODO: 500 or pagewidth, or what
//rc.Size = grfx.MeasureString(Text, myfont, 500); // TODO: 500 or pagewidth, or what //rc.Size = grfx.MeasureString(Text, myfont, 500); // TODO: 500 or pagewidth, or what
rc.X = ToPoints(pg.LeftMargin + cx); X = ToPoints(pg.LeftMargin + cx),
rc.Y = ToPoints(pg.TopMargin + cy) - FontSize; Y = ToPoints(pg.TopMargin + cy) - FontSize
};
rc.Height *= 1.0000001F; // Small factor to make text visible. rc.Height *= 1.0000001F; // Small factor to make text visible.
// add bold, underline & italics for entire object.
// TODO: string rtfout = AddRTFBUI(Text, Bold, Underline, Italics);
//using(Pen pn = new Pen(Color.DarkBlue, .1F))
// grfx.DrawRectangle(pn, rc.X,rc.Y,rc.Width,rc.Height);
vgOutput.DrawString(Text, myfont, VG.BlackBrush, rc); vgOutput.DrawString(Text, myfont, VG.BlackBrush, rc);
//grfx.DrawString(Text, myfont, VG.BlackBrush, rc);
} }
} }
public class VG_Arc : VG public class VG_Arc : VG
{ {
public Single sweepAngle; public float sweepAngle;
public Single startAngle; public float startAngle;
public float stX, stY; public float stX, stY;
public float rWid, rHgt; public float rWid, rHgt;
// Arc is defined by a bounding rectangle specified by a coordinate pair, a width, and a height // Arc is defined by a bounding rectangle specified by a coordinate pair, a width, and a height
@@ -365,9 +250,7 @@ namespace VG
rHgt = -hight; rHgt = -hight;
} }
startAngle = stAngle; startAngle = stAngle;
// startAngle = 90;
sweepAngle = swpAngle; sweepAngle = swpAngle;
// sweepAngle = -45;
lnwid = w; lnwid = w;
pg = ipg; pg = ipg;
} }
@@ -391,18 +274,6 @@ namespace VG
float starty = pg.Portrait ? (stY + pg.TopMargin) : (pg.LeftMargin - stX); float starty = pg.Portrait ? (stY + pg.TopMargin) : (pg.LeftMargin - stX);
RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(rWid), ToPoints(rHgt)); RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(rWid), ToPoints(rHgt));
//Console.WriteLine("{0},'{1}',{2},{3},{4},{5},{6},{7}", iColor, pn.Color, rc.X, rc.Y, rc.Width, rc.Height, startAngle, sweepAngle); //Console.WriteLine("{0},'{1}',{2},{3},{4},{5},{6},{7}", iColor, pn.Color, rc.X, rc.Y, rc.Width, rc.Height, startAngle, sweepAngle);
//if (iColor == 7 || iColor == 8) return;
//if (iColor == 6) return;
//if (iColor == 4 || iColor == 6)
//{
// using (Pen lightPen = new Pen(myColors[iColor % myColors.Length], .01F))
//{
// vgOutput.DrawEllipse(lightPen, rc.X, rc.Y, rc.Width, rc.Height);
// float xc = rc.X + (rc.Width / 2);
// float yc = rc.Y + (rc.Height / 2);
// vgOutput.DrawEllipse(lightPen, xc - .5F, yc - .5F, 1F, 1F);
//}
//}
if (sweepAngle > 0) if (sweepAngle > 0)
vgOutput.DrawArc(pn, rc, startAngle, sweepAngle); vgOutput.DrawArc(pn, rc, startAngle, sweepAngle);
else else
@@ -0,0 +1,8 @@

namespace Volian.Base.Library
{
public static class BaseLnSettings
{
public static bool blBaseLine { get; set; } = false;
}
}
+4 -37
View File
@@ -6,7 +6,6 @@ using System.Xml.Serialization;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
[Serializable()] [Serializable()]
//[XmlRoot("BigNum")]
public class BigNum public class BigNum
{ {
#region fields #region fields
@@ -22,18 +21,9 @@ namespace Volian.Base.Library
public BigNum() public BigNum()
{ {
} }
public BigNum(int value) public BigNum(int value) => SetFlag(value);
{ public BigNum(string values) => SetFlags(values);
SetFlag(value); public BigNum(ICollection<int> values) => SetFlags(values);
}
public BigNum(string values)
{
SetFlags(values);
}
public BigNum(ICollection<int> values)
{
SetFlags(values);
}
public override string ToString() public override string ToString()
{ {
return FlagList; return FlagList;
@@ -58,10 +48,6 @@ namespace Volian.Base.Library
} }
#endregion #endregion
#region methods #region methods
//public override string ToString()
//{
// return GenericSerializer<BigNum>.StringSerialize(this);
//}
public bool Includes(BigNum other) public bool Includes(BigNum other)
{ {
List<int> mine = GetFlags(); List<int> mine = GetFlags();
@@ -82,12 +68,6 @@ namespace Volian.Base.Library
public List<int> GetFlags() public List<int> GetFlags()
{ {
List<int> myints = new List<int>(); List<int> myints = new List<int>();
//if (MyValue.Count == 0)//1 && MyValue.ContainsKey(0) && MyValue[0] == 0)
//{
// myints.Add(-1);
//}
//else
//{
foreach (uint key in MyValue.Keys) foreach (uint key in MyValue.Keys)
{ {
ulong y = MyValue[key]; ulong y = MyValue[key];
@@ -97,18 +77,10 @@ namespace Volian.Base.Library
myints.Add((int)(i + (key * 64))); myints.Add((int)(i + (key * 64)));
} }
} }
//}
return myints; return myints;
} }
public void SetFlag(int flag) public void SetFlag(int flag)
{ {
//if (flag == -1)
//{
// MyValue = new SortedDictionary<uint, ulong>();
// //MyValue.Add(0, 0);
//}
//else
//{
uint offset = (uint)(flag / 64); uint offset = (uint)(flag / 64);
ulong x = one << (flag % 64); ulong x = one << (flag % 64);
if (MyValue.ContainsKey(offset)) if (MyValue.ContainsKey(offset))
@@ -122,12 +94,7 @@ namespace Volian.Base.Library
foreach (int f in flags) foreach (int f in flags)
SetFlag(f); SetFlag(f);
} }
public static BigNum MakeBigNum(string numbers) public static BigNum MakeBigNum(string numbers) => numbers == "-1" ? null : new BigNum(numbers);
{
if (numbers == "-1")
return null;
return new BigNum(numbers);
}
#endregion #endregion
#region properties #region properties
[XmlAttribute] [XmlAttribute]
@@ -1,10 +1,4 @@
using System; namespace Volian.Base.Library
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Volian.Base.Library
{ {
public static class ByteArrayCompare public static class ByteArrayCompare
{ {
+38 -89
View File
@@ -1,16 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
public class DebugPrint:IDisposable public class DebugPrint:IDisposable
{ {
public void Dispose() public void Dispose() => Close();
{
Close();
}
private StreamWriter _MyStreamWriter = null; private StreamWriter _MyStreamWriter = null;
public StreamWriter MyStreamWriter public StreamWriter MyStreamWriter
{ {
@@ -25,10 +20,7 @@ namespace Volian.Base.Library
_MyStreamWriter = value; _MyStreamWriter = value;
} }
} }
public bool IsOpen public bool IsOpen => MyStreamWriter != null;
{
get { return MyStreamWriter != null; }
}
private string _FileName = null; private string _FileName = null;
public string FileName public string FileName
{ {
@@ -40,21 +32,14 @@ namespace Volian.Base.Library
MyFileInfo = new FileInfo(value); MyFileInfo = new FileInfo(value);
} }
} }
private FileInfo _MyFileInfo;
public FileInfo MyFileInfo public FileInfo MyFileInfo { get; set; }
{
get { return _MyFileInfo; }
set { _MyFileInfo = value; }
}
public void Open(string fileName) public void Open(string fileName)
{ {
FileName = fileName; FileName = fileName;
MyStreamWriter = MyFileInfo.CreateText(); MyStreamWriter = MyFileInfo.CreateText();
} }
public void Close() public void Close() => MyStreamWriter = null;
{
MyStreamWriter = null;
}
public void Write(string format, params object[] args) public void Write(string format, params object[] args)
{ {
if (IsOpen) MyStreamWriter.Write(format, args); if (IsOpen) MyStreamWriter.Write(format, args);
@@ -73,98 +58,62 @@ namespace Volian.Base.Library
} }
public static class DebugPagination public static class DebugPagination
{ {
private static int _TotalPages = 0; public static int TotalPages { get; set; } = 0;
public static int TotalPages private static readonly DebugPrint _MyDebugPrint = new DebugPrint();
{ public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
get { return _TotalPages; }
set { _TotalPages = value; }
}
private static DebugPrint _MyDebugPrint = new DebugPrint();
public static void Open(string fileName)
{ _MyDebugPrint.Open(fileName); }
public static void Close() public static void Close()
{ {
WriteLine("{0} Total Pages", TotalPages); WriteLine("{0} Total Pages", TotalPages);
_MyDebugPrint.Close(); _MyDebugPrint.Close();
} }
public static void Write(string format, params object[] args) public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
{ _MyDebugPrint.Write(format, args); } public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
public static void WriteLine(string format, params object[] args) public static void Show() => _MyDebugPrint.Show();
{ _MyDebugPrint.WriteLine(format, args); } public static bool IsOpen => _MyDebugPrint.IsOpen;
public static void Show()
{ _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
} }
public static class DebugText public static class DebugText
{ {
private static DebugPrint _MyDebugPrint = new DebugPrint(); private static readonly DebugPrint _MyDebugPrint = new DebugPrint();
public static void Open(string fileName) public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
{ _MyDebugPrint.Open(fileName); } public static void Close() => _MyDebugPrint.Close();
public static void Close() public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
{ _MyDebugPrint.Close(); } public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
public static void Write(string format, params object[] args) public static void Show() => _MyDebugPrint.Show();
{ _MyDebugPrint.Write(format, args); } public static bool IsOpen => _MyDebugPrint.IsOpen;
public static void WriteLine(string format, params object[] args)
{ _MyDebugPrint.WriteLine(format, args); }
public static void Show()
{ _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
} }
public static class DebugProfile public static class DebugProfile
{ {
private static DebugPrint _MyDebugPrint = new DebugPrint(); private static DebugPrint _MyDebugPrint = new DebugPrint();
public static void Open(string fileName) public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
{ _MyDebugPrint.Open(fileName); }
public static void Close() public static void Close()
{ _MyDebugPrint.Close(); _MyDebugPrint = null; } { _MyDebugPrint.Close(); _MyDebugPrint = null; }
public static void Write(string format, params object[] args) public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
{ _MyDebugPrint.Write(format, args); } public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
public static void WriteLine(string format, params object[] args) public static void Show() => _MyDebugPrint.Show();
{ _MyDebugPrint.WriteLine(format, args); } public static bool IsOpen => _MyDebugPrint.IsOpen;
public static void Show()
{ _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
} }
public static class DebugDBTrack public static class DebugDBTrack
{ {
private static DebugPrint _MyDebugPrint = new DebugPrint(); private static DebugPrint _MyDebugPrint = new DebugPrint();
public static void Open(string fileName) public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
{ _MyDebugPrint.Open(fileName); }
public static void Close() public static void Close()
{ _MyDebugPrint.Close(); _MyDebugPrint = null; } { _MyDebugPrint.Close(); _MyDebugPrint = null; }
public static void Write(string format, params object[] args) public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
{ _MyDebugPrint.Write(format, args); } public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
public static void WriteLine(string format, params object[] args) public static void Show() => _MyDebugPrint.Show();
{ _MyDebugPrint.WriteLine(format, args); } public static bool IsOpen => _MyDebugPrint.IsOpen;
public static void Show()
{ _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
} }
// C2018-004 create meta file for baseline compares // C2018-004 create meta file for baseline compares
public static class BaselineMetaFile public static class BaselineMetaFile
{ {
private static DebugPrint _MyDebugPrint = new DebugPrint(); private static readonly DebugPrint _MyDebugPrint = new DebugPrint();
public static void Open(string fileName) public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
{ _MyDebugPrint.Open(fileName); } public static void Close() => _MyDebugPrint.Close();
public static void Close() public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
{ _MyDebugPrint.Close(); } public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
public static void Write(string format, params object[] args) public static void Show() => _MyDebugPrint.Show();
{ _MyDebugPrint.Write(format, args); } public static bool IsOpen => _MyDebugPrint.IsOpen;
public static void WriteLine(string format, params object[] args)
{ _MyDebugPrint.WriteLine(format, args); } public static bool IncludeWordSecText { get; set; } = true;
public static void Show()
{ _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
private static bool _IncludeWordSecText = true;
public static bool IncludeWordSecText
{
get { return BaselineMetaFile._IncludeWordSecText; }
set { BaselineMetaFile._IncludeWordSecText = value; }
}
} }
} }
+3 -9
View File
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -11,11 +9,7 @@ namespace Volian.Base.Library
#region Log4Net #region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
public static string GetROEditorPath() public static string GetROEditorPath() => $@"{PROMSExecutableFolderPath()}\ROEDITOR.EXE";
{
string roapp = PROMSExecutableFolderPath() + @"\ROEDITOR.EXE";
return roapp;
}
// returns the path to the executable folder // returns the path to the executable folder
public static string PROMSExecutableFolderPath() public static string PROMSExecutableFolderPath()
@@ -24,7 +18,7 @@ namespace Volian.Base.Library
if (pathPROMSexe[7] == ':') // either a local drive or a mapped network drive if (pathPROMSexe[7] == ':') // either a local drive or a mapped network drive
pathPROMSexe = pathPROMSexe.Substring(6); pathPROMSexe = pathPROMSexe.Substring(6);
else else
pathPROMSexe = @"\" + pathPROMSexe.Substring(5); // non-mapped network drive - need to add extra back slash in front pathPROMSexe = $@"\{pathPROMSexe.Substring(5)}"; // non-mapped network drive - need to add extra back slash in front
return pathPROMSexe; return pathPROMSexe;
} }
@@ -34,7 +28,7 @@ namespace Volian.Base.Library
try try
{ {
// Build the path to the PROMSFixes.sql file located in the PROMS exe folder // Build the path to the PROMSFixes.sql file located in the PROMS exe folder
string pathPROMSFixes = PROMSExecutableFolderPath() + @"\PROMSFixes.sql"; string pathPROMSFixes = $@"{PROMSExecutableFolderPath()}\PROMSFixes.sql";
// open the PROMSFixes.sql file and grab the line of text containing the PROMSFixes RevDate // open the PROMSFixes.sql file and grab the line of text containing the PROMSFixes RevDate
// using Linq to open and read the PROMSFixes file // using Linq to open and read the PROMSFixes file
+10 -37
View File
@@ -1,8 +1,5 @@
using System; using System;
using System.Collections;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing.Design; using System.Drawing.Design;
using System.Windows.Forms.Design; using System.Windows.Forms.Design;
@@ -13,7 +10,6 @@ namespace Volian.Base.Library
public class FlagCheckedListBox : CheckedListBox public class FlagCheckedListBox : CheckedListBox
{ {
private System.ComponentModel.Container components = null;
public FlagCheckedListBox() public FlagCheckedListBox()
{ {
@@ -21,16 +17,6 @@ namespace Volian.Base.Library
InitializeComponent(); InitializeComponent();
} }
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code #region Component Designer generated code
private void InitializeComponent() private void InitializeComponent()
{ {
@@ -124,7 +110,7 @@ namespace Volian.Base.Library
// If the item has been unchecked, remove its bits from the sum // If the item has been unchecked, remove its bits from the sum
if (cs == CheckState.Unchecked) if (cs == CheckState.Unchecked)
sum = sum & (~composite.value); sum &= (~composite.value);
// If the item has been checked, combine its bits with the sum // If the item has been checked, combine its bits with the sum
else else
sum |= composite.value; sum |= composite.value;
@@ -207,25 +193,13 @@ namespace Volian.Base.Library
caption = c; caption = c;
} }
public override string ToString() public override string ToString() => caption;
{
return caption;
}
// Returns true if the value corresponds to a single bit being set // Returns true if the value corresponds to a single bit being set
public bool IsFlag public bool IsFlag => (value & (value - 1)) == 0;
{
get
{
return ((value & (value - 1)) == 0);
}
}
// Returns true if this value is a member of the composite bit value // Returns true if this value is a member of the composite bit value
public bool IsMemberFlag(FlagCheckedListBoxItem composite) public bool IsMemberFlag(FlagCheckedListBoxItem composite) => IsFlag && ((value & composite.value) == value);
{
return (IsFlag && ((value & composite.value) == value));
}
public uint value; public uint value;
public string caption; public string caption;
@@ -236,12 +210,14 @@ namespace Volian.Base.Library
public class FlagEnumUIEditor : UITypeEditor public class FlagEnumUIEditor : UITypeEditor
{ {
// The checklistbox // The checklistbox
private FlagCheckedListBox flagEnumCB; private readonly FlagCheckedListBox flagEnumCB;
public FlagEnumUIEditor() public FlagEnumUIEditor()
{ {
flagEnumCB = new FlagCheckedListBox(); flagEnumCB = new FlagCheckedListBox
flagEnumCB.BorderStyle = BorderStyle.None; {
BorderStyle = BorderStyle.None
};
} }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
@@ -266,10 +242,7 @@ namespace Volian.Base.Library
return null; return null;
} }
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown;
{
return UITypeEditorEditStyle.DropDown;
}
} }
@@ -1,12 +1,4 @@
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
@@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
@@ -17,7 +16,6 @@ namespace Volian.Base.Library
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {
xs.Serialize(new NonXsiTextWriter(ms, Encoding.Unicode), t); xs.Serialize(new NonXsiTextWriter(ms, Encoding.Unicode), t);
//xs.Serialize(ms, t);
ms.Position = 0; ms.Position = 0;
StreamReader sr = new StreamReader(ms); StreamReader sr = new StreamReader(ms);
strOutput = sr.ReadToEnd(); strOutput = sr.ReadToEnd();
@@ -38,26 +36,6 @@ namespace Volian.Base.Library
} }
return t; return t;
} }
//public static void WriteFile(T t, string fileName)
//{
// string strOutput = string.Empty;
// XmlSerializer xs = new XmlSerializer(typeof(T));
// using (FileStream fs = new FileStream(fileName, FileMode.Create))
// {
// xs.Serialize(new NonXsiTextWriter(fs, Encoding.UTF8), t);
// fs.Close();
// }
//}
//public static T ReadFile(string fileName)
//{
// T t;
// XmlSerializer xs = new XmlSerializer(typeof(T));
// using (FileStream fs = new FileStream(fileName, FileMode.Open))
// {
// t = (T)xs.Deserialize(fs);
// }
// return t;
//}
} }
public class NonXsiTextWriter : XmlTextWriter public class NonXsiTextWriter : XmlTextWriter
{ {
@@ -79,8 +57,6 @@ namespace Volian.Base.Library
} }
if (localName == "xlink_href") if (localName == "xlink_href")
base.WriteStartAttribute(prefix, "xlink:href", ns); base.WriteStartAttribute(prefix, "xlink:href", ns);
//else if (localName == "encoding")
// _skip = true;
else else
base.WriteStartAttribute(prefix, localName, ns); base.WriteStartAttribute(prefix, localName, ns);
} }
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
+26 -51
View File
@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using System.Windows.Forms; using System.Windows.Forms;
using System.Reflection; using System.Reflection;
@@ -17,10 +13,10 @@ namespace Volian.Base.Library
// PropertyValueChanged event args... // PropertyValueChanged event args...
public delegate void MyPropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e); public delegate void MyPropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e);
public static event MyPropertyValueChangedEventHandler MyPropertyValueChanged; public static event MyPropertyValueChangedEventHandler MyPropertyValueChanged;
private bool AllowAddDel = false; // flags whether the Add/Delete buttons should be displayed: private readonly bool AllowAddDel = false; // flags whether the Add/Delete buttons should be displayed:
// Inherit the default constructor from the standard // Inherit the default constructor from the standard
// Collection Editor... // Collection Editor...
private Type _origType; private readonly Type _origType;
public PropGridCollEditor(Type type) public PropGridCollEditor(Type type)
: base(type) : base(type)
{ {
@@ -29,10 +25,7 @@ namespace Volian.Base.Library
if (type.Name == "ReplaceStrData") AllowAddDel = true; // Defaults to not having the 'Add' & 'Remove' buttons. if (type.Name == "ReplaceStrData") AllowAddDel = true; // Defaults to not having the 'Add' & 'Remove' buttons.
} }
protected override Type CreateCollectionItemType() protected override Type CreateCollectionItemType() => base.CreateCollectionItemType();
{
return base.CreateCollectionItemType();
}
private Button resetbtn = null; private Button resetbtn = null;
// Override this method in order to access the containing user controls // Override this method in order to access the containing user controls
// from the default Collection Editor form or to add new ones... // from the default Collection Editor form or to add new ones...
@@ -50,18 +43,19 @@ namespace Volian.Base.Library
if (!AllowAddDel) if (!AllowAddDel)
{ {
// add a reset button and put next to ok button: // add a reset button and put next to ok button:
resetbtn = new Button(); resetbtn = new Button
resetbtn.Text = "Reset"; {
resetbtn.Location = new System.Drawing.Point(okbtn.Location.X - 20, okbtn.Location.Y); Text = "Reset",
resetbtn.Width = 250; Location = new System.Drawing.Point(okbtn.Location.X - 20, okbtn.Location.Y),
resetbtn.Visible = true; Width = 250,
resetbtn.Enabled = false; // only enabled on data change Visible = true,
Enabled = false // only enabled on data change
};
resetbtn.Click += resetbtn_Click; resetbtn.Click += resetbtn_Click;
okbtn.Parent.Controls.Add(resetbtn); okbtn.Parent.Controls.Add(resetbtn);
} }
SetMembersLabel(collectionForm); SetMembersLabel(collectionForm);
TableLayoutPanel tlpLayout = frmCollectionEditorForm.Controls[0] as TableLayoutPanel; if (frmCollectionEditorForm.Controls[0] is TableLayoutPanel tlpLayout)
if (tlpLayout != null)
{ {
// Get a reference to the inner PropertyGrid and hook an event handler to it. // Get a reference to the inner PropertyGrid and hook an event handler to it.
if (tlpLayout.Controls[5] is PropertyGrid) if (tlpLayout.Controls[5] is PropertyGrid)
@@ -93,20 +87,7 @@ namespace Volian.Base.Library
else if (SelectedGridField.Contains("Active CheckOff")) else if (SelectedGridField.Contains("Active CheckOff"))
ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
} }
private void ShowReflection(Object data)
{
if (data == null) return;
//Object data = new A();
FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance);
String str = "";
foreach (FieldInfo f in fields)
{
str += f.Name + " = " + f.GetValue(data) + "\r\n";
}
Console.WriteLine("reflection = {0}", str);
}
PropertyGrid propertyGrid = null; PropertyGrid propertyGrid = null;
private string SelectedGridField = ""; private string SelectedGridField = "";
// The following method is used to enable and set text on the 'Reset' button. When a grid item is selected, if it has // The following method is used to enable and set text on the 'Reset' button. When a grid item is selected, if it has
@@ -114,7 +95,7 @@ namespace Volian.Base.Library
void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e) void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)
{ {
if (resetbtn == null) return; if (resetbtn == null) return;
if (propertyGrid != null) Console.WriteLine(LabelPath(propertyGrid.SelectedGridItem)); // PG.SelectedGridItem.Label + " : " + PG.SelectedGridItem.Value; if (propertyGrid != null) Console.WriteLine(LabelPath(propertyGrid.SelectedGridItem));
// see if data has changed, and if so, enable the Reset button. // see if data has changed, and if so, enable the Reset button.
bool enabled = false; bool enabled = false;
resetbtn.Text = "Reset"; resetbtn.Text = "Reset";
@@ -124,7 +105,7 @@ namespace Volian.Base.Library
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont"); string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont");
if (origForButton != null) if (origForButton != null)
{ {
resetbtn.Text = "Reset to " + origForButton; resetbtn.Text = $"Reset to {origForButton}";
enabled = true; enabled = true;
} }
} }
@@ -133,7 +114,7 @@ namespace Volian.Base.Library
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin"); string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin");
if (origForButton != null) if (origForButton != null)
{ {
resetbtn.Text = "Reset to " + origForButton; resetbtn.Text = $"Reset to {origForButton}";
enabled = true; enabled = true;
} }
} }
@@ -142,7 +123,7 @@ namespace Volian.Base.Library
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength"); string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength");
if (origForButton != null) if (origForButton != null)
{ {
resetbtn.Text = "Reset to " + origForButton; resetbtn.Text = $"Reset to {origForButton}";
enabled = true; enabled = true;
} }
} }
@@ -151,7 +132,7 @@ namespace Volian.Base.Library
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
if (origForButton != null) if (origForButton != null)
{ {
resetbtn.Text = "Reset to " + origForButton; resetbtn.Text = $"Reset to {origForButton}";
enabled = true; enabled = true;
} }
} }
@@ -160,7 +141,7 @@ namespace Volian.Base.Library
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active"); string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
if (origForButton != null) if (origForButton != null)
{ {
resetbtn.Text = "Reset to " + origForButton; resetbtn.Text = $"Reset to {origForButton}";
enabled = true; enabled = true;
} }
} }
@@ -182,8 +163,8 @@ namespace Volian.Base.Library
// field to compare the 2 to see if a change was made, i.e. UCF data exists. // field to compare the 2 to see if a change was made, i.e. UCF data exists.
foreach (FieldInfo f in fields) foreach (FieldInfo f in fields)
{ {
if (f.Name == "_" + fieldName) fldVal = f; if (f.Name == $"_{fieldName}") fldVal = f;
if (f.Name == "_Orig" + fieldName) fldOrig = f; if (f.Name == $"_Orig{fieldName}") fldOrig = f;
} }
if (fldVal != null && fldOrig != null) if (fldVal != null && fldOrig != null)
{ {
@@ -200,7 +181,7 @@ namespace Volian.Base.Library
if (orig != newv) return retval; if (orig != newv) return retval;
else return null; else return null;
} }
catch (Exception ex) catch (Exception)
{ {
return null; return null;
} }
@@ -218,8 +199,8 @@ namespace Volian.Base.Library
BindingFlags.Instance); BindingFlags.Instance);
foreach (FieldInfo f in fields) foreach (FieldInfo f in fields)
{ {
if (f.Name == "_" + fieldName) fldVal = f; if (f.Name == $"_{fieldName}") fldVal = f;
if (f.Name == "_Orig" + fieldName) fldOrig = f; if (f.Name == $"_Orig{fieldName}") fldOrig = f;
} }
if (fldVal != null && fldOrig != null) if (fldVal != null && fldOrig != null)
{ {
@@ -228,10 +209,7 @@ namespace Volian.Base.Library
} }
} }
// Remove this on release, and any uses of it. // Remove this on release, and any uses of it.
private string LabelPath(GridItem gi) private string LabelPath(GridItem gi) => gi.Parent == null ? "" : $"{LabelPath(gi.Parent)}:{gi.Label}";
{
return (gi.Parent == null ? "" : LabelPath(gi.Parent) + ":" + gi.Label);
}
// set the 'members' label to better reflect what is displayed: // set the 'members' label to better reflect what is displayed:
private bool SetMembersLabel(Control myControl) private bool SetMembersLabel(Control myControl)
@@ -292,10 +270,7 @@ namespace Volian.Base.Library
void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e) void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
{ {
// Fire our customized collection event... // Fire our customized collection event...
if (PropGridCollEditor.MyPropertyValueChanged != null) PropGridCollEditor.MyPropertyValueChanged?.Invoke(this, e);
{
PropGridCollEditor.MyPropertyValueChanged(this, e);
}
} }
} }
} }
+8 -282
View File
@@ -1,11 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.ComponentModel; using System.ComponentModel;
using Volian.Base.Library;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
@@ -451,11 +448,6 @@ namespace Volian.Base.Library
} }
#endregion #endregion
#region Structures #region Structures
//struct CharRange
//{
// public int cpMin;
// public int cpMax;
//}
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)] [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
public struct CharFormat2 public struct CharFormat2
{ {
@@ -483,16 +475,10 @@ namespace Volian.Base.Library
} }
public class CharFormatTwo public class CharFormatTwo
{ {
public CharFormatTwo(CharFormat2 cf) public CharFormatTwo(CharFormat2 cf) => _CharFormat2 = cf;
{
_CharFormat2 = cf;
}
private CharFormat2 _CharFormat2; private CharFormat2 _CharFormat2;
[Browsable(false)] [Browsable(false)]
public CharFormat2 CharFormat2 public CharFormat2 CharFormat2 => _CharFormat2;
{
get { return _CharFormat2; }
}
[Browsable(false)] [Browsable(false)]
public int cbSize public int cbSize
{ {
@@ -521,14 +507,8 @@ namespace Volian.Base.Library
get { return _CharFormat2.yOffset; } get { return _CharFormat2.yOffset; }
set { _CharFormat2.yOffset = value; } set { _CharFormat2.yOffset = value; }
} }
private Color Int2Color(int color) private Color Int2Color(int color) => Color.FromArgb(color % 256, (color / 256) % 256, color / (256 * 256));
{ private int Color2Int(Color color) => color.R + (color.G * 256) + (color.B * 256 * 256);
return Color.FromArgb(color % 256, (color / 256) % 256, color / (256 * 256));
}
private int Color2Int(Color color)
{
return color.R + (color.G * 256) + (color.B * 256 * 256);
}
public Color crTextColor public Color crTextColor
{ {
get { return Int2Color(_CharFormat2.crTextColor); } get { return Int2Color(_CharFormat2.crTextColor); }
@@ -637,14 +617,8 @@ namespace Volian.Base.Library
public class ParaFormatTwo public class ParaFormatTwo
{ {
private ParaFormat2 _ParaFormat2; private ParaFormat2 _ParaFormat2;
public ParaFormatTwo(ParaFormat2 pf) public ParaFormatTwo(ParaFormat2 pf) => _ParaFormat2 = pf;
{ public ParaFormat2 ParaFormat2 => _ParaFormat2;
_ParaFormat2 = pf;
}
public ParaFormat2 ParaFormat2
{
get { return _ParaFormat2; }
}
public int cbSize public int cbSize
{ {
get { return _ParaFormat2.cbSize; } get { return _ParaFormat2.cbSize; }
@@ -769,16 +743,8 @@ namespace Volian.Base.Library
} }
#endregion #endregion
#region Static Methods #region Static Methods
public static bool HasVertScroll(Control ctl) public static bool HasVertScroll(Control ctl) => (GetWindowLong(ctl.Handle, GWL_STYLE) & WS_VSCROLL) != 0;
{ public static bool HasHorzScroll(Control ctl) => (GetWindowLong(ctl.Handle, GWL_STYLE) & WS_HSCROLL) != 0;
int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE);
return (dwstyle & WS_VSCROLL) != 0;
}
public static bool HasHorzScroll(Control ctl)
{
int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE);
return (dwstyle & WS_HSCROLL) != 0;
}
public static void SetScrollLocation(RichTextBox richTextBox, Point point) public static void SetScrollLocation(RichTextBox richTextBox, Point point)
{ {
if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETSCROLLPOS, 0, ref point) == 0) if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETSCROLLPOS, 0, ref point) == 0)
@@ -815,7 +781,6 @@ namespace Volian.Base.Library
ParaFormat2 pf2 = pft.ParaFormat2; ParaFormat2 pf2 = pft.ParaFormat2;
if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETPARAFORMAT, 0, ref pf2) == 0) if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETPARAFORMAT, 0, ref pf2) == 0)
{ {
//if(Marshal.GetLastWin32Error()!=0)
throw new Win32Exception(); throw new Win32Exception();
} }
} }
@@ -849,15 +814,6 @@ namespace Volian.Base.Library
} }
} }
public static void SetHighlightColor(RichTextBox richTextBox, RTBSelection selection, Color color)
{
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
cft.crBackColor = color;
cft.dwEffects = 0;
cft.dwMask = 0;
cft.dwMask |= CharFormatMasks.CFM_BACKCOLOR;
SetCharFormat(richTextBox, selection, cft);
}
public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore) public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore)
{ {
ParaFormatTwo pft = GetParaFormat(richTextBox); ParaFormatTwo pft = GetParaFormat(richTextBox);
@@ -875,236 +831,6 @@ namespace Volian.Base.Library
pft.dySpaceBefore = spaceBefore * 1440 / dpi; pft.dySpaceBefore = spaceBefore * 1440 / dpi;
SetParaFormat(richTextBox, pft); SetParaFormat(richTextBox, pft);
} }
//developed for equation editor interface work, but ended up not needing it. Kept it in
// case it is needed in the future.
//public static void SetSpaceAfter(RichTextBox richTextBox, int spaceAfter)
//{
// ParaFormatTwo pft = GetParaFormat(richTextBox);
// pft.dwMask = 0;
// pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER;
// // get the monitor's resolution in DPI and use it to set the linespacing value for
// // the richtextbox. Note that without this, the Arial Unicode font made the appearance of
// // almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
// Graphics g = richTextBox.CreateGraphics();
// int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
// g.Dispose();
// // dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
// //line to the next, in twips - thus the 1440.
// pft.dySpaceAfter = spaceAfter * 1440 / dpi;
// SetParaFormat(richTextBox, pft);
//}
public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type)
{
ParaFormatTwo pft = GetParaFormat(richTextBox);
pft.bLineSpacingRule = type;
pft.dwMask = 0;
pft.dwMask |= ParaFormatMasks.PFM_LINESPACING;
pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER;
// get the monitor's resolution in DPI and use it to set the linespacing value for
// the richtextbox. Note that without this, the Arial Unicode font made the appearance of
// almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
Graphics g = richTextBox.CreateGraphics();
int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
g.Dispose();
// dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
//line to the next, in twips - thus the 1440.
pft.dyLineSpacing = Convert.ToInt32(.5 + richTextBox.Font.GetHeight(dpi)) * 1440 / dpi;
SetParaFormat(richTextBox, pft);
}
public static E_FontStyle GetFontStyle(RichTextBox richTextBox)
{
E_FontStyle fs = E_FontStyle.FS_NONE;
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
if (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) &&
((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD)) fs |= E_FontStyle.FS_BOLD;
if (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) &&
((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)) fs |= E_FontStyle.FS_UNDERLINE;
if (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) &&
((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)) fs |= E_FontStyle.FS_ITALIC;
if (richTextBox.SelectionCharOffset == -2) fs |= E_FontStyle.FS_SUBSCRIPT;
if (richTextBox.SelectionCharOffset == 2) fs |= E_FontStyle.FS_SUPERSCRIPT;
return fs;
}
public static void SetFontStyle(RichTextBox richTextBox, E_FontStyle fs)
{
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
if ((fs & E_FontStyle.FS_BOLD) == E_FontStyle.FS_BOLD)
{
cft.dwEffects |= CharFormatEffects.CFE_BOLD;
cft.dwMask |= CharFormatMasks.CFM_BOLD;
}
if ((fs & E_FontStyle.FS_UNDERLINE) == E_FontStyle.FS_UNDERLINE)
{
cft.dwEffects |= CharFormatEffects.CFE_UNDERLINE;
cft.dwMask |= CharFormatMasks.CFM_UNDERLINE;
}
if ((fs & E_FontStyle.FS_ITALIC) == E_FontStyle.FS_ITALIC)
{
cft.dwEffects |= CharFormatEffects.CFE_ITALIC;
cft.dwMask |= CharFormatMasks.CFM_ITALIC;
}
if ((fs & E_FontStyle.FS_SUBSCRIPT) == E_FontStyle.FS_SUBSCRIPT)
{
richTextBox.SelectionCharOffset = -2;
}
if ((fs & E_FontStyle.FS_SUPERSCRIPT) == E_FontStyle.FS_SUPERSCRIPT)
{
richTextBox.SelectionCharOffset = 2;
}
SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
}
public static bool IsSuperScript(RichTextBox richTextBox)
{
return (richTextBox.SelectionCharOffset>0);
}
public static bool IsSubScript(RichTextBox richTextBox)
{
return (richTextBox.SelectionCharOffset < 0);
}
public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{
if (bSet)
richTextBox.SelectionCharOffset = -2;
else
richTextBox.SelectionCharOffset = 0;
}
public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{
if (bSet)
richTextBox.SelectionCharOffset = 2;
else
richTextBox.SelectionCharOffset = 0;
}
public static bool IsBold(RichTextBox richTextBox)
{
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
return (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) &&
((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD));
}
public static void ToggleBold(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
if (bSet)
{
cft.dwEffects = CharFormatEffects.CFE_BOLD;
cft.dwMask = CharFormatMasks.CFM_BOLD;
}
else
{
cft.dwEffects = CharFormatEffects.CFE_NONE;
cft.dwMask = CharFormatMasks.CFM_BOLD;
}
SetCharFormat(richTextBox, selection, cft);
}
public static bool IsUnderline(RichTextBox richTextBox)
{
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
return (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) &&
((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE));
}
public static void ToggleUnderline(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
if (bSet)
{
cft.dwEffects = CharFormatEffects.CFE_UNDERLINE;
cft.dwMask = CharFormatMasks.CFM_UNDERLINE;
}
else
{
cft.dwEffects = CharFormatEffects.CFE_NONE;
cft.dwMask = CharFormatMasks.CFM_UNDERLINE;
}
SetCharFormat(richTextBox, selection, cft);
}
public static bool IsItalic(RichTextBox richTextBox)
{
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
return (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) &&
((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC));
}
public static void ToggleItalic(bool bSet, RichTextBox richTextBox, RTBSelection selection)
{
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
if (bSet)
{
cft.dwEffects = CharFormatEffects.CFE_ITALIC;
cft.dwMask = CharFormatMasks.CFM_ITALIC;
}
else
{
cft.dwEffects = CharFormatEffects.CFE_NONE;
cft.dwMask = CharFormatMasks.CFM_ITALIC;
}
SetCharFormat(richTextBox, selection, cft);
}
//public static bool IsLink(RichTextBox richTextBox)
//{
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
// return ((cft.dwEffects & CharFormatEffects.CFE_PROTECTED) == CharFormatEffects.CFE_PROTECTED);
//}
//public static void ToggleLink(bool bSet, RichTextBox richTextBox, RTBSelection selection)
//{
// CharFormatTwo cft = GetCharFormat(richTextBox, selection);
// if (bSet)
// {
// cft.dwEffects |= CharFormatEffects.CFE_LINK;
// cft.dwMask |= CharFormatMasks.CFM_LINK;
// }
// else
// {
// cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_LINK;
// }
// SetCharFormat(richTextBox, selection, cft);
//}
//public static void UnProtect(RichTextBox richTextBox) //, string type, string text, string link)
//{
// //richTextBox.DetectUrls = false;
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
// //int position = richTextBox.SelectionStart = richTextBox.TextLength;
// //richTextBox.SelectionLength = 0;
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
// //richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
// //richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_PROTECTED;
// cft.dwEffects = 0;
// // The lines below can be used to allow link text to be edited
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
// //rtbRTF.SetSelectionLink(true);
// //richTextBox.SelectionStart = richTextBox.TextLength;
// //richTextBox.SelectionLength = 0;
//}
//public static void Protect(RichTextBox richTextBox) //, string type, string text, string link)
//{
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
// cft.dwMask = CharFormatMasks.CFM_PROTECTED;
// cft.dwEffects = CharFormatEffects.CFE_PROTECTED;
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
//}
//public static void SetLink(RichTextBox richTextBox, string type, string text, string link)
//{
// richTextBox.DetectUrls = false;
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
// int position = richTextBox.SelectionStart = richTextBox.TextLength;
// richTextBox.SelectionLength = 0;
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
// richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
// richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_LINK | RTBAPI.CharFormatMasks.CFM_PROTECTED;
// cft.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK | RTBAPI.CharFormatEffects.CFE_PROTECTED;
// // The lines below can be used to allow link text to be edited
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
// //rtbRTF.SetSelectionLink(true);
// richTextBox.SelectionStart = richTextBox.TextLength;
// richTextBox.SelectionLength = 0;
//}
#endregion #endregion
} }
} }
-1
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Volian.Base.Library namespace Volian.Base.Library
+5 -17
View File
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -8,18 +6,8 @@ namespace Volian.Base.Library
{ {
public static class TmpFile public static class TmpFile
{ {
public static string CreateFileName(string procNumber, string sectNumber, string sectTitle) public static string CreateFileName(string procNumber) => FixFileName(procNumber);
{ public static string FixFileName(string name) => $"{Regex.Replace(name, "[ .,/]", "_")}.pdf";
return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle));
}
public static string CreateFileName(string procNumber)
{
return FixFileName(procNumber);
}
public static string FixFileName(string name)
{
return Regex.Replace(name, "[ .,/]", "_") + ".pdf";
}
public static void RemoveAllTmps() public static void RemoveAllTmps()
{ {
RemoveTmpPDFs(); RemoveTmpPDFs();
@@ -41,7 +29,7 @@ namespace Volian.Base.Library
if (fi.LastAccessTime.Ticks < (DateTime.Now.Ticks - TimeSpan.TicksPerHour)) if (fi.LastAccessTime.Ticks < (DateTime.Now.Ticks - TimeSpan.TicksPerHour))
fi.Delete(); fi.Delete();
} }
catch (Exception ex) catch (Exception)
{ {
continue; // if an error, go onto next file. continue; // if an error, go onto next file.
} }
@@ -70,7 +58,7 @@ namespace Volian.Base.Library
if(fi.LastWriteTimeUtc < DateTime.Now.AddDays(-2.0)) if(fi.LastWriteTimeUtc < DateTime.Now.AddDays(-2.0))
fi.Delete(); fi.Delete();
} }
catch (Exception ex) catch (Exception)
{ {
continue; // if an error, go onto next file. continue; // if an error, go onto next file.
} }
@@ -90,7 +78,7 @@ namespace Volian.Base.Library
// it may be open from another process. // it may be open from another process.
fi.Delete(); fi.Delete();
} }
catch (Exception ex) catch (Exception)
{ {
continue; // if an error, go onto next file. continue; // if an error, go onto next file.
} }
+1 -4
View File
@@ -1,8 +1,5 @@
using System; using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
+5 -12
View File
@@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using iTextSharp.text.factories;
using Microsoft.Win32; using Microsoft.Win32;
using System.Text.RegularExpressions;
using System.IO; using System.IO;
using iTextSharp.text; using iTextSharp.text;
@@ -53,7 +47,7 @@ namespace Volian.Base.Library
_MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log _MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log
} }
} }
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + _PromsFontDir); int profileDepth1 = ProfileTimer.Push($">>>> RegisterDirectory {_PromsFontDir}");
//_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug //_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug
iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir); iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir);
ProfileTimer.Pop(profileDepth1); ProfileTimer.Pop(profileDepth1);
@@ -70,7 +64,7 @@ namespace Volian.Base.Library
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, _PromsFontDir); _MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, _PromsFontDir);
if (_PromsFontDir != FontFind.FontDir) if (_PromsFontDir != FontFind.FontDir)
{ {
int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectory " + FontFind.FontDir); int profileDepth2 = ProfileTimer.Push($">>>> RegisterDirectory {FontFind.FontDir}");
//_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug //_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir); iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
ProfileTimer.Pop(profileDepth2); ProfileTimer.Pop(profileDepth2);
@@ -109,9 +103,8 @@ namespace Volian.Base.Library
} }
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
} }
private static RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts"); private static readonly RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts");
public static RegistryKey FontKey public static RegistryKey FontKey => _FontKey;
{ get { return _FontKey; } }
/// <summary> /// <summary>
/// Try to register a particular font, if it fails register the entire font folder /// Try to register a particular font, if it fails register the entire font folder
/// </summary> /// </summary>
@@ -128,7 +121,7 @@ namespace Volian.Base.Library
try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that
// points to a file that no longer exists // points to a file that no longer exists
{ {
FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFind.FontDir + "\\" + fontFile); FontFactory.Register(fontFile.Contains("\\") ? fontFile : $"{FontFind.FontDir}\\{fontFile}");
} }
catch (Exception ex) // catch any exception and add the error to the error log. catch (Exception ex) // catch any exception and add the error to the error log.
{ {
+10 -42
View File
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using System.Configuration; using System.Configuration;
using System.Reflection; using System.Reflection;
@@ -17,24 +15,10 @@ namespace Volian.Base.Library
// <add key ="OperatingMode" value ="Debug"|"Demo"|"Production"/> // <add key ="OperatingMode" value ="Debug"|"Demo"|"Production"/>
// For DataLoader, this is set via the Debug checkbox on the form. // For DataLoader, this is set via the Debug checkbox on the form.
private static bool WasLoaded = false; private static bool WasLoaded = false;
private static bool _DoUpdateRO = true;
public static bool DoUpdateRO public static bool DoUpdateRO { get; set; } = true;
{ public static bool DebugPagination { get; set; } = false;
get { return VlnSettings._DoUpdateRO; } public static bool DebugText { get; set; } = false;
set { VlnSettings._DoUpdateRO = value; }
}
private static bool _DebugPagination = false;
public static bool DebugPagination
{
get { return VlnSettings._DebugPagination; }
set { VlnSettings._DebugPagination = value; }
}
private static bool _DebugText = false;
public static bool DebugText
{
get { return VlnSettings._DebugText; }
set { VlnSettings._DebugText = value; }
}
private static bool _DebugMode = false; private static bool _DebugMode = false;
public static bool DebugMode public static bool DebugMode
{ {
@@ -135,8 +119,7 @@ namespace Volian.Base.Library
{ {
if (parameter.ToUpper().StartsWith("/" + commandName.ToUpper() + "=")) if (parameter.ToUpper().StartsWith("/" + commandName.ToUpper() + "="))
{ {
float result = def; if (float.TryParse(parameter.Substring(commandName.Length + 2), out float result))
if (float.TryParse(parameter.Substring(commandName.Length + 2), out result))
return result; return result;
else else
return def; return def;
@@ -182,7 +165,7 @@ namespace Volian.Base.Library
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder. // This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VEPROMS //XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VEPROMS
//Vista - C:\Users\{user}\AppData\Local\Temp\VEPROMS //Vista - C:\Users\{user}\AppData\Local\Temp\VEPROMS
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp"; _TemporaryFolder = $@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\Temp";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder); if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
_TemporaryFolder += @"\VEPROMS"; _TemporaryFolder += @"\VEPROMS";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder); if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
@@ -190,25 +173,10 @@ namespace Volian.Base.Library
return _TemporaryFolder; return _TemporaryFolder;
} }
} }
private static string _UserID=Environment.UserName.ToUpper();
public static string UserID public static string UserID { get; set; } = Environment.UserName.ToUpper();
{ public static bool StepTypeToolTip { get; set; } = false;
get { return VlnSettings._UserID; } public static bool cbShwRplWrdsColor { get; set; } = false;
set { VlnSettings._UserID = value; }
}
private static bool _StepTypeToolTip = false;
public static bool StepTypeToolTip
{
get { return VlnSettings._StepTypeToolTip; }
set { VlnSettings._StepTypeToolTip = value; }
}
// C2029-025 Show or hide replace words. Can highlight replace words in editor.
private static bool _cbShwRplWrdsColor = false;
public static bool cbShwRplWrdsColor
{
get { return VlnSettings._cbShwRplWrdsColor; }
set { VlnSettings._cbShwRplWrdsColor = value; }
}
private static string _ReleaseMode = null; private static string _ReleaseMode = null;
public static string ReleaseMode public static string ReleaseMode
{ {
+23 -72
View File
@@ -1,26 +1,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
public class VlnTimer public class VlnTimer
{ {
private DateTime _LastTime = DateTime.Now; public DateTime LastTime { get; set; } = DateTime.Now;
public DateTime LastTime public string LastProcess { get; set; } = "Initialize";
{
get { return _LastTime; }
set { _LastTime = value; }
}
private string _LastProcess = "Initialize";
public string LastProcess
{
get { return _LastProcess; }
set { _LastProcess = value; }
}
public string ActiveProcess public string ActiveProcess
{ {
get { return _LastProcess; } get { return LastProcess; }
set set
{ {
DateTime tNow = DateTime.Now; DateTime tNow = DateTime.Now;
@@ -33,12 +22,8 @@ namespace Volian.Base.Library
LastProcess = value; LastProcess = value;
} }
} }
Dictionary<string, TimeSpan> _ElapsedTimes = new Dictionary<string, TimeSpan>();
public Dictionary<string, TimeSpan> ElapsedTimes public Dictionary<string, TimeSpan> ElapsedTimes { get; set; } = new Dictionary<string, TimeSpan>();
{
get { return _ElapsedTimes; }
set { _ElapsedTimes = value; }
}
public void ShowElapsedTimes() public void ShowElapsedTimes()
{ {
ActiveProcess = "fini"; ActiveProcess = "fini";
@@ -54,26 +39,15 @@ namespace Volian.Base.Library
} }
public static class ProfileTimer public static class ProfileTimer
{ {
#pragma warning disable S6669
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static Stack<string> _MyStack = new Stack<string>(); #pragma warning restore S6669
public static Stack<string> MyStack public static Stack<string> MyStack { get; set; } = new Stack<string>();
{ public static DateTime StartTime { get; set; } = DateTime.Now;
get { return _MyStack; }
set { _MyStack = value; }
}
private static DateTime _StartTime = DateTime.Now;
public static DateTime StartTime
{
get { return _StartTime; }
set { _StartTime = value; }
}
delegate int DoPushTrack(string start); delegate int DoPushTrack(string start);
private static DoPushTrack myDoPush = new DoPushTrack(IgnorePush); private static DoPushTrack myDoPush = new DoPushTrack(IgnorePush);
public static int Push(string start) public static int Push(string start) => DoPush(start);
{
return DoPush(start);
}
private static int DoPush(string start) private static int DoPush(string start)
{ {
MyStack.Push(Start); MyStack.Push(Start);
@@ -87,10 +61,7 @@ namespace Volian.Base.Library
} }
delegate int DoPopTrack(int depth); delegate int DoPopTrack(int depth);
private static DoPopTrack myDoPop = new DoPopTrack(IgnorePop); private static DoPopTrack myDoPop = new DoPopTrack(IgnorePop);
public static int Pop(int depth) public static int Pop(int depth) => DoPop(depth);
{
return DoPop(depth);
}
private static int DoPop(int depth) private static int DoPop(int depth)
{ {
if (MyStack.Count != depth) if (MyStack.Count != depth)
@@ -98,28 +69,15 @@ namespace Volian.Base.Library
Start = MyStack.Pop(); Start = MyStack.Pop();
return MyStack.Count; return MyStack.Count;
} }
private static int IgnorePop(int depth) private static int IgnorePop(int depth) => 0;
{ public static int Depth => MyStack.Count;
return 0;
} public static Dictionary<string, long> TimerTable { get; set; } = new Dictionary<string, long>();
public static int Depth
{
get
{
return MyStack.Count;
}
}
private static Dictionary<string, long> _TimerTable = new Dictionary<string, long>();
public static Dictionary<string, long> TimerTable
{
get { return ProfileTimer._TimerTable; }
set { ProfileTimer._TimerTable = value; }
}
delegate void DoTrack(string module); delegate void DoTrack(string module);
private static DoTrack myDoTrack = new DoTrack(IgnoreModule); private static DoTrack myDoTrack = new DoTrack(IgnoreModule);
public static void TurnOnTracking(string filename) public static void TurnOnTracking(string filename)
{ {
DebugProfile.Open(VlnSettings.TemporaryFolder + "\\" + filename); DebugProfile.Open($"{VlnSettings.TemporaryFolder}\\{filename}");
myDoTrack = new DoTrack(TrackModule); myDoTrack = new DoTrack(TrackModule);
myDoPush = new DoPushTrack(DoPush); myDoPush = new DoPushTrack(DoPush);
myDoPop = new DoPopTrack(DoPop); myDoPop = new DoPopTrack(DoPop);
@@ -145,12 +103,9 @@ namespace Volian.Base.Library
//Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description); //Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
AddTimerInfo(_Start, dtNext.Ticks - LastTime.Ticks); AddTimerInfo(_Start, dtNext.Ticks - LastTime.Ticks);
_Start = module; _Start = module;
_LastTime = dtNext; LastTime = dtNext;
}
private static void IgnoreModule(string module)
{
_Start = module;
} }
private static void IgnoreModule(string module) => _Start = module;
private static void AddTimerInfo(string description, long ticks) private static void AddTimerInfo(string description, long ticks)
{ {
if (TimerTable.ContainsKey(description)) if (TimerTable.ContainsKey(description))
@@ -205,16 +160,12 @@ namespace Volian.Base.Library
} }
public static void Reset() public static void Reset()
{ {
_TimerTable = new Dictionary<string, long>(); TimerTable = new Dictionary<string, long>();
_Start = "Start"; _Start = "Start";
_LastTime = DateTime.Now; LastTime = DateTime.Now;
_MyStack = new Stack<string>(); MyStack = new Stack<string>();
}
private static DateTime _LastTime = DateTime.Now;
public static DateTime LastTime
{
get { return _LastTime; }
set { _LastTime = value; }
} }
public static DateTime LastTime { get; set; } = DateTime.Now;
} }
} }
@@ -90,6 +90,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BaseLnSettings.cs" />
<Compile Include="BigNum.cs" /> <Compile Include="BigNum.cs" />
<Compile Include="ByteArrayCompare.cs" /> <Compile Include="ByteArrayCompare.cs" />
<Compile Include="DebugPrint.cs" /> <Compile Include="DebugPrint.cs" />
@@ -104,6 +105,7 @@
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon> <DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GenericSerializer.cs" /> <Compile Include="GenericSerializer.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropGridCollEditor.cs" /> <Compile Include="PropGridCollEditor.cs" />
<Compile Include="RTBAPI.cs" /> <Compile Include="RTBAPI.cs" />
+20 -51
View File
@@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace Volian.Base.Library namespace Volian.Base.Library
{ {
@@ -12,45 +10,16 @@ namespace Volian.Base.Library
/// </summary> /// </summary>
public class VolianTimer public class VolianTimer
{ {
#pragma warning disable S6669
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#pragma warning restore S6669
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
static List<VolianTimer> _Timers = new List<VolianTimer>(); static List<VolianTimer> _Timers = new List<VolianTimer>();
/// <summary>
/// User defined name - should be as specific as possible public string Name { get; set; }
/// Include Method Name, File Name and Line Number public DateTime Start { get; set; }
/// </summary> public long Ticks { get; set; }
private string _Name; public int Count { get; set; }
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/// <summary>
/// Set on open
/// </summary>
private DateTime _Start;
public DateTime Start
{
get { return _Start; }
set { _Start = value; }
}
/// <summary>
/// Calculate on Close
/// </summary>
private long _Ticks;
public long Ticks
{
get { return _Ticks; }
set { _Ticks = value; }
}
/// <summary>
/// Number of times open/close has been run
/// </summary>
private int _Count;
public int Count
{
get { return _Count; }
set { _Count = value; }
}
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
@@ -60,6 +29,18 @@ namespace Volian.Base.Library
Ticks = 0; Ticks = 0;
} }
/// <summary> /// <summary>
/// Constructor with Module and line number
/// </summary>
/// <param name="module">Method Name, File Name</param>
/// <param name="line">Code Line Number</param>
public VolianTimer(string module, int line)
{
Count = 0;
Ticks = 0;
Name = string.Format("{0}:{1}", module, line);
if (TimingsOn) _Timers.Add(this);
}
/// <summary>
/// Command Line Parameter /Timing turns timing on /// Command Line Parameter /Timing turns timing on
/// </summary> /// </summary>
private static bool? _TimingsOn = null; private static bool? _TimingsOn = null;
@@ -73,18 +54,6 @@ namespace Volian.Base.Library
} }
} }
/// <summary> /// <summary>
/// Constructor with Module and line number
/// </summary>
/// <param name="module">Method Name, File Name</param>
/// <param name="line">Code Line Number</param>
public VolianTimer(string module, int line)
{
Count = 0;
Ticks = 0;
Name = string.Format("{0}:{1}", module, line);
if(TimingsOn) _Timers.Add(this);
}
/// <summary>
/// Start Timer /// Start Timer
/// </summary> /// </summary>
public void Open() public void Open()
+2 -6
View File
@@ -1,8 +1,4 @@
using System; using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Text; using System.Drawing.Text;
using System.Windows.Forms; using System.Windows.Forms;
@@ -11,7 +7,7 @@ namespace Volian.Base.Library
public static class vlnFont public static class vlnFont
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static InstalledFontCollection _MyFontCollection = new InstalledFontCollection(); private static readonly InstalledFontCollection _MyFontCollection = new InstalledFontCollection();
private static string _ProportionalSymbolFont = null; private static string _ProportionalSymbolFont = null;
// C2017-036 Look for suitable proportional font that will support the symbol characters used in PROMS // C2017-036 Look for suitable proportional font that will support the symbol characters used in PROMS
// Microsoft removed Arial Unicode MS starting with Word16 (office 365 containing that version of Word) // Microsoft removed Arial Unicode MS starting with Word16 (office 365 containing that version of Word)

Some files were not shown because too many files have changed in this diff Show More