Compare commits
1088 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a46f8b36a0 | |||
| c0453ea1fc | |||
| 41b8f9c962 | |||
| e69175e5c4 | |||
| 76babf4dd3 | |||
| 5d6f53dc58 | |||
| 72a49b7bf2 | |||
| c4230a15c9 | |||
| 84167bbcfc | |||
| 7f154ba1db | |||
| 7abb7e2ef1 | |||
| 04d21ac890 | |||
| a6992874f8 | |||
| 1b2db81dde | |||
| 17e6d23650 | |||
| 2aa1ba537f | |||
| 981ca7629e | |||
| 1aaef3d554 | |||
| 2fd83a4a80 | |||
| fc89dce7c2 | |||
| 62b85a4bbd | |||
| 927d85ea68 | |||
| 89ccf700c3 | |||
| b3c29f2e27 | |||
| 06af63a10a | |||
| 50742e5e4d | |||
| 570c701b93 | |||
| a1c4d53d7c | |||
| 3250b81a23 | |||
| fb914734c8 | |||
| be6eb73671 | |||
| 221a0f8e85 | |||
| d5e5ec8c46 | |||
| b10215aec9 | |||
| ea20f84d91 | |||
| 008e843b39 | |||
| 172dd4f81b | |||
| 4697fb4664 | |||
| c9e6ba972b | |||
| 758f414302 | |||
| 0fb5c04deb | |||
| 47885685fe | |||
| 8e87dddcd2 | |||
| 4649649cf3 | |||
| 68a74be279 | |||
| 483e0757b7 | |||
| 9abce33257 | |||
| 337d4d7288 | |||
| bde0680f81 | |||
| ec579288a8 | |||
| e2c222a156 | |||
| 23de7e3575 | |||
| 18a8f41bf3 | |||
| 63585911a7 | |||
| acafdcc991 | |||
| 9d14f16fe2 | |||
| 89eb93aa67 | |||
| fbfac18ca0 | |||
| 78b2f94bae | |||
| 89f0a401ef | |||
| 0776071454 | |||
| 56fb29fe15 | |||
| d7ed3884d6 | |||
| ba673ccf41 | |||
| 44c1071d49 | |||
| 7789240f64 | |||
| 7eee02dc94 | |||
| 965957aa1b | |||
| 65a3917f62 | |||
| 6ba4a57bbc | |||
| 4e13817509 | |||
| a8330fa2e9 | |||
| be0d444db9 | |||
| ecf3c1ad04 | |||
| 6bf439f493 | |||
| 94b52941af | |||
| a80fb33880 | |||
| 30e4c35165 | |||
| 9bd1214567 | |||
| c28a2bd792 | |||
| 45a7e586c7 | |||
| 5903bab81f | |||
| 295f8f56e3 | |||
| 4cc8af7ff0 | |||
| bca2dde497 | |||
| a8a72159f0 | |||
| 8ea7cb6ac2 | |||
| 2b721b111b | |||
| d7e080a579 | |||
| 6429c242e4 | |||
| aa7b593b65 | |||
| fabac7e2bb | |||
| 9b5ee56a09 | |||
| c78d3d74c2 | |||
| b1459901d0 | |||
| aba56ac340 | |||
| 3d4e1872f1 | |||
| 7a4d33b7da | |||
| afb65eb908 | |||
| df5daeeb75 | |||
| 792779e5b2 | |||
| 3313a0a182 | |||
| 88dd53302f | |||
| e972adfbcb | |||
| ab6425e0d9 | |||
| a81ee5b3db | |||
| fae08a5285 | |||
| eeb4a25d7a | |||
| fdf07180dd | |||
| 6387a6fcda | |||
| a6e400629a | |||
| 8172b7c776 | |||
| ca4d2ac4a2 | |||
| abd9f850eb | |||
| 3aef6f5e05 | |||
| 2f957374e3 | |||
| 3f8cabc7e0 | |||
| 73d1dc8f48 | |||
| 2bfb78a257 | |||
| 783e5c43a5 | |||
| d7e8330016 | |||
| 80d3836e9e | |||
| c26d1c348e | |||
| 95c307cc0b | |||
| 6e7299e445 | |||
| 01fa047591 | |||
| 8c741c1fb7 | |||
| b0bfc8d5ed | |||
| ad8d8f94ff | |||
| c99bd2bb63 | |||
| 468df7dad7 | |||
| 3c2e4a0990 | |||
| 87b717f6a9 | |||
| 51dc45988e | |||
| 2f8b986f1f | |||
| 7f01e7acb6 | |||
| d011d2ba8a | |||
| a922654c17 | |||
| e70a486362 | |||
| 1683bc8418 | |||
| b6368fb0e4 | |||
| ddfa9c2676 | |||
| f3ddd5a11a | |||
| 39e8b2359e | |||
| 4fb73c155b | |||
| 3287603d0a | |||
| 1abb317054 | |||
| 719e37c26b | |||
| 45d2f99fd7 | |||
| f75fdded98 | |||
| 22a6d87771 | |||
| 2479da4bbc | |||
| c22424d798 | |||
| bbb30b7c25 | |||
| 71cbe12cee | |||
| 011effa047 | |||
| b1648dd702 | |||
| 81621cb9d0 | |||
| 3f460d7a5c | |||
| 6fe34c1250 | |||
| d5cac938c2 | |||
| 6222fabdd4 | |||
| 8ed4f25499 | |||
| 3afd4641cd | |||
| e9fde97453 | |||
| 441f8b6e26 | |||
| 8042b917a0 | |||
| 343e7281fe | |||
| c64e6a4554 | |||
| 8190bf275c | |||
| e792f2637d | |||
| 3cd26323dc | |||
| 40e1c4d467 | |||
| 86c22d373a | |||
| cb7a76efc5 | |||
| 545425c4d3 | |||
| eb1aaa10e4 | |||
| daf0db312b | |||
| 8b2bc2f064 | |||
| 2e343cbbf9 | |||
| a75f0470bc | |||
| 287d31a3a9 | |||
| 430fff0515 | |||
| fbbb7b8ad7 | |||
| 54b74d7411 | |||
| 82dba31b2a | |||
| 38d7e782e0 | |||
| 05e5ceeb43 | |||
| fcbbad71d2 | |||
| 6f9161439f | |||
| aa0c4fb841 | |||
| cff50d1f81 | |||
| b8581b6368 | |||
| 094f1223d1 | |||
| 6802476afa | |||
| a0539dce9b | |||
| bf2b8fec35 | |||
| 082c9a03ec | |||
| 4ccdd862ba | |||
| e5a20ed0fc | |||
| a72022704e | |||
| 2acc7ada30 | |||
| e61882c331 | |||
| 61c145689a | |||
| 40ea9664a7 | |||
| bccd2d0f3e | |||
| b918809dca | |||
| e7c2e92879 | |||
| cf03c921a7 | |||
| 2c45c839b1 | |||
| 83f5fc58d1 | |||
| 1a267f1e5a | |||
| c3fd5551d8 | |||
| 1baa74bb69 | |||
| 261ecefb17 | |||
| d81d8f7c5d | |||
| de1af12157 | |||
| 803cbbdee9 | |||
| 008477d5fa | |||
| 7f0d29ebd2 | |||
| 11bf8cffb2 | |||
| 87b9ebc7e1 | |||
| b89d27411b | |||
| 24c37f1d3e | |||
| 58b0a0a3be | |||
| ed58873a82 | |||
| a8dcbd4af0 | |||
| 4b2f29442a | |||
| dfab0d7ddf | |||
| ce1998b701 | |||
| 92c631d6ce | |||
| 01009f9e35 | |||
| 74eca093da | |||
| e7d89e65b2 | |||
| 24b2bffe8e | |||
| d2906476c8 | |||
| 2b31a355ae | |||
| b602048186 | |||
| 4fb7031060 | |||
| 4ef77c2e72 | |||
| 72ba1a9f58 | |||
| 0c3938b652 | |||
| 16f80adb0d | |||
| 637b6bb4f9 | |||
| 12e91927a5 | |||
| 8f6f22ba7f | |||
| b520d6a334 | |||
| b7bff30445 | |||
| 0d790bbd80 | |||
| 8394e99127 | |||
| 16ae32bfd7 | |||
| cc6423e384 | |||
| 06cc587599 | |||
| 9d36088f1d | |||
| f9f73b015c | |||
| 77ffd696bb | |||
| bdb8bed053 | |||
| 4b17c8e96e | |||
| 8109711f4e | |||
| 327eba3fa7 | |||
| f3dccb2e99 | |||
| 7112d58e7c | |||
| 6e0aad853c | |||
| c64b1d0846 | |||
| 6eba16ce99 | |||
| 2f6f719843 | |||
| f34bac49e4 | |||
| 39cdc6231f | |||
| 745e24da70 | |||
| a4f4f4fb15 | |||
| 3833c229c6 | |||
| 3dc3e9b5a8 | |||
| 12eeb79e9f | |||
| e08c84f70d | |||
| 10f55d5b65 | |||
| 761992d089 | |||
| 991a823700 | |||
| 61dbcf762c | |||
| 60b0149a9c | |||
| 501c034cfa | |||
| 11593db23c | |||
| a9ae2a004f | |||
| 7b2a31781c | |||
| ab73eb9632 | |||
| 8ade170b4e | |||
| 91c3d1161d | |||
| bb63805e87 | |||
| 8caf04990c | |||
| f28dd0a965 | |||
| b5d83268e5 | |||
| 19adc42122 | |||
| 8afee913be | |||
| 82d101365f | |||
| 73e679f268 | |||
| 372a8a1de1 | |||
| 171cc34c91 | |||
| fbd217d674 | |||
| f24960ab26 | |||
| d1a871c8f6 | |||
| 086b97906b | |||
| db76a11347 | |||
| 729b10cce8 | |||
| 4cbd25ccb3 | |||
| 0ef7b738a9 | |||
| 33b5563601 | |||
| f6f799f534 | |||
| 8c3f1360e1 | |||
| fafbabd603 | |||
| 254e38895c | |||
| aa0bb22cdd | |||
| 5bfd0c7b2f | |||
| c3885c170c | |||
| 88a7cce269 | |||
| a1fccc2905 | |||
| a889041896 | |||
| 8d778aba2c | |||
| ba5db63e0b | |||
| 0259d83429 | |||
| b6999e57ae | |||
| 04184cf731 | |||
| 04f98eb9e7 | |||
| 869dd045af | |||
| 339ebb862e | |||
| 7b8598bf9f | |||
| ab1c460225 | |||
| 298164d6ed | |||
| 703a8a4e0d | |||
| deaf5fcbf6 | |||
| 18b46689f1 | |||
| edbe3f8311 | |||
| 94c4c3e2d4 | |||
| 077f72737d | |||
| ae089a9390 | |||
| 0f087c2aa6 | |||
| 19d2ffb48e | |||
| a9bb6f73de | |||
| ca124732fa | |||
| 11da14aeab | |||
| 7d5f037c85 | |||
| f62b415227 | |||
| f2b8d4014e | |||
| 3ef047fb41 | |||
| aa3be4ab0d | |||
| 7500049ea2 | |||
| 44600df75c | |||
| dec2a15773 | |||
| 4da78a04cb | |||
| 98ec204bab | |||
| cd9499b064 | |||
| f5e824be86 | |||
| c76254f4f9 | |||
| 77ac6f88ca | |||
| 7e10911991 | |||
| 161b67b09d | |||
| 9614536a29 | |||
| 8ba7aab468 | |||
| 4ea9f79de1 | |||
| b7f7025d97 | |||
| 20d5dd2668 | |||
| adc2d02fbb | |||
| ef2dbdc93b | |||
| 9721ec1f0b | |||
| 4d069d87d7 | |||
| 0308f9ce65 | |||
| 6bcd3cb217 | |||
| 7f83c490db | |||
| bbf9c895b8 | |||
| ffa2063c52 | |||
| d464b1f78e | |||
| 92cb071408 | |||
| 9141b60d03 | |||
| df0a196931 | |||
| a8cb1dd495 | |||
| adc4966d49 | |||
| 1b2ea8c522 | |||
| 7c8bdb489b | |||
| 16458fbb42 | |||
| c72839cdcb | |||
| a31ad5803c | |||
| cf800cbd36 | |||
| 3c06ef0b1a | |||
| 2c3b921f09 | |||
| 402ecc66ae | |||
| e25f56a9b5 | |||
| b28fa887a2 | |||
| f83a02e619 | |||
| eaad089d68 | |||
| a2fda16df9 | |||
| e9e8ff57ae | |||
| 1fd95a2f2e | |||
| 228584ee48 | |||
| c651df0f6e | |||
| 5cced9baf2 | |||
| 5dd26e554b | |||
| 696fd3e8cd | |||
| 1d19b705d3 | |||
| d54074cb57 | |||
| cc054aeb75 | |||
| c32eaed534 | |||
| fa23f73ec4 | |||
| fbf6a13f92 | |||
| 3eba662772 | |||
| e007ee271f | |||
| 59a8d65a89 | |||
| 793519ae1b | |||
| 5c44062aa2 | |||
| fe03a2c2c0 | |||
| d1d74a3770 | |||
| 16108bf779 | |||
| 5bebf077e4 | |||
| efcc01ad6b | |||
| e8a4b45446 | |||
| 6cba297d77 | |||
| b149dc3cb9 | |||
| 1ee4f934b9 | |||
| f7b4adb85d | |||
| da3c41567d | |||
| 5f73795220 | |||
| 36bf1122c6 | |||
| 402f8bb9f9 | |||
| eef2a915fa | |||
| 26ee4d172f | |||
| 08eb450446 | |||
| ecae7d818c | |||
| 47ffccff68 | |||
| 0ba5286c94 | |||
| db8e1e3589 | |||
| d0764a6a77 | |||
| 7b6c347d6b | |||
| d58fec180c | |||
| ac4e4877a1 | |||
| ddea61245d | |||
| 98915bcff2 | |||
| 8e0f0450df | |||
| 1d9a669829 | |||
| 97bcf168b7 | |||
| e81198165b | |||
| b03b8da586 | |||
| d497e07187 | |||
| f284a99194 | |||
| 7d6dd6f805 | |||
| d70e28d198 | |||
| 4c6f138e5c | |||
| 5974841a7b | |||
| 5df54439ba | |||
| 8f627c6b7f | |||
| 3f28bc5c6c | |||
| 903fa699ca | |||
| d9e8f64699 | |||
| 8ad6ca8d41 | |||
| 4017efc65e | |||
| 6ed15d52de | |||
| 5246a2f79b | |||
| b670932dd7 | |||
| ddf30bd96b | |||
| 7e92428485 | |||
| 4c16050c85 | |||
| 2ed035525a | |||
| 1b89b0d7b6 | |||
| 0364821f0b | |||
| fa9d6f37ae | |||
| a4777904b9 | |||
| 0b3c2f95c5 | |||
| 8f54955432 | |||
| 034db2fc27 | |||
| 59141b0241 | |||
| 2e43b96a2c | |||
| edff96299c | |||
| 8d9587b790 | |||
| ad0cf2a849 | |||
| f928946c61 | |||
| 6cc9d0bee2 | |||
| 287e6bb91f | |||
| 3509036d85 | |||
| 752901dbb9 | |||
| e3add94546 | |||
| 8d31c74b39 | |||
| e6f608d206 | |||
| d80b9e29a7 | |||
| 092674465d | |||
| b2e3a5bb18 | |||
| 147a2f957e | |||
| ce56f2919c | |||
| 18059102a3 | |||
| 4542fcccbb | |||
| d12009d30c | |||
| d85e0fbd13 | |||
| f7a5f9ae6b | |||
| 3d4c3d0acc | |||
| c106c41048 | |||
| cea777e8b2 | |||
| 6f069b73da | |||
| c80af8c984 | |||
| d51cbd0682 | |||
| 7e94c945ff | |||
| bd9095b4c2 | |||
| c135bf8fb8 | |||
| f6aebb15b4 | |||
| 2b4f88becd | |||
| 7fbd3639b6 | |||
| 9e52c2c31d | |||
| 46a1e5ff14 | |||
| fa7c1fd646 | |||
| c347809eea | |||
| dd09a42f02 | |||
| db8ffd05ea | |||
| 045c29ca20 | |||
| 4ea6d19602 | |||
| df00447c41 | |||
| db5b1caea7 | |||
| 8432954b8d | |||
| 4a000e23e9 | |||
| b42db51346 | |||
| 1ef968ea93 | |||
| 5b50537333 | |||
| 8c624b48fb | |||
| ad329fc2c8 | |||
| f045b8f659 | |||
| 00a9da45bb | |||
| b7ecd12f8c | |||
| a8a3164ee7 | |||
| b1aec69e98 | |||
| d713a8c5a4 | |||
| 3895faf941 | |||
| bf336fdb10 | |||
| c96c26288c | |||
| 83558c089d | |||
| 26acb72e17 | |||
| 4724a432ab | |||
| 5b9c1627c0 | |||
| d06c2585cf | |||
| 3e96e51efd | |||
| 9afa7191c4 | |||
| dfddec5586 | |||
| 93022424b3 | |||
| aed77a187f | |||
| 583f47c98b | |||
| ff528b3f9d | |||
| 6d98d96ccb | |||
| 6f8e08c21a | |||
| 3a7417f493 | |||
| 66164a0c33 | |||
| 0d7a478e16 | |||
| 9caef310df | |||
| 688f742c16 | |||
| 38dd083cdc | |||
| 851bd1c3c6 | |||
| c91b8a1a7a | |||
| 69c45764b2 | |||
| 07a62d2f78 | |||
| 46b064b0a8 | |||
| 1d3b96bb65 | |||
| 916425b7f5 | |||
| 1c570ca242 | |||
| ae41108971 | |||
| 395e7609a4 | |||
| 185c9dc284 | |||
| a9b0ac0595 | |||
| d9e3524211 | |||
| f40ef15a24 | |||
| 4d7544eefb | |||
| 92bb458345 | |||
| 92e695ef7c | |||
| 45ff3fbb9b | |||
| ba252e92d3 | |||
| 4778f459e3 | |||
| c997854ae0 | |||
| 65b5322ad5 | |||
| dd43bf0476 | |||
| 15c808eebd | |||
| 28748a99ca | |||
| fb37d3b9e6 | |||
| e1f10e054c | |||
| c670357c01 | |||
| 92dce9b36e | |||
| aa2b62e8da | |||
| a34a65f354 | |||
| eea5f8496c | |||
| 091a256bcc | |||
| 14c9ce3ce1 | |||
| fd1e5e13fe | |||
| 19685b8f95 | |||
| a9da8dc10c | |||
| fcfba7a978 | |||
| 2c8c4351dd | |||
| 79264b187d | |||
| 52eba9117b | |||
| 37a69032f6 | |||
| dd16b4f5a1 | |||
| e9c20255a6 | |||
| 630b4edf91 | |||
| 04ef638e17 | |||
| 35bad240c2 | |||
| 0cb4749cf3 | |||
| 7c8281eb00 | |||
| 1957288219 | |||
| c4d2b15c48 | |||
| beebfb0dae | |||
| d67172b795 | |||
| 2b012bc042 | |||
| 84da68f950 | |||
| ad97fd13bf | |||
| ebf6d0d5f7 | |||
| 0f3b4b4384 | |||
| 226cf46d6b | |||
| 5689e33541 | |||
| 15e59e7117 | |||
| 6b538f6662 | |||
| ad6808b696 | |||
| 8347b18efc | |||
| f92b132f0a | |||
| 79057d6757 | |||
| a9b5ee8f62 | |||
| 65da2c449e | |||
| 0ef8c12650 | |||
| 1dfa48aecb | |||
| b5d1713b43 | |||
| 102421997d | |||
| 43370bb8d1 | |||
| 310f50fcde | |||
| 9b5d157333 | |||
| 53fbb7a0bd | |||
| fe92117c4e | |||
| 4a0d13457a | |||
| 1ad6405003 | |||
| 75e7e36011 | |||
| 933c695b8c | |||
| b34f7142f6 | |||
| 7392fa8165 | |||
| 349d417869 | |||
| b8e94cac9c | |||
| cd90490b8d | |||
| a9cc94ccb6 | |||
| 17f137af09 | |||
| ea7d0bbf71 | |||
| 176f1cf405 | |||
| 2ee93bbcc1 | |||
| ba0629000e | |||
| 313049f873 | |||
| d1a1b17d29 | |||
| eb91d2ce0a | |||
| 71c77da898 | |||
| 1b96c70386 | |||
| 703cecbd4f | |||
| e20bf41cc7 | |||
| 0f7b9524f9 | |||
| 53a9e901ec | |||
| 9a79fc71ed | |||
| e7f7a8038f | |||
| 5361f8ae6f | |||
| ec3bcddc9d | |||
| 326a9f1d75 | |||
| 8c07e9b8a3 | |||
| 406d01febf | |||
| 98663422b1 | |||
| 879dfcea28 | |||
| 40edb4c8de | |||
| 07b6d142ad | |||
| 5716b3e3cf | |||
| 1b242a07e1 | |||
| 1516a73228 | |||
| eef00eb28f | |||
| a5ac282ab6 | |||
| dbb88d4999 | |||
| 39addad3a1 | |||
| 87fd9a4470 | |||
| 7a9156449f | |||
| 6e2938e9c1 | |||
| 39e1498b26 | |||
| cc2dc9c1a7 | |||
| fa87198131 | |||
| 9b70b952f6 | |||
| b29fca1cdb | |||
| 501af800ce | |||
| 979be117c6 | |||
| 13594371bb | |||
| 9628d1b27f | |||
| fd0bd0b343 | |||
| 9ea58bfdad | |||
| c54d140107 | |||
| 98d4a4213c | |||
| a7d1de5ee3 | |||
| fab9e4b265 | |||
| d5fa46033e | |||
| 32c179bbf9 | |||
| 99f9886876 | |||
| c1fcaff28a | |||
| 2da5e8d71b | |||
| e80e64a287 | |||
| 0344e51ef7 | |||
| 9fd31b0584 | |||
| c6a48f79da | |||
| 110d050cc6 | |||
| 18188ef235 | |||
| 3e1c397132 | |||
| cda1f0b77d | |||
| afd49f154c | |||
| 505c620103 | |||
| 5d9e340d6d | |||
| f705c4575c | |||
| 1508bd806f | |||
| 1c542e0615 | |||
| ed5bcbde18 | |||
| 084cbcd362 | |||
| ad8369cfe9 | |||
| 7d36b3993e | |||
| ead0854c8e | |||
| 60b5655574 | |||
| 9037630990 | |||
| ba23fc9506 | |||
| 938ca7c0ea | |||
| a034f7a9a0 | |||
| d4c4fcfd74 | |||
| 5b457f2a8a | |||
| adc22441fc | |||
| 1ba59136c6 | |||
| 77702b2ac9 | |||
| 0d6c814908 | |||
| 42ce58db60 | |||
| 1ef56033fb | |||
| 8c1d3c0248 | |||
| a725a12d25 | |||
| f67db9beed | |||
| f22fd7b5d1 | |||
| 060664260b | |||
| 9da5ec7413 | |||
| 076240f7cd | |||
| d97a4ad243 | |||
| 56209d8491 | |||
| 61fe7197f5 | |||
| 1881bfd69e | |||
| 4287b7def5 | |||
| 27d683a7cc | |||
| 38902c8f88 | |||
| d8e8142ff4 | |||
| fdaf9cb3ef | |||
| b2fe091c88 | |||
| 8548244cef | |||
| 91a5881600 | |||
| 93fd043b14 | |||
| 47948ef530 | |||
| 61fa618673 | |||
| 545aecc6ae | |||
| ee41f53286 | |||
| cc8036f736 | |||
| 67a982e6e4 | |||
| b16000f8e5 | |||
| a142ce0542 | |||
| c87b8b65fc | |||
| 7332df1d56 | |||
| de90c17ab1 | |||
| 3d54edf25b | |||
| 111819dbf3 | |||
| 3665753ba2 | |||
| 75e38aa8f3 | |||
| 29dc6938c3 | |||
| 304933b02b | |||
| 49f268bb62 | |||
| d0793c546d | |||
| 375aec6f6c | |||
| 12ec527dcd | |||
| 52d95173d7 | |||
| 67e3d51106 | |||
| 9081aea926 | |||
| 02c6caf465 | |||
| 1a9ddf1969 | |||
| 41bcae9d05 | |||
| 28109a0c97 | |||
| d8825f0a73 | |||
| 82c045a243 | |||
| 4d11f69282 | |||
| 664e4ea048 | |||
| 6d21c5e24e | |||
| ba21b6884d | |||
| 60065aab3e | |||
| 4d978936ac | |||
| 4ea585633b | |||
| dee0bd7f4d | |||
| edb206ffa5 | |||
| 21932056f3 | |||
| 0c3809b789 | |||
| d5ae596ad6 | |||
| 42db7e60f2 | |||
| 85827820a4 | |||
| fad2571edb | |||
| c53b6de68c | |||
| c86eb12168 | |||
| fb31f8df11 | |||
| 147b4fc5ed | |||
| cdcb2d2af0 | |||
| ff086e497c | |||
| a2b711da05 | |||
| 40ecfbefa3 | |||
| 2097a1250b | |||
| 22025f9b00 | |||
| 80c1badba5 | |||
| be308ba280 | |||
| fa7f3d44e4 | |||
| 9bb00489fe | |||
| 33948c604c | |||
| b8fe5bbd66 | |||
| 3fcc01c253 | |||
| 658d48c17b | |||
| 8d76c014c8 | |||
| 26cd125534 | |||
| 1bc23af61a | |||
| a2aa6b48a8 | |||
| 5784c974f7 | |||
| 80503dc42e | |||
| d76195f7ae | |||
| 2fe482b802 | |||
| 16283f4643 | |||
| cd7a801400 | |||
| f6d8558d07 | |||
| de20b506f0 | |||
| ea1d52292e | |||
| 463e506ca3 | |||
| 3bae64a2c7 | |||
| 5d13c8b543 | |||
| c6c0789794 | |||
| d7df39290f | |||
| b64cefad46 | |||
| 4690ab3c30 | |||
| b61c7490b3 | |||
| 9e511d29a6 | |||
| a9cdc36967 | |||
| 96c51cd7ff | |||
| 636769c0ef | |||
| 7beb2a3cc5 | |||
| 52d318054c | |||
| 5ee2ad6f3d | |||
| 097d414d0d | |||
| e0ce119374 | |||
| da9a5242cb | |||
| 0211b38be9 | |||
| 512e9b21cd | |||
| 9181ad55ae | |||
| a1cb9e1b28 | |||
| ea09a3e798 | |||
| 21fa146f6f | |||
| 1a3130041f | |||
| 7095a5890c | |||
| 4a86d1aa05 | |||
| 19fe7223fb | |||
| 8867fde3f2 | |||
| 588d1822b1 | |||
| d2b3b38d9e | |||
| 206ae3d9ed | |||
| a67b7a2fd0 | |||
| f5a08b225c | |||
| c807f97c29 | |||
| 8382413137 | |||
| c6acafd3a6 | |||
| 9d43056361 | |||
| 52f8e24954 | |||
| dac05fec84 | |||
| cb4ed77572 | |||
| 3427cbdc2e | |||
| ec0fb0c3cf | |||
| 357983179c | |||
| 78b66c141e | |||
| 3ac88bb400 | |||
| 27493b857c | |||
| e5a976abcf | |||
| 9e89bf5303 | |||
| 54eb330711 | |||
| e9014c6f5d | |||
| 620bcf6fab | |||
| c03bbd9e13 | |||
| b428b4ec5b | |||
| 876cc116ea | |||
| 0ba00c08ef | |||
| d41ecd9d55 | |||
| 35d351ce6b | |||
| 5d3af58361 | |||
| 8554b92f42 | |||
| 76363b4263 | |||
| b4250b9161 | |||
| 441f40886f | |||
| e8e8ad5d63 | |||
| 454078ec82 | |||
| 63f29c2686 | |||
| 280445f613 | |||
| d7f6433b53 | |||
| 22da4cc408 | |||
| 4e185ef584 | |||
| fd9b4b4ba6 | |||
| 2f79bbcb0f | |||
| 2c70d243df | |||
| 7710b77255 | |||
| d1eed23399 | |||
| ff9ce4df44 | |||
| b7c52842f2 | |||
| 365459f649 | |||
| e6354f724f | |||
| 14eedca939 | |||
| 83529cfe09 | |||
| bd4e1c1810 | |||
| 5665fcc823 | |||
| 710a9014dd | |||
| 108c6b2b17 | |||
| 70735943c3 | |||
| d01a24f879 | |||
| ec2d5043ff | |||
| 15082c2c52 | |||
| 44278d68b4 | |||
| 40eeb9db66 | |||
| a5eb1dfca7 | |||
| 8719677f11 | |||
| 8f01b6c5fe | |||
| 9e63a3f49b | |||
| 84edb7bbe6 | |||
| c86ce00a17 | |||
| aba6c18a25 | |||
| 62c81e6d44 | |||
| 68ea323855 | |||
| f94d81ad20 | |||
| 063f8b1751 | |||
| 35cfd26ece | |||
| f331cb1b4d | |||
| 502e205071 | |||
| 975b563b8d | |||
| cc88630859 | |||
| cce0b930ec | |||
| 723c825df2 | |||
| 5b4c966354 | |||
| 69023f98d9 | |||
| dce5722e96 | |||
| cbdbc93274 | |||
| 042b153684 | |||
| 4054423721 | |||
| 2e63a6eaca | |||
| 9eca7eb2ee | |||
| 1489fb645e | |||
| 5c0ca841d7 | |||
| a4d3d3ff9c | |||
| c3b67f4a4b | |||
| cde5daf19a | |||
| 904b2c0988 | |||
| f9907e2ec6 | |||
| 7329c0097c | |||
| 0478949305 | |||
| 34172a54fe | |||
| 6dd629eda5 | |||
| 636dd2b8d5 | |||
| b20dbc5202 | |||
| ee45104eb9 | |||
| 152be89860 | |||
| 6b5a375542 | |||
| 03d049846d | |||
| 6ed084bb94 | |||
| f5332b63a9 | |||
| 87356215c3 | |||
| 07c7acc37a | |||
| 4a6d9dee67 | |||
| 52eb93e59c | |||
| 2245a018e6 | |||
| 8b327fd715 | |||
| 7a7289a4c8 | |||
| ceb259819f | |||
| fdfbaedbd7 | |||
| 9591fbf146 | |||
| b2a09dbf6d | |||
| 11a5a7fdbe | |||
| 745b798d89 | |||
| 7bac32e3c4 | |||
| 880ca08571 | |||
| 85d4d8a71e | |||
| abb8ed0bcc | |||
| bea0d10a6c | |||
| 80d943af23 | |||
| 90b85e469d | |||
| 0d419c1323 | |||
| f7a2ecc2e0 | |||
| 5fdbf83f32 | |||
| c513ad9291 | |||
| a2dfa55dbd | |||
| 78f8d9a271 | |||
| b25a5aac8c | |||
| 25cc70035e | |||
| e5d70d5a0e | |||
| 066b0d1f8a | |||
| 71b2e56187 | |||
| 457832fbbe | |||
| 00554e066b | |||
| 9f9775e585 | |||
| 9cf70ae74e | |||
| 4f046987c6 | |||
| 699666c23b | |||
| 6a8cdd0155 | |||
| ce61f0e2b7 | |||
| b3cb0bf93f | |||
| 07328eea2d | |||
| 5f7a6f2e07 | |||
| 39d54cc493 | |||
| d31f40408b | |||
| 7f88d9ae27 | |||
| 1c1dd81474 | |||
| 53a498c581 | |||
| bfb6346812 | |||
| bd2fa1e427 | |||
| 6c4bfeff29 | |||
| 299a77eea8 | |||
| 351a00fb1e | |||
| 2140e1ebe1 | |||
| 497a820ba2 | |||
| 7182f3554a | |||
| 506ba52502 | |||
| 90c1630af4 | |||
| 5934abd448 | |||
| 86f432ef01 | |||
| 4913019c5c | |||
| a6316797e6 | |||
| 00d7549bde | |||
| 8fc33f5649 | |||
| 729b544675 | |||
| 865415a6c0 | |||
| 32e8324275 | |||
| 842f6dd726 | |||
| 59f7d11df3 | |||
| dcd2f52c59 | |||
| b45413c232 | |||
| b4481ff680 | |||
| d7d7a3919f | |||
| f8e4732dcd | |||
| 1b92ed66b7 | |||
| 9ba74b9504 | |||
| 8cd49f12d1 | |||
| c48ca9ee89 | |||
| 43bcf71bf5 | |||
| ee48813df1 | |||
| f4a67e2822 | |||
| f03733da04 | |||
| 207560bcc7 | |||
| f38313ff2c | |||
| b5d9e21f37 | |||
| 5d42a8957e | |||
| b276c60909 | |||
| d03564bce9 | |||
| 41409c39d5 | |||
| aa9c5107d0 | |||
| 7a141822e7 | |||
| a4fd301d5a | |||
| b2ef8b96ef | |||
| baa9e1003e | |||
| 5d17a586d5 | |||
| 36b97b2adc | |||
| f13bffa834 | |||
| 4394566ed3 | |||
| de95c24f66 | |||
| 6058cb9cff | |||
| 6b20d3e268 | |||
| ce037a437a | |||
| 1349dab6d4 | |||
| d3d31925ee | |||
| d9fa77c86b | |||
| dad01235b0 | |||
| 52d9c26076 | |||
| 1a0236237d | |||
| 58bb7a5ebc | |||
| efbab58bca | |||
| eedbc7a863 | |||
| 626cda63ff | |||
| 7b7a9d93aa | |||
| f5c68dac61 | |||
| 2b6b106771 | |||
| 047586883e | |||
| 0c1a25dd6b | |||
| 7840a9a713 | |||
| 28f96ffcd3 | |||
| 04b2663183 | |||
| 1a11027871 | |||
| 854a00803e | |||
| 11ae5f157f | |||
| ecfe05139e | |||
| 4a392e03a7 | |||
| a66037f886 | |||
| 58c399dcbe | |||
| f33e617f44 | |||
| 3e976c1026 | |||
| c15c75075c | |||
| bf8d988c75 | |||
| 6fb7af3d46 | |||
| 1c2860c180 | |||
| fc41f10c37 | |||
| dedf366866 | |||
| edb10096d6 | |||
| ba42a1e6c9 |
+85
-10
@@ -16,16 +16,8 @@
|
|||||||
"contributions": [
|
"contributions": [
|
||||||
"maintenance",
|
"maintenance",
|
||||||
"doc",
|
"doc",
|
||||||
"code"
|
"code",
|
||||||
]
|
"design"
|
||||||
},
|
|
||||||
{
|
|
||||||
"login": "Hydro11451",
|
|
||||||
"name": "Hydrogen",
|
|
||||||
"avatar_url": "https://avatars.githubusercontent.com/u/214308559?v=4",
|
|
||||||
"profile": "http://hydro11451.qzz.io",
|
|
||||||
"contributions": [
|
|
||||||
"code"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -36,6 +28,89 @@
|
|||||||
"contributions": [
|
"contributions": [
|
||||||
"code"
|
"code"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "2-2-3-trimethylpentane",
|
||||||
|
"name": "2,2,3-三甲基戊烷",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/141403762?v=4",
|
||||||
|
"profile": "https://github.com/2-2-3-trimethylpentane",
|
||||||
|
"contributions": [
|
||||||
|
"blog",
|
||||||
|
"doc",
|
||||||
|
"design",
|
||||||
|
"test",
|
||||||
|
"tutorial",
|
||||||
|
"video"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Alan-CRL",
|
||||||
|
"name": "Alan-CRL",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/92425617?v=4",
|
||||||
|
"profile": "https://github.com/Alan-CRL",
|
||||||
|
"contributions": [
|
||||||
|
"code",
|
||||||
|
"infra",
|
||||||
|
"doc",
|
||||||
|
"financial"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "MKStoler1024",
|
||||||
|
"name": "MKStoler1024",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/158786854?v=4",
|
||||||
|
"profile": "https://github.com/MKStoler1024",
|
||||||
|
"contributions": [
|
||||||
|
"doc",
|
||||||
|
"code",
|
||||||
|
"design"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "awesome-iwb",
|
||||||
|
"name": "Awesome Iwb",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/184760810?v=4",
|
||||||
|
"profile": "https://github.com/awesome-iwb",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "PrefacedCorg",
|
||||||
|
"name": "PrefacedCorg",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/129855423?v=4",
|
||||||
|
"profile": "https://github.com/PrefacedCorg",
|
||||||
|
"contributions": [
|
||||||
|
"code",
|
||||||
|
"design"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Jursin",
|
||||||
|
"name": "Jursin",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/127487914?v=4",
|
||||||
|
"profile": "http://blog.jursin.top",
|
||||||
|
"contributions": [
|
||||||
|
"design"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Tayasui-rainnya",
|
||||||
|
"name": "tayasui rainnya!",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/156585442?v=4",
|
||||||
|
"profile": "https://github.com/Tayasui-rainnya",
|
||||||
|
"contributions": [
|
||||||
|
"design"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "doudou0720",
|
||||||
|
"name": "doudou0720",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/98651603?v=4",
|
||||||
|
"profile": "https://github.com/doudou0720",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,14 +39,14 @@ body:
|
|||||||
2.
|
2.
|
||||||
3.
|
3.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: expected
|
id: expected
|
||||||
attributes:
|
attributes:
|
||||||
label: 期望结果 | Expected Behavior
|
label: 期望结果 | Expected Behavior
|
||||||
description: 你期望的正确行为或结果 | What did you expect to happen?
|
description: 你期望的正确行为或结果 | What did you expect to happen?
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: extra
|
id: extra
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ body:
|
|||||||
label: 需求动机 | Motivation
|
label: 需求动机 | Motivation
|
||||||
description: 为什么需要这个功能?| Why do you need this feature?
|
description: 为什么需要这个功能?| Why do you need this feature?
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: design
|
id: design
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -1,35 +1,399 @@
|
|||||||
name: .NET Build
|
name: .NET Build & PR Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main,beta ]
|
branches: [ main, beta ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
branches: [ main, beta ]
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- 'docs/**'
|
||||||
|
- 'Images/**'
|
||||||
|
- 'Manual.md'
|
||||||
|
- 'README.md'
|
||||||
|
- 'UpdateLog.md'
|
||||||
|
- 'CODE_OF_CONDUCT.md'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'privacy.txt'
|
||||||
|
- 'icc.png'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-${{ github.head_ref || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
find-or-create-pr-comment:
|
||||||
build:
|
name: Find or Create PR Comment
|
||||||
runs-on: windows-latest
|
if: github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
outputs:
|
||||||
|
comment_id: ${{ steps.find-comment.outputs.comment_id }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- name: Find existing bot comment
|
||||||
|
id: find-comment
|
||||||
|
run: |
|
||||||
|
# 查找包含特定标记的现有评论
|
||||||
|
COMMENTS=$(gh api \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
"/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
|
||||||
|
--jq '.[] | select(.body | contains("<!-- github-action-pr-build -->")) | .id' | head -1)
|
||||||
|
|
||||||
|
if [ -n "$COMMENTS" ]; then
|
||||||
|
echo "📝 找到现有评论 ID: $COMMENTS"
|
||||||
|
echo "comment_id=$COMMENTS" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "📝 未找到现有评论,将创建新评论"
|
||||||
|
echo "comment_id=" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
- name: Setup MSbuild
|
pr-preview-comment:
|
||||||
uses: microsoft/setup-msbuild@v2
|
name: PR Preview (Building)
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
- name: Setup NuGet
|
runs-on: ubuntu-latest
|
||||||
uses: NuGet/setup-nuget@v2.0.1
|
needs: find-or-create-pr-comment
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
outputs:
|
||||||
|
comment_id: ${{ steps.create-preview-comment.outputs.comment-id || '' }}
|
||||||
|
steps:
|
||||||
|
- name: Prepare Preview Comment
|
||||||
|
id: prepare-preview
|
||||||
|
env:
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
GH_RUN_ID: ${{ github.run_id }}
|
||||||
|
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||||
|
IS_READY_FOR_REVIEW: ${{ github.event.action == 'ready_for_review' }}
|
||||||
|
run: |
|
||||||
|
# 构建预览评论内容
|
||||||
|
{
|
||||||
|
if [ "$IS_READY_FOR_REVIEW" = "true" ]; then
|
||||||
|
echo "# 🚀 PR 准备审查 - 构建预览"
|
||||||
|
echo ""
|
||||||
|
echo "**状态:** 🟡 正在构建(准备审查状态)..."
|
||||||
|
else
|
||||||
|
echo "# 🏗️ PR 构建预览"
|
||||||
|
echo ""
|
||||||
|
echo "**状态:** 🟡 正在构建..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "**分支提交:** \`$PR_HEAD_SHA\`"
|
||||||
|
echo "**操作:** [查看运行详情](https://github.com/$GH_REPO/actions/runs/$GH_RUN_ID)"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ "$IS_READY_FOR_REVIEW" = "true" ]; then
|
||||||
|
echo "> 📋 此 PR 已标记为 **准备审查**,正在进行构建验证"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "---"
|
||||||
|
echo "<!-- github-action-pr-build -->"
|
||||||
|
echo "<!-- build-id: $GH_RUN_ID -->"
|
||||||
|
echo "<!-- event-type: ${{ github.event.action }} -->"
|
||||||
|
echo "<!-- pr-head-sha: $PR_HEAD_SHA -->"
|
||||||
|
echo "<!-- merge-sha: ${{ github.sha }} -->"
|
||||||
|
echo ""
|
||||||
|
echo "🤖 构建完成后,状态将自动更新"
|
||||||
|
} > preview_comment.txt
|
||||||
|
|
||||||
|
preview_content=$(cat preview_comment.txt)
|
||||||
|
echo "preview_body<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$preview_content" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Restore NuGet Packages
|
- name: Post/Update Preview Comment
|
||||||
run: nuget restore "Ink Canvas.sln"
|
id: create-preview-comment
|
||||||
|
uses: peter-evans/create-or-update-comment@v5
|
||||||
|
continue-on-error: true # 即使评论失败也继续执行
|
||||||
|
with:
|
||||||
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
|
comment-id: ${{ needs.find-or-create-pr-comment.outputs.comment_id }}
|
||||||
|
body: ${{ steps.prepare-preview.outputs.preview_body }}
|
||||||
|
edit-mode: replace
|
||||||
|
|
||||||
- name: Build the Solution
|
build-and-package:
|
||||||
run: |
|
name: Build & Package
|
||||||
msbuild -t:restore /p:GitFlow="Github Action"
|
runs-on: windows-latest
|
||||||
msbuild /p:platform="Any CPU" /p:configuration="Release" /p:GitFlow="Github Action" "Ink Canvas/InkCanvasForClass.csproj"
|
outputs:
|
||||||
|
archive_name: ${{ steps.create-archive.outputs.archive_name }}
|
||||||
|
build_result: ${{ steps.check-exe.outputs.build_success }}
|
||||||
|
artifact_url: ${{ steps.upload-artifact.outputs.artifact-url }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Upload to artifact
|
- name: Setup NuGet
|
||||||
uses: actions/upload-artifact@v4.5.0
|
uses: NuGet/setup-nuget@v2.0.1
|
||||||
with:
|
|
||||||
name: InkCanvasForClass
|
- name: Setup MSBuild
|
||||||
path: "Ink Canvas/bin/Any CPU/Release/net472/"
|
uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
|
- name: Cache NuGet global packages
|
||||||
|
id: cache-nuget
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.nuget/packages
|
||||||
|
~\AppData\Local\NuGet\Cache
|
||||||
|
key: ${{ runner.os }}-nuget-v2-${{ hashFiles('**/*.csproj', '**/packages.config', '**/*.sln', '**/nuget.config') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-nuget-v2-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Removed caching of obj/ folders to avoid cross-version incremental build issues
|
||||||
|
# NuGet packages will still be cached; always run restore to ensure packages are present
|
||||||
|
- name: Restore NuGet packages
|
||||||
|
run: |
|
||||||
|
Write-Host "📥 正在恢复 NuGet 包(始终运行以确保依赖可用)..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# 恢复解决方案级别的包
|
||||||
|
nuget restore "Ink Canvas.sln" -Verbosity minimal
|
||||||
|
|
||||||
|
# 恢复项目级别的包(兼容 packages.config)
|
||||||
|
msbuild -t:restore "Ink Canvas/InkCanvasForClass.csproj" /p:GitFlow="Github Action" /p:RestorePackagesConfig=true /verbosity:minimal
|
||||||
|
|
||||||
|
Write-Host "✅ NuGet 包恢复完成" -ForegroundColor Green
|
||||||
|
|
||||||
|
- name: Build the Solution
|
||||||
|
run: |
|
||||||
|
Write-Host "🔨 正在构建项目..." -ForegroundColor Cyan
|
||||||
|
|
||||||
|
# 如果是 ready_for_review 事件,添加特殊标记
|
||||||
|
if ("${{ github.event.action }}" -eq "ready_for_review") {
|
||||||
|
Write-Host "🚀 PR 准备审查状态构建 - 进行完整验证" -ForegroundColor Magenta
|
||||||
|
$GITFLOW = "Github Action - Ready For Review"
|
||||||
|
} else {
|
||||||
|
$GITFLOW = "Github Action"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 执行构建
|
||||||
|
msbuild /p:platform="AnyCPU" /p:configuration="Debug" /p:GitFlow="$GITFLOW" "Ink Canvas/InkCanvasForClass.csproj" /m /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true /verbosity:minimal
|
||||||
|
|
||||||
|
Write-Host "🏗️ 构建命令执行完成" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
- name: Check if exe file is generated
|
||||||
|
id: check-exe
|
||||||
|
run: |
|
||||||
|
Write-Host "🔍 检查是否生成可执行文件..." -ForegroundColor Cyan
|
||||||
|
|
||||||
|
$exePath = "Ink Canvas\bin\Debug\net472\InkCanvasForClass.exe"
|
||||||
|
|
||||||
|
if (Test-Path $exePath) {
|
||||||
|
Write-Host "✅ 找到可执行文件: $exePath" -ForegroundColor Green
|
||||||
|
$fileInfo = Get-Item $exePath
|
||||||
|
Write-Host " 文件大小: $($fileInfo.Length) 字节" -ForegroundColor Gray
|
||||||
|
Write-Host " 创建时间: $($fileInfo.CreationTime)" -ForegroundColor Gray
|
||||||
|
echo "build_success=true" >> $env:GITHUB_OUTPUT
|
||||||
|
} else {
|
||||||
|
Write-Host "❌ 未找到可执行文件: $exePath" -ForegroundColor Red
|
||||||
|
Write-Host " 检查目录内容:" -ForegroundColor Yellow
|
||||||
|
if (Test-Path "Ink Canvas\bin\Debug\net472\") {
|
||||||
|
Get-ChildItem "Ink Canvas\bin\Debug\net472\" -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Write-Host " - $($_.Name)" -ForegroundColor Gray
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host " bin\Debug\net472 目录不存在" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
echo "build_success=false" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# 如果是直接触发,则抛出错误
|
||||||
|
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
|
||||||
|
Write-Host "🚨 工作流手动触发 - 构建失败,抛出错误!" -ForegroundColor Red -BackgroundColor Black
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Create Package (if build succeeded)
|
||||||
|
id: create-archive
|
||||||
|
if: steps.check-exe.outputs.build_success == 'true'
|
||||||
|
env:
|
||||||
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
|
GITHUB_RUN_NUMBER: ${{ github.run_number }}
|
||||||
|
run: |
|
||||||
|
# 使用合并提交的短哈希(因为构建使用的是合并后的代码)
|
||||||
|
$shortSha = $env:GITHUB_SHA.Substring(0, 7)
|
||||||
|
$version = "debug-$shortSha-$env:GITHUB_RUN_NUMBER"
|
||||||
|
$archiveName = "InkCanvasForClass.CE.$version.zip"
|
||||||
|
Write-Host "📦 正在创建归档包: $archiveName" -ForegroundColor Cyan
|
||||||
|
Write-Host " 使用合并提交哈希: $env:GITHUB_SHA" -ForegroundColor Gray
|
||||||
|
Compress-Archive -Path "Ink Canvas\bin\Debug\net472\*" -DestinationPath $archiveName -Force
|
||||||
|
echo "archive_name=$archiveName" >> $env:GITHUB_OUTPUT
|
||||||
|
Write-Host "✅ 已创建归档包: $archiveName" -ForegroundColor Green
|
||||||
|
|
||||||
|
- name: Upload Artifact (if build succeeded)
|
||||||
|
id: upload-artifact
|
||||||
|
if: steps.check-exe.outputs.build_success == 'true'
|
||||||
|
uses: actions/upload-artifact@v4.5.0
|
||||||
|
with:
|
||||||
|
name: app-package
|
||||||
|
path: "*.zip"
|
||||||
|
|
||||||
|
pr-check-comment:
|
||||||
|
name: PR Check & Comment (Final)
|
||||||
|
needs: [build-and-package, pr-preview-comment]
|
||||||
|
if: always() && github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: Prepare Final Comment Content
|
||||||
|
id: prepare-final-comment
|
||||||
|
run: |
|
||||||
|
# 从构建作业获取构建结果
|
||||||
|
BUILD_SUCCESS="${{ needs.build-and-package.outputs.build_result }}"
|
||||||
|
ARTIFACT_URL="${{ needs.build-and-package.outputs.artifact_url }}"
|
||||||
|
|
||||||
|
# 使用 PR 分支的实际提交哈希
|
||||||
|
PR_HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||||
|
|
||||||
|
# 确定构建状态
|
||||||
|
if [ "$BUILD_SUCCESS" = "true" ]; then
|
||||||
|
STATUS_ICON="✅"
|
||||||
|
STATUS_TEXT="构建成功"
|
||||||
|
COLOR="#00d26a"
|
||||||
|
else
|
||||||
|
STATUS_ICON="❌"
|
||||||
|
STATUS_TEXT="构建失败"
|
||||||
|
COLOR="#f85149"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 检查是否是 ready_for_review 事件
|
||||||
|
READY_FOR_REVIEW="${{ github.event.action == 'ready_for_review' }}"
|
||||||
|
|
||||||
|
# 构建最终评论内容
|
||||||
|
{
|
||||||
|
if [ "$READY_FOR_REVIEW" = "true" ]; then
|
||||||
|
echo "# 🚀 PR 准备审查 - 构建结果"
|
||||||
|
echo ""
|
||||||
|
echo "> 📋 此 PR 已标记为 **准备审查**,构建验证完成"
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "# 📋 构建结果摘要"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "## 本次构建状态"
|
||||||
|
echo ""
|
||||||
|
echo "| 项目 | 结果 |"
|
||||||
|
echo "|------|------|"
|
||||||
|
echo "| 状态 | $STATUS_ICON **$STATUS_TEXT** |"
|
||||||
|
echo "| 事件类型 | \`${{ github.event.action }}\` |"
|
||||||
|
echo "| 分支提交 | \`$PR_HEAD_SHA\` |"
|
||||||
|
echo "| 工作流 | [运行 #${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |"
|
||||||
|
|
||||||
|
# 如果有构建产物,显示下载链接
|
||||||
|
if [ "$BUILD_SUCCESS" = "true" ]; then
|
||||||
|
NIGHTLY_LINK="https://hk.gh-proxy.com/https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/app-package.zip"
|
||||||
|
echo ""
|
||||||
|
echo "## 构建产物"
|
||||||
|
if [ -n "$ARTIFACT_URL" ]; then
|
||||||
|
echo "- 📦 [下载构建产物]($ARTIFACT_URL)"
|
||||||
|
else
|
||||||
|
echo "- 📦 [下载构建产物](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
||||||
|
fi
|
||||||
|
echo "- 🌙 [直链下载 (nightly.link)]($NIGHTLY_LINK)"
|
||||||
|
|
||||||
|
if [ "$READY_FOR_REVIEW" = "true" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "## 🎉 审查建议"
|
||||||
|
echo "- ✅ 构建验证通过,代码可以正常编译"
|
||||||
|
echo "- 🔍 请进行代码审查"
|
||||||
|
echo "- 🧪 建议测试构建产物功能"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$READY_FOR_REVIEW" = "true" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "## ⚠️ 审查阻塞"
|
||||||
|
echo "- ❌ 构建失败,需要修复后才能继续审查"
|
||||||
|
echo "- 🔧 请检查构建错误并修复"
|
||||||
|
echo "- 📝 修复后重新标记为准备审查"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "---"
|
||||||
|
echo "<!-- github-action-pr-build -->"
|
||||||
|
echo "<!-- build-id: ${{ github.run_id }} -->"
|
||||||
|
echo "<!-- event-type: ${{ github.event.action }} -->"
|
||||||
|
echo "<!-- pr-head-sha: $PR_HEAD_SHA -->"
|
||||||
|
echo "<!-- merge-sha: ${{ github.sha }} -->"
|
||||||
|
echo ""
|
||||||
|
echo "<sub>🤖 GitHub Actions 自动生成 • 最后更新: $(date -u +'%Y-%m-%d %H:%M:%S UTC')</sub>"
|
||||||
|
} > final_comment.txt
|
||||||
|
|
||||||
|
# 输出多行内容
|
||||||
|
final_content=$(cat final_comment.txt)
|
||||||
|
echo "final_body<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$final_content" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
echo "最终评论内容已生成"
|
||||||
|
|
||||||
|
- name: Write Final Comment to GitHub Summary
|
||||||
|
run: |
|
||||||
|
echo "# 🚀 最终构建结果 (GitHub Actions Summary)" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "> ⚠️ 注意:由于权限限制,评论可能无法发布到 PR。这里是在 GitHub Actions 中的构建结果:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
cat final_comment.txt >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "---" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**工作流信息:**" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- 事件类型: ${{ github.event_name }} (${{ github.event.action }})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- 运行编号: #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- 运行 ID: ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
- name: Update Final Comment
|
||||||
|
uses: peter-evans/create-or-update-comment@v5
|
||||||
|
continue-on-error: true # 即使评论失败也继续执行
|
||||||
|
with:
|
||||||
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
|
comment-id: ${{ needs.pr-preview-comment.outputs.comment_id }}
|
||||||
|
body: ${{ steps.prepare-final-comment.outputs.final_body }}
|
||||||
|
edit-mode: replace
|
||||||
|
|
||||||
|
final-check:
|
||||||
|
name: Final Check (Manual Trigger)
|
||||||
|
if: always() && github.event_name == 'workflow_dispatch'
|
||||||
|
needs: [build-and-package]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check Build Result
|
||||||
|
id: check-build
|
||||||
|
run: |
|
||||||
|
BUILD_SUCCESS="${{ needs.build-and-package.outputs.build_result }}"
|
||||||
|
|
||||||
|
if [ "$BUILD_SUCCESS" = "true" ]; then
|
||||||
|
echo "✅ 构建成功 - 工作流完成"
|
||||||
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "❌ 构建失败 - 抛出错误"
|
||||||
|
echo "status=failure" >> $GITHUB_OUTPUT
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create Summary (if successful)
|
||||||
|
if: steps.check-build.outputs.status == 'success'
|
||||||
|
run: |
|
||||||
|
echo "# 🎉 手动构建完成" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**构建状态:** ✅ 成功" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**提交:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**运行编号:** #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "[📦 下载构建产物](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**直链下载 (nightly.link):**" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "[🌙 nightly.link 下载链接](https://hk.gh-proxy.com/https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/app-package.zip)" >> $GITHUB_STEP_SUMMARY
|
||||||
@@ -0,0 +1,508 @@
|
|||||||
|
name: Pre-release and Changelog
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version_type:
|
||||||
|
description: 'Version bump type'
|
||||||
|
required: true
|
||||||
|
default: 'patch'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- patch
|
||||||
|
- minor
|
||||||
|
- major
|
||||||
|
- build
|
||||||
|
prerelease:
|
||||||
|
description: 'Create as pre-release'
|
||||||
|
required: true
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-${{ github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: windows-latest
|
||||||
|
outputs:
|
||||||
|
tag_name: ${{ steps.get_tag.outputs.tag_name }}
|
||||||
|
version: ${{ steps.get_tag.outputs.version }}
|
||||||
|
is_prerelease: ${{ steps.release_type.outputs.is_prerelease }}
|
||||||
|
changelog: ${{ steps.read_changelog.outputs.changelog }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
# ========== 获取当前版本 ==========
|
||||||
|
- name: Get current version from Git tag
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
# 获取最新的tag
|
||||||
|
$latestTag = git describe --tags --abbrev=0 2>$null
|
||||||
|
if ($latestTag) {
|
||||||
|
$version = $latestTag
|
||||||
|
echo "Found latest tag: $latestTag"
|
||||||
|
} else {
|
||||||
|
# 如果没有tag,使用默认值
|
||||||
|
$version = "1.0.0.0"
|
||||||
|
echo "No tag found, using default version: $version"
|
||||||
|
}
|
||||||
|
echo "current_version=$version" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "Current version: $version"
|
||||||
|
|
||||||
|
# ========== 处理版本号和标签名 ==========
|
||||||
|
- name: Get tag name and version
|
||||||
|
id: get_tag
|
||||||
|
run: |
|
||||||
|
if ("${{ github.event_name }}" -eq "push") {
|
||||||
|
# 从 push tag 事件获取原始标签名
|
||||||
|
$tagName = "${{ github.ref }}".Replace("refs/tags/", "")
|
||||||
|
$cleanVersion = $tagName
|
||||||
|
|
||||||
|
echo "tag_name=$tagName" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "version=$cleanVersion" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "Using pushed tag: $tagName, version: $cleanVersion"
|
||||||
|
} else {
|
||||||
|
# 从 workflow_dispatch 计算新版本(4位格式)
|
||||||
|
$currentVersion = "${{ steps.get_version.outputs.current_version }}"
|
||||||
|
$versionParts = $currentVersion.Split('.')
|
||||||
|
|
||||||
|
# 确保版本号格式正确(至少4部分)
|
||||||
|
if ($versionParts.Length -ge 4) {
|
||||||
|
$major = [int]$versionParts[0]
|
||||||
|
$minor = [int]$versionParts[1]
|
||||||
|
$patch = [int]$versionParts[2]
|
||||||
|
$build = [int]$versionParts[3]
|
||||||
|
} else {
|
||||||
|
# 如果版本号格式不正确,补充为4位
|
||||||
|
if ($versionParts.Length -ge 3) {
|
||||||
|
$major = [int]$versionParts[0]
|
||||||
|
$minor = [int]$versionParts[1]
|
||||||
|
$patch = [int]$versionParts[2]
|
||||||
|
$build = 0
|
||||||
|
} else {
|
||||||
|
# 如果版本号格式不正确,抛出错误
|
||||||
|
echo "Error: Invalid version format. Expected format: x.y.z.w (e.g., 1.7.18.0)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$versionType = "${{ github.event.inputs.version_type }}"
|
||||||
|
$isPrerelease = "${{ github.event.inputs.prerelease }}" -eq "true"
|
||||||
|
|
||||||
|
switch ($versionType) {
|
||||||
|
"major" {
|
||||||
|
$major++
|
||||||
|
$minor = 0
|
||||||
|
$patch = 0
|
||||||
|
$build = 0
|
||||||
|
}
|
||||||
|
"minor" {
|
||||||
|
$minor++
|
||||||
|
$patch = 0
|
||||||
|
$build = 0
|
||||||
|
}
|
||||||
|
"patch" {
|
||||||
|
$patch++
|
||||||
|
$build = 0
|
||||||
|
}
|
||||||
|
"build" {
|
||||||
|
$build++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 生成新版本号(4位格式,如1.7.18.0)
|
||||||
|
$newVersion = "$major.$minor.$patch.$build"
|
||||||
|
|
||||||
|
# 根据是否为预发布决定版本号最后一位
|
||||||
|
# 如果是预发布,确保最后一位不为0(使用1)
|
||||||
|
if ($isPrerelease -and $build -eq 0) {
|
||||||
|
$build = 1
|
||||||
|
$newVersion = "$major.$minor.$patch.$build"
|
||||||
|
}
|
||||||
|
$tagName = $newVersion
|
||||||
|
|
||||||
|
echo "tag_name=$tagName" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "version=$newVersion" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "New tag: $tagName, version: $newVersion"
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Determine release type
|
||||||
|
id: release_type
|
||||||
|
run: |
|
||||||
|
if ("${{ github.event_name }}" -eq "push") {
|
||||||
|
# 根据版本号最后一位确定是否为预发布版本
|
||||||
|
# 最后一位为0表示正式版本,非0表示预发布版本
|
||||||
|
$version = "${{ steps.get_tag.outputs.version }}"
|
||||||
|
$versionParts = $version.Split('.')
|
||||||
|
if ($versionParts.Length -ge 4) {
|
||||||
|
$build = [int]$versionParts[3]
|
||||||
|
if ($build -eq 0) {
|
||||||
|
echo "is_prerelease=false" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "This is a release"
|
||||||
|
} else {
|
||||||
|
echo "is_prerelease=true" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "This is a pre-release (beta)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "is_prerelease=false" >> $env:GITHUB_OUTPUT
|
||||||
|
echo "This is a release (invalid version format)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# workflow_dispatch 方式
|
||||||
|
echo "is_prerelease=${{ github.event.inputs.prerelease }}" >> $env:GITHUB_OUTPUT
|
||||||
|
}
|
||||||
|
|
||||||
|
# ========== 使用 git-cliff 生成变更日志 ==========
|
||||||
|
- name: Generate changelog with git-cliff (for pushed tag)
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
id: git_cliff_tag
|
||||||
|
uses: orhun/git-cliff-action@v4
|
||||||
|
with:
|
||||||
|
config: build/cliff.toml # 使用项目build目录的 cliff.toml 配置
|
||||||
|
args: --latest --tag ${{ steps.get_tag.outputs.tag_name }} --output CHANGELOG.md
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Generate changelog with git-cliff (for workflow_dispatch)
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
|
id: git_cliff_unreleased
|
||||||
|
uses: orhun/git-cliff-action@v4
|
||||||
|
with:
|
||||||
|
config: build/cliff.toml
|
||||||
|
args: --unreleased --tag ${{ steps.get_tag.outputs.tag_name }} --output CHANGELOG.md
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Read changelog content
|
||||||
|
id: read_changelog
|
||||||
|
run: |
|
||||||
|
$changelogContent = Get-Content -Path CHANGELOG.md -Raw
|
||||||
|
echo "changelog<<EOF" >> $env:GITHUB_OUTPUT
|
||||||
|
echo $changelogContent >> $env:GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: prepare
|
||||||
|
if: success()
|
||||||
|
runs-on: windows-latest
|
||||||
|
outputs:
|
||||||
|
archive_name: ${{ steps.create_archive.outputs.archive_name }}
|
||||||
|
zip_size: ${{ steps.calculate_size.outputs.zip_size }}
|
||||||
|
installer_size: ${{ steps.calculate_installer_size.outputs.installer_size }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- name: Setup NuGet
|
||||||
|
uses: NuGet/setup-nuget@v2.0.1
|
||||||
|
|
||||||
|
- name: Setup MSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v2
|
||||||
|
|
||||||
|
- name: Install Inno Setup Unofficial Language Files
|
||||||
|
run: |
|
||||||
|
# 创建临时目录用于下载文件
|
||||||
|
New-Item -ItemType Directory -Path "temp_lang" -Force
|
||||||
|
|
||||||
|
# 下载英语英国版语言文件
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/jrsoftware/issrc/raw/refs/heads/main/Files/Languages/Unofficial/EnglishBritish.isl" -OutFile "temp_lang\EnglishBritish.isl"
|
||||||
|
|
||||||
|
# 下载简体中文版语言文件
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/jrsoftware/issrc/raw/refs/heads/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile "temp_lang\ChineseSimplified.isl"
|
||||||
|
|
||||||
|
# 将文件移动到 Inno Setup 的语言目录
|
||||||
|
Move-Item -Path "temp_lang\EnglishBritish.isl" -Destination "C:\Program Files (x86)\Inno Setup 6\Languages\EnglishBritish.isl" -Force
|
||||||
|
Move-Item -Path "temp_lang\ChineseSimplified.isl" -Destination "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" -Force
|
||||||
|
|
||||||
|
# 清理临时目录
|
||||||
|
Remove-Item -Path "temp_lang" -Recurse -Force
|
||||||
|
|
||||||
|
Write-Host "✅ Inno Setup unofficial language files installed successfully" -ForegroundColor Green
|
||||||
|
|
||||||
|
- name: Cache NuGet packages and obj files
|
||||||
|
id: cache-nuget
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
# NuGet 全局包缓存(已下载的包)
|
||||||
|
~/.nuget/packages
|
||||||
|
# NuGet 缓存目录(包索引)
|
||||||
|
~\AppData\Local\NuGet\Cache
|
||||||
|
# 项目 obj 目录(包含 project.assets.json)
|
||||||
|
Ink Canvas/obj/
|
||||||
|
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/packages.config', '**/*.sln') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-nuget-
|
||||||
|
|
||||||
|
- name: Restore NuGet packages (if cache missed)
|
||||||
|
if: steps.cache-nuget.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
Write-Host "📥 缓存未命中,正在恢复 NuGet 包..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# 恢复解决方案级别的包
|
||||||
|
nuget restore "Ink Canvas.sln" -Verbosity minimal
|
||||||
|
|
||||||
|
# 恢复项目级别的包
|
||||||
|
msbuild -t:restore "Ink Canvas/InkCanvasForClass.csproj" /p:GitFlow="Github Action" /p:RestorePackagesConfig=true /verbosity:minimal
|
||||||
|
|
||||||
|
Write-Host "✅ NuGet 包恢复完成" -ForegroundColor Green
|
||||||
|
|
||||||
|
- name: Display version info
|
||||||
|
run: |
|
||||||
|
echo "Building version: ${{ needs.prepare.outputs.version }}"
|
||||||
|
echo "Tag: ${{ needs.prepare.outputs.tag_name }}"
|
||||||
|
echo "Release type: ${{ needs.prepare.outputs.is_prerelease == 'true' && 'Pre-release' || 'Release' }}"
|
||||||
|
|
||||||
|
- name: Build the Solution
|
||||||
|
run: |
|
||||||
|
Write-Host "🔨 正在构建项目..." -ForegroundColor Cyan
|
||||||
|
msbuild /p:platform="AnyCPU" /p:configuration="Release" /p:GitFlow="Github Action" "Ink Canvas/InkCanvasForClass.csproj" /m /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true /verbosity:minimal
|
||||||
|
|
||||||
|
Write-Host "🏗️ 构建命令执行完成" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
- name: Create Release Archive
|
||||||
|
id: create_archive
|
||||||
|
run: |
|
||||||
|
$version = "${{ needs.prepare.outputs.version }}"
|
||||||
|
$archiveName = "InkCanvasForClass.CE.$version.zip"
|
||||||
|
|
||||||
|
# 创建发布目录
|
||||||
|
New-Item -ItemType Directory -Path "release" -Force
|
||||||
|
|
||||||
|
# 复制发布文件
|
||||||
|
Copy-Item "Ink Canvas\bin\Release\net472\*" "release\" -Recurse -Force
|
||||||
|
|
||||||
|
# 创建压缩包
|
||||||
|
Compress-Archive -Path "release\*" -DestinationPath $archiveName -Force
|
||||||
|
|
||||||
|
echo "archive_name=$archiveName" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Prepare Inno Setup script
|
||||||
|
run: |
|
||||||
|
$version = "${{ needs.prepare.outputs.version }}"
|
||||||
|
|
||||||
|
# 更新 ISS 文件中的版本信息
|
||||||
|
$issPath = "build\InkCanvasForClass CE.iss"
|
||||||
|
$issContent = Get-Content -Path $issPath -Raw
|
||||||
|
|
||||||
|
# 替换版本信息
|
||||||
|
$issContent = $issContent -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$version`""
|
||||||
|
|
||||||
|
# 替换源文件路径为相对路径(考虑到ISS文件在build目录下,需要返回上级目录)
|
||||||
|
$issContent = $issContent -replace 'Source: ".*\\{#MyAppExeName}";', 'Source: "..\release\{#MyAppExeName}";'
|
||||||
|
$issContent = $issContent -replace 'Source: ".*\\InkCanvasForClass.exe.config";', 'Source: "..\release\InkCanvasForClass.exe.config";'
|
||||||
|
|
||||||
|
# 更新输出目录为当前目录
|
||||||
|
$issContent = $issContent -replace 'OutputDir=.*', 'OutputDir=.'
|
||||||
|
|
||||||
|
# 更新默认安装目录
|
||||||
|
$issContent = $issContent -replace 'DefaultDirName=.*', 'DefaultDirName={autopf}\{#MyAppName}'
|
||||||
|
|
||||||
|
# 更新许可证文件路径为相对路径(考虑到ISS文件在build目录下,需要返回上级目录)
|
||||||
|
$issContent = $issContent -replace 'LicenseFile=.*', 'LicenseFile=..\LICENSE'
|
||||||
|
|
||||||
|
# 保存修改后的 ISS 文件
|
||||||
|
$issContent | Set-Content -Path $issPath -Encoding UTF8
|
||||||
|
|
||||||
|
# 显示修改后的 ISS 文件内容
|
||||||
|
Write-Host "Modified ISS file content:"
|
||||||
|
Write-Host $issContent
|
||||||
|
|
||||||
|
- name: Build MSI installer with Inno Setup
|
||||||
|
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
|
||||||
|
with:
|
||||||
|
path: build\InkCanvasForClass CE.iss
|
||||||
|
options: /O.
|
||||||
|
|
||||||
|
- name: Rename installer file
|
||||||
|
run: |
|
||||||
|
$version = "${{ needs.prepare.outputs.version }}"
|
||||||
|
$setupFile = "InkCanvasForClass CE Setup.exe"
|
||||||
|
$newSetupName = "InkCanvasForClass.CE.$version.Setup.exe"
|
||||||
|
|
||||||
|
if (Test-Path $setupFile) {
|
||||||
|
Rename-Item -Path $setupFile -NewName $newSetupName
|
||||||
|
Write-Host "Renamed setup file to: $newSetupName"
|
||||||
|
} else {
|
||||||
|
Write-Host "Setup file not found: $setupFile"
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Calculate archive size
|
||||||
|
id: calculate_size
|
||||||
|
run: |
|
||||||
|
$version = "${{ needs.prepare.outputs.version }}"
|
||||||
|
$archiveName = "InkCanvasForClass.CE.$version.zip"
|
||||||
|
|
||||||
|
# 获取文件大小(字节)
|
||||||
|
$fileSize = (Get-Item $archiveName).Length
|
||||||
|
|
||||||
|
echo "zip_size=$fileSize" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
echo "Archive size: $fileSize bytes"
|
||||||
|
|
||||||
|
- name: Calculate installer size
|
||||||
|
id: calculate_installer_size
|
||||||
|
run: |
|
||||||
|
$version = "${{ needs.prepare.outputs.version }}"
|
||||||
|
$installerName = "InkCanvasForClass.CE.$version.Setup.exe"
|
||||||
|
|
||||||
|
if (Test-Path $installerName) {
|
||||||
|
# 获取文件大小(字节)
|
||||||
|
$fileSize = (Get-Item $installerName).Length
|
||||||
|
|
||||||
|
echo "installer_size=$fileSize" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
echo "Installer size: $fileSize bytes"
|
||||||
|
} else {
|
||||||
|
echo "Installer file not found: $installerName"
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Upload Build Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-files-${{ needs.prepare.outputs.version }}
|
||||||
|
path: |
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.zip
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.Setup.exe
|
||||||
|
|
||||||
|
sign:
|
||||||
|
needs: [prepare, build]
|
||||||
|
if: success()
|
||||||
|
runs-on: ubuntu-latest # 改为 Ubuntu 以使用 Python 签名工具
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write # 需要这个权限来验证签名
|
||||||
|
steps:
|
||||||
|
- name: Download Build Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-files-${{ needs.prepare.outputs.version }}
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
|
||||||
|
- name: Sign release artifacts with sigstore-python
|
||||||
|
uses: sigstore/gh-action-sigstore-python@v3.2.0
|
||||||
|
with:
|
||||||
|
inputs: |
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.zip
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.Setup.exe
|
||||||
|
release-signing-artifacts: true
|
||||||
|
upload-signing-artifacts: true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload Signed Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: signed-files-${{ needs.prepare.outputs.version }}
|
||||||
|
path: |
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.zip.sigstore.json
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.Setup.exe.sigstore.json
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: [prepare, build, sign]
|
||||||
|
if: success()
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download Build Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-files-${{ needs.prepare.outputs.version }}
|
||||||
|
|
||||||
|
- name: Download Signed Artifacts (if exists)
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: signed-files-${{ needs.prepare.outputs.version }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Create enhanced changelog with file table
|
||||||
|
id: enhanced_changelog
|
||||||
|
run: |
|
||||||
|
version="${{ needs.prepare.outputs.version }}"
|
||||||
|
|
||||||
|
# 读取git-cliff生成的changelog内容
|
||||||
|
originalChangelog="${{ needs.prepare.outputs.changelog }}"
|
||||||
|
|
||||||
|
# 构建文件信息表格
|
||||||
|
fileTable=$'\n## 文件信息 (File Information)\n'
|
||||||
|
fileTable+=$'| 文件名 | 大小 |\n'
|
||||||
|
fileTable+=$'|--------|------|\n'
|
||||||
|
|
||||||
|
# ZIP 文件信息
|
||||||
|
fileTable+=$'| InkCanvasForClass.CE.'"$version"
|
||||||
|
fileTable+=$'.zip | ${{ needs.build.outputs.zip_size }} bytes |\n'
|
||||||
|
|
||||||
|
# 安装包文件信息
|
||||||
|
installerSize="${{ needs.build.outputs.installer_size }}"
|
||||||
|
if [ -n "$installerSize" ]; then
|
||||||
|
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.Setup.exe | '"$installerSize"' bytes |\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 检查是否有签名文件
|
||||||
|
if [ -f "InkCanvasForClass.CE.$version.zip.sigstore.json" ]; then
|
||||||
|
sigstoreSize=$(stat -c%s "InkCanvasForClass.CE.$version.zip.sigstore.json")
|
||||||
|
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.zip.sigstore.json | '"$sigstoreSize"' bytes |\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 检查安装程序签名文件
|
||||||
|
if [ -f "InkCanvasForClass.CE.$version.Setup.exe.sigstore.json" ]; then
|
||||||
|
sigstoreSize=$(stat -c%s "InkCanvasForClass.CE.$version.Setup.exe.sigstore.json")
|
||||||
|
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.Setup.exe.sigstore.json | '"$sigstoreSize"' bytes |\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
fileTable+=$'\n*文件大小信息由GitHub Actions自动生成*\n'
|
||||||
|
|
||||||
|
# 将表格附加到原始changelog
|
||||||
|
enhancedChangelog="${originalChangelog}${fileTable}"
|
||||||
|
|
||||||
|
# 输出增强版changelog内容
|
||||||
|
echo "enhanced_changelog<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$enhancedChangelog" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
echo "Enhanced changelog created with file information table"
|
||||||
|
|
||||||
|
- name: Display Release Info
|
||||||
|
run: |
|
||||||
|
echo "=== Creating Release ==="
|
||||||
|
echo "Version: ${{ needs.prepare.outputs.version }}"
|
||||||
|
echo "Tag: ${{ needs.prepare.outputs.tag_name }}"
|
||||||
|
echo "Pre-release: ${{ needs.prepare.outputs.is_prerelease }}"
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: ${{ needs.prepare.outputs.tag_name }}
|
||||||
|
name: ICC CE ${{ needs.prepare.outputs.version }}
|
||||||
|
body: |
|
||||||
|
${{ steps.enhanced_changelog.outputs.enhanced_changelog }}
|
||||||
|
draft: false
|
||||||
|
prerelease: ${{ needs.prepare.outputs.is_prerelease == 'true' }}
|
||||||
|
files: |
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.zip
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.Setup.exe
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.zip.sigstore.json
|
||||||
|
InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.Setup.exe.sigstore.json
|
||||||
|
fail_on_unmatched_files: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
+428
-3
@@ -1,3 +1,428 @@
|
|||||||
obj/
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
bin/
|
## files generated by popular Visual Studio add-ons.
|
||||||
.vs
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
*.env
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
|
||||||
|
[Dd]ebug/x64/
|
||||||
|
[Dd]ebugPublic/x64/
|
||||||
|
[Rr]elease/x64/
|
||||||
|
[Rr]eleases/x64/
|
||||||
|
bin/x64/
|
||||||
|
obj/x64/
|
||||||
|
|
||||||
|
[Dd]ebug/x86/
|
||||||
|
[Dd]ebugPublic/x86/
|
||||||
|
[Rr]elease/x86/
|
||||||
|
[Rr]eleases/x86/
|
||||||
|
bin/x86/
|
||||||
|
obj/x86/
|
||||||
|
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
[Aa][Rr][Mm]64[Ee][Cc]/
|
||||||
|
bld/
|
||||||
|
[Oo]bj/
|
||||||
|
[Oo]ut/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Build results on 'Bin' directories
|
||||||
|
**/[Bb]in/*
|
||||||
|
# Uncomment if you have tasks that rely on *.refresh files to move binaries
|
||||||
|
# (https://github.com/github/gitignore/pull/3736)
|
||||||
|
#!**/[Bb]in/*.refresh
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
*.trx
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Approval Tests result files
|
||||||
|
*.received.*
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.idb
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
# but not Directory.Build.rsp, as it configures directory-level build defaults
|
||||||
|
!Directory.Build.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.tlog
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||||
|
*.dsw
|
||||||
|
*.dsp
|
||||||
|
|
||||||
|
# Visual Studio 6 technical files
|
||||||
|
*.ncb
|
||||||
|
*.aps
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
**/.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
**/.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
**/.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
**/__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
#tools/**
|
||||||
|
#!tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
MSBuild_Logs/
|
||||||
|
|
||||||
|
# AWS SAM Build and Temporary Artifacts folder
|
||||||
|
.aws-sam
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
**/.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
**/.localhistory/
|
||||||
|
|
||||||
|
# Visual Studio History (VSHistory) files
|
||||||
|
.vshistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
**/.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# VS Code files for those working on multiple tools
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Built Visual Studio Code Extensions
|
||||||
|
*.vsix
|
||||||
|
|
||||||
|
# Windows Installer files from build outputs
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
Generated
+1
@@ -2,5 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/../alpha" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,398 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|c:\\users\\dubi906w\\source\\repos\\icc-ce\\ink canvas\\mainwindow_cs\\mw_floatingbaricons.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|solutionrelative:ink canvas\\mainwindow_cs\\mw_floatingbaricons.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\privacy.txt||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:privacy.txt||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Manual.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Manual.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\LICENSE||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:LICENSE||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas.sln.DotSettings.user||{FA3CD31E-987B-443A-9B81-186104E8DAC1}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Ink Canvas.sln.DotSettings.user||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|c:\\users\\dubi906w\\source\\repos\\icc-ce\\ink canvas\\mainwindow_cs\\mw_ppt.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|solutionrelative:ink canvas\\mainwindow_cs\\mw_ppt.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|c:\\users\\dubi906w\\source\\repos\\icc-ce\\ink canvas\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
|
|
||||||
"RelativeMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|solutionrelative:ink canvas\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 210,
|
|
||||||
"SelectedChildIndex": 48,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{387cb18d-6153-4156-9257-9ac3f9207bbe}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{e8b06f52-6d01-11d2-aa7d-00c04f990343}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{46c87f81-5a06-43a8-9e25-85d33bac49f8}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{269a02dc-6af8-11d3-bdc4-00c04f688e50}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{99b8fa2f-ab90-4f57-9c32-949f146f1914}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{c79b74ff-f1d7-4c94-aefa-4d22bfe1b1f9}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:2:0:{34c7837f-3b3a-449c-bdf0-bdad86cbaf4a}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{37aba9be-445a-11d3-9949-00c04f68fd0a}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{dcc4ea97-1c0c-482b-b205-e541c0df9728}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{eefa5220-e298-11d0-8f78-00a0c9110057}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{4a9b7e51-aa16-11d0-a8c5-00a0c921a4d2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:132:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:3:0:{34c7837f-3b3a-449c-bdf0-bdad86cbaf4a}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:153:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:154:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:152:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:151:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:150:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:148:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:149:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:136:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:144:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:147:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:145:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:146:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:143:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:142:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:141:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:140:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:139:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:138:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:137:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:135:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:134:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:129:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:130:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:129:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{b1e99781-ab81-11d0-b683-00aa00a3ee26}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "MW_FloatingBarIcons.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"RelativeToolTip": "Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"ViewState": "AgIAAOgCAAAAAAAAAAAuwEoGAAAIAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2025-05-31T10:49:24.719Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "README.md",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\README.md",
|
|
||||||
"RelativeDocumentMoniker": "README.md",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\README.md",
|
|
||||||
"RelativeToolTip": "README.md",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
|
||||||
"WhenOpened": "2025-05-31T10:48:22.883Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 7,
|
|
||||||
"Title": "MainWindow.xaml",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow.xaml",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas\\MainWindow.xaml",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow.xaml",
|
|
||||||
"RelativeToolTip": "Ink Canvas\\MainWindow.xaml",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
|
|
||||||
"WhenOpened": "2025-05-24T13:22:56.715Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 9,
|
|
||||||
"Title": "Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"DocumentMoniker": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\..\\..\\..\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"ToolTip": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"RelativeToolTip": "..\\..\\..\\..\\..\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"ViewState": "AgIAAGsJAAAAAAAAAAAQwIEJAAAEAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003801|",
|
|
||||||
"WhenOpened": "2025-05-24T13:06:01.053Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 6,
|
|
||||||
"Title": "MW_PPT.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"RelativeToolTip": "Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"ViewState": "AgIAAFgAAAAAAAAAAAAUwHQAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:47.205Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 8,
|
|
||||||
"Title": "README.md",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\..\\..\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"RelativeToolTip": "..\\..\\..\\..\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:01.407Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": "privacy.txt",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\privacy.txt",
|
|
||||||
"RelativeDocumentMoniker": "privacy.txt",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\privacy.txt",
|
|
||||||
"RelativeToolTip": "privacy.txt",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:01.337Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 3,
|
|
||||||
"Title": "Manual.md",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Manual.md",
|
|
||||||
"RelativeDocumentMoniker": "Manual.md",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Manual.md",
|
|
||||||
"RelativeToolTip": "Manual.md",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:00.986Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 4,
|
|
||||||
"Title": "LICENSE",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\LICENSE",
|
|
||||||
"RelativeDocumentMoniker": "LICENSE",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\LICENSE",
|
|
||||||
"RelativeToolTip": "LICENSE",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:00.902Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 5,
|
|
||||||
"Title": "Ink Canvas.sln.DotSettings.user",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas.sln.DotSettings.user",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas.sln.DotSettings.user",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas.sln.DotSettings.user",
|
|
||||||
"RelativeToolTip": "Ink Canvas.sln.DotSettings.user",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003464|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:00.792Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{d84ee353-0bef-5a41-a649-8f89aca5d84d}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DockedWidth": 204,
|
|
||||||
"SelectedChildIndex": -1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:1:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{590a070c-4fcd-52d9-87da-dfaa11710261}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DockedWidth": 190,
|
|
||||||
"SelectedChildIndex": -1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{f4fc5ff1-28ef-4b04-ad02-6b298310ccc7}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,398 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|c:\\users\\dubi906w\\source\\repos\\icc-ce\\ink canvas\\mainwindow_cs\\mw_floatingbaricons.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|solutionrelative:ink canvas\\mainwindow_cs\\mw_floatingbaricons.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\privacy.txt||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:privacy.txt||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Manual.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Manual.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\LICENSE||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:LICENSE||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas.sln.DotSettings.user||{FA3CD31E-987B-443A-9B81-186104E8DAC1}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Ink Canvas.sln.DotSettings.user||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|c:\\users\\dubi906w\\source\\repos\\icc-ce\\ink canvas\\mainwindow_cs\\mw_ppt.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|solutionrelative:ink canvas\\mainwindow_cs\\mw_ppt.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|c:\\users\\dubi906w\\source\\repos\\icc-ce\\ink canvas\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
|
|
||||||
"RelativeMoniker": "D:0:0:{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}|Ink Canvas\\InkCanvasForClass.csproj|solutionrelative:ink canvas\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 210,
|
|
||||||
"SelectedChildIndex": 48,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{387cb18d-6153-4156-9257-9ac3f9207bbe}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{e8b06f52-6d01-11d2-aa7d-00c04f990343}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{46c87f81-5a06-43a8-9e25-85d33bac49f8}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{269a02dc-6af8-11d3-bdc4-00c04f688e50}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{99b8fa2f-ab90-4f57-9c32-949f146f1914}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{c79b74ff-f1d7-4c94-aefa-4d22bfe1b1f9}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:2:0:{34c7837f-3b3a-449c-bdf0-bdad86cbaf4a}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{37aba9be-445a-11d3-9949-00c04f68fd0a}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{dcc4ea97-1c0c-482b-b205-e541c0df9728}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{eefa5220-e298-11d0-8f78-00a0c9110057}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{4a9b7e51-aa16-11d0-a8c5-00a0c921a4d2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:132:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:3:0:{34c7837f-3b3a-449c-bdf0-bdad86cbaf4a}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:153:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:154:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:152:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:151:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:150:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:148:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:149:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:136:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:144:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:147:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:145:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:146:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:143:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:142:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:141:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:140:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:139:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:138:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:137:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:135:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:134:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:129:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:130:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:129:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{b1e99781-ab81-11d0-b683-00aa00a3ee26}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "MW_FloatingBarIcons.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"RelativeToolTip": "Ink Canvas\\MainWindow_cs\\MW_FloatingBarIcons.cs",
|
|
||||||
"ViewState": "AgIAAOgCAAAAAAAAAAAuwEoGAAAIAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2025-05-31T10:49:24.719Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "README.md",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\README.md",
|
|
||||||
"RelativeDocumentMoniker": "README.md",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\README.md",
|
|
||||||
"RelativeToolTip": "README.md",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
|
||||||
"WhenOpened": "2025-05-31T10:48:22.883Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 7,
|
|
||||||
"Title": "MainWindow.xaml",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow.xaml",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas\\MainWindow.xaml",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow.xaml",
|
|
||||||
"RelativeToolTip": "Ink Canvas\\MainWindow.xaml",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
|
|
||||||
"WhenOpened": "2025-05-24T13:22:56.715Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 9,
|
|
||||||
"Title": "Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"DocumentMoniker": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\..\\..\\..\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"ToolTip": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"RelativeToolTip": "..\\..\\..\\..\\..\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\amd64\\Microsoft.Common.CurrentVersion.targets",
|
|
||||||
"ViewState": "AgIAAGsJAAAAAAAAAAAQwIEJAAAEAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003801|",
|
|
||||||
"WhenOpened": "2025-05-24T13:06:01.053Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 6,
|
|
||||||
"Title": "MW_PPT.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"RelativeToolTip": "Ink Canvas\\MainWindow_cs\\MW_PPT.cs",
|
|
||||||
"ViewState": "AgIAAFgAAAAAAAAAAAAUwHQAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:47.205Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 8,
|
|
||||||
"Title": "README.md",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\..\\..\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"RelativeToolTip": "..\\..\\..\\..\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\README.md",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:01.407Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": "privacy.txt",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\privacy.txt",
|
|
||||||
"RelativeDocumentMoniker": "privacy.txt",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\privacy.txt",
|
|
||||||
"RelativeToolTip": "privacy.txt",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:01.337Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 3,
|
|
||||||
"Title": "Manual.md",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Manual.md",
|
|
||||||
"RelativeDocumentMoniker": "Manual.md",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Manual.md",
|
|
||||||
"RelativeToolTip": "Manual.md",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:00.986Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 4,
|
|
||||||
"Title": "LICENSE",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\LICENSE",
|
|
||||||
"RelativeDocumentMoniker": "LICENSE",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\LICENSE",
|
|
||||||
"RelativeToolTip": "LICENSE",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:00.902Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 5,
|
|
||||||
"Title": "Ink Canvas.sln.DotSettings.user",
|
|
||||||
"DocumentMoniker": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas.sln.DotSettings.user",
|
|
||||||
"RelativeDocumentMoniker": "Ink Canvas.sln.DotSettings.user",
|
|
||||||
"ToolTip": "C:\\Users\\dubi906w\\source\\repos\\icc-ce\\Ink Canvas.sln.DotSettings.user",
|
|
||||||
"RelativeToolTip": "Ink Canvas.sln.DotSettings.user",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003464|",
|
|
||||||
"WhenOpened": "2025-05-24T13:04:00.792Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{d84ee353-0bef-5a41-a649-8f89aca5d84d}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DockedWidth": 204,
|
|
||||||
"SelectedChildIndex": -1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:1:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{590a070c-4fcd-52d9-87da-dfaa11710261}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DockedWidth": 190,
|
|
||||||
"SelectedChildIndex": -1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{f4fc5ff1-28ef-4b04-ad02-6b298310ccc7}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ExpandedNodes": [
|
|
||||||
""
|
|
||||||
],
|
|
||||||
"SelectedNode": "\\Ink Canvas.sln",
|
|
||||||
"PreviewInSolutionExplorer": false
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,290 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\System.ValueTuple.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Settings.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\OSVersionExt.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Office.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.Wpf.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Newtonsoft.Json.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.Plugins.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\InkCanvasForClass.exe.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IAWinFX.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IALoader.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IACore.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 200,
|
|
||||||
"SelectedChildIndex": 0,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "System.ValueTuple.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:48.138Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "Settings.json",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Settings.json",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Settings.json",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Settings.json",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Settings.json",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.878Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": "OSVersionExt.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.837Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 3,
|
|
||||||
"Title": "Office.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Office.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Office.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Office.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Office.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.774Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 4,
|
|
||||||
"Title": "NHotkey.Wpf.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.718Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 5,
|
|
||||||
"Title": "NHotkey.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.662Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 6,
|
|
||||||
"Title": "Newtonsoft.Json.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.589Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 7,
|
|
||||||
"Title": "Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.932Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 8,
|
|
||||||
"Title": "MdXaml.Plugins.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.838Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 9,
|
|
||||||
"Title": "MdXaml.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.776Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 10,
|
|
||||||
"Title": "iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.573Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 11,
|
|
||||||
"Title": "iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.432Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 12,
|
|
||||||
"Title": "iNKORE.UI.WPF.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:42.807Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 13,
|
|
||||||
"Title": "InkCanvasForClass.exe.config",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:27.288Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 14,
|
|
||||||
"Title": "ICSharpCode.AvalonEdit.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.847Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 15,
|
|
||||||
"Title": "IAWinFX.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.816Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 16,
|
|
||||||
"Title": "IALoader.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.784Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 17,
|
|
||||||
"Title": "IACore.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.753Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 18,
|
|
||||||
"Title": "Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.113Z"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,338 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\icc.png||{177559E0-D141-11D0-92DF-00A0C9138C45}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:icc.png||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\AutomaticUpdateVersionControl.txt||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:AutomaticUpdateVersionControl.txt||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\System.ValueTuple.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Settings.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\OSVersionExt.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Office.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.Wpf.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Newtonsoft.Json.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.Plugins.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\InkCanvasForClass.exe.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IAWinFX.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IALoader.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IACore.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 200,
|
|
||||||
"SelectedChildIndex": 0,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "icc.png - PNG [256x256, 32 \u4F4D, PNG]",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\icc.png",
|
|
||||||
"RelativeDocumentMoniker": "icc.png",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\icc.png - PNG [256x256, 32 \u4F4D, PNG]",
|
|
||||||
"RelativeToolTip": "icc.png - PNG [256x256, 32 \u4F4D, PNG]",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001533|",
|
|
||||||
"WhenOpened": "2025-05-24T13:03:45.63Z",
|
|
||||||
"EditorCaption": " - PNG [256x256, 32 \u4F4D, PNG]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\AutomaticUpdateVersionControl.txt",
|
|
||||||
"RelativeDocumentMoniker": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\AutomaticUpdateVersionControl.txt",
|
|
||||||
"RelativeToolTip": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|",
|
|
||||||
"WhenOpened": "2025-05-24T13:03:45.517Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": ".gitignore",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\.gitignore",
|
|
||||||
"RelativeDocumentMoniker": ".gitignore",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.2\\.gitignore",
|
|
||||||
"RelativeToolTip": ".gitignore",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
|
||||||
"WhenOpened": "2025-05-24T13:03:43.13Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 3,
|
|
||||||
"Title": "System.ValueTuple.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\System.ValueTuple.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:48.138Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 4,
|
|
||||||
"Title": "Settings.json",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Settings.json",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Settings.json",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Settings.json",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Settings.json",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.878Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 5,
|
|
||||||
"Title": "OSVersionExt.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\OSVersionExt.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.837Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 6,
|
|
||||||
"Title": "Office.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Office.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Office.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Office.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Office.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.774Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 7,
|
|
||||||
"Title": "NHotkey.Wpf.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\NHotkey.Wpf.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.718Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 8,
|
|
||||||
"Title": "NHotkey.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\NHotkey.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.662Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 9,
|
|
||||||
"Title": "Newtonsoft.Json.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Newtonsoft.Json.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:44.589Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 10,
|
|
||||||
"Title": "Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Microsoft.Office.Interop.PowerPoint.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.932Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 11,
|
|
||||||
"Title": "MdXaml.Plugins.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\MdXaml.Plugins.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.838Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 12,
|
|
||||||
"Title": "MdXaml.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\MdXaml.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.776Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 13,
|
|
||||||
"Title": "iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.573Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 14,
|
|
||||||
"Title": "iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.Modern.Controls.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:43.432Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 15,
|
|
||||||
"Title": "iNKORE.UI.WPF.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\iNKORE.UI.WPF.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:42.807Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 16,
|
|
||||||
"Title": "InkCanvasForClass.exe.config",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\InkCanvasForClass.exe.config",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:27.288Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 17,
|
|
||||||
"Title": "ICSharpCode.AvalonEdit.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\ICSharpCode.AvalonEdit.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.847Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 18,
|
|
||||||
"Title": "IAWinFX.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\IAWinFX.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.816Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 19,
|
|
||||||
"Title": "IALoader.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\IALoader.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.784Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 20,
|
|
||||||
"Title": "IACore.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\IACore.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.753Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 21,
|
|
||||||
"Title": "Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"RelativeDocumentMoniker": "..\\..\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"RelativeToolTip": "..\\..\\InkCanvasForClass\\Hardcodet.NotifyIcon.Wpf.dll",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001697|",
|
|
||||||
"WhenOpened": "2025-05-24T13:02:22.113Z"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
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.
@@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\icc.png||{177559E0-D141-11D0-92DF-00A0C9138C45}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:icc.png||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\AutomaticUpdateVersionControl.txt||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:AutomaticUpdateVersionControl.txt||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 200,
|
|
||||||
"SelectedChildIndex": 0,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "icc.png",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\icc.png",
|
|
||||||
"RelativeDocumentMoniker": "icc.png",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\icc.png",
|
|
||||||
"RelativeToolTip": "icc.png",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001533|",
|
|
||||||
"WhenOpened": "2025-05-24T13:12:49.619Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\AutomaticUpdateVersionControl.txt",
|
|
||||||
"RelativeDocumentMoniker": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\AutomaticUpdateVersionControl.txt",
|
|
||||||
"RelativeToolTip": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|",
|
|
||||||
"WhenOpened": "2025-05-24T13:12:49.575Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": ".gitignore",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\.gitignore",
|
|
||||||
"RelativeDocumentMoniker": ".gitignore",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\.gitignore",
|
|
||||||
"RelativeToolTip": ".gitignore",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
|
||||||
"WhenOpened": "2025-05-24T13:12:49.025Z"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\icc.png||{177559E0-D141-11D0-92DF-00A0C9138C45}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:icc.png||{177559E0-D141-11D0-92DF-00A0C9138C45}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\AutomaticUpdateVersionControl.txt||{8B382828-6202-11D1-8870-0000F87579D2}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:AutomaticUpdateVersionControl.txt||{8B382828-6202-11D1-8870-0000F87579D2}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
|
||||||
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 200,
|
|
||||||
"SelectedChildIndex": 1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "icc.png - PNG [1328x1328, 32 \u4F4D, PNG]",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\icc.png",
|
|
||||||
"RelativeDocumentMoniker": "icc.png",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\icc.png - PNG [1328x1328, 32 \u4F4D, PNG]",
|
|
||||||
"RelativeToolTip": "icc.png - PNG [1328x1328, 32 \u4F4D, PNG]",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001533|",
|
|
||||||
"WhenOpened": "2025-05-24T13:12:49.619Z",
|
|
||||||
"EditorCaption": " - PNG [1328x1328, 32 \u4F4D, PNG]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\AutomaticUpdateVersionControl.txt",
|
|
||||||
"RelativeDocumentMoniker": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\AutomaticUpdateVersionControl.txt",
|
|
||||||
"RelativeToolTip": "AutomaticUpdateVersionControl.txt",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|",
|
|
||||||
"WhenOpened": "2025-05-24T13:12:49.575Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": ".gitignore",
|
|
||||||
"DocumentMoniker": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\.gitignore",
|
|
||||||
"RelativeDocumentMoniker": ".gitignore",
|
|
||||||
"ToolTip": "C:\\Users\\Administrator\\Desktop\\ICC CE\\icc-0610.2.3\\.gitignore",
|
|
||||||
"RelativeToolTip": ".gitignore",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
|
||||||
"WhenOpened": "2025-05-24T13:12:49.025Z"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
1.7.2.0
|
1.7.18.0
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
|
||||||
<s:String x:Key="/Default/CodeInspection/PencilsConfiguration/ActualSeverity/@EntryValue">WARNING</s:String></wpf:ResourceDictionary>
|
|
||||||
+4
-5
@@ -4,13 +4,13 @@
|
|||||||
xmlns:local="clr-namespace:Ink_Canvas"
|
xmlns:local="clr-namespace:Ink_Canvas"
|
||||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
StartupUri="MainWindow.xaml">
|
>
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<Style TargetType="ui:ScrollViewerEx">
|
<Style TargetType="ui:ScrollViewerEx">
|
||||||
<EventSetter Event="PreviewMouseWheel" Handler="ScrollViewer_PreviewMouseWheel"/>
|
<EventSetter Event="PreviewMouseWheel" Handler="ScrollViewer_PreviewMouseWheel"/>
|
||||||
</Style>
|
</Style>
|
||||||
<ContextMenu Opened="SysTrayMenu_Opened" x:Shared="false" x:Key="SysTrayMenu" Padding="6" ui:ThemeManager.RequestedTheme="Light">
|
<ContextMenu Opened="SysTrayMenu_Opened" Closed="SysTrayMenu_Closed" x:Shared="false" x:Key="SysTrayMenu" Padding="6" ui:ThemeManager.RequestedTheme="Light">
|
||||||
<MenuItem IsCheckable="True" IsChecked="False" Checked="HideICCMainWindowTrayIconMenuItem_Checked" Unchecked="HideICCMainWindowTrayIconMenuItem_UnChecked" Name="HideICCMainWindowTrayIconMenuItem">
|
<MenuItem IsCheckable="True" IsChecked="False" Checked="HideICCMainWindowTrayIconMenuItem_Checked" Unchecked="HideICCMainWindowTrayIconMenuItem_UnChecked" Name="HideICCMainWindowTrayIconMenuItem">
|
||||||
<MenuItem.Header>
|
<MenuItem.Header>
|
||||||
<ui:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
|
<ui:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Separator Margin="0,3" />
|
<Separator Margin="0,3" />
|
||||||
<MenuItem>
|
<MenuItem Name="DisableAllHotkeysMenuItem" Click="DisableAllHotkeysMenuItem_Clicked">
|
||||||
<MenuItem.Header>
|
<MenuItem.Header>
|
||||||
<ui:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
|
<ui:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
|
||||||
<TextBlock FontSize="14" VerticalAlignment="Center" Foreground="#18181b" Text="禁用所有快捷键" />
|
<TextBlock FontSize="14" VerticalAlignment="Center" Foreground="#18181b" Text="禁用所有快捷键" />
|
||||||
@@ -232,12 +232,11 @@
|
|||||||
ContextMenu="{StaticResource SysTrayMenu}"
|
ContextMenu="{StaticResource SysTrayMenu}"
|
||||||
IconSource="/Resources/icc.ico"/>
|
IconSource="/Resources/icc.ico"/>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ui:ThemeResources RequestedTheme="Light"/>
|
<ui:ThemeResources/>
|
||||||
<ui:XamlControlsResources />
|
<ui:XamlControlsResources />
|
||||||
<ResourceDictionary Source="Resources/SeewoImageDictionary.xaml"/>
|
<ResourceDictionary Source="Resources/SeewoImageDictionary.xaml"/>
|
||||||
<ResourceDictionary Source="Resources/DrawShapeImageDictionary.xaml"/>
|
<ResourceDictionary Source="Resources/DrawShapeImageDictionary.xaml"/>
|
||||||
<ResourceDictionary Source="Resources/IconImageDictionary.xaml"/>
|
<ResourceDictionary Source="Resources/IconImageDictionary.xaml"/>
|
||||||
<ResourceDictionary Source="Resources/Styles/Light.xaml"/>
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
+761
-691
File diff suppressed because it is too large
Load Diff
@@ -8,9 +8,9 @@ using System.Windows;
|
|||||||
[assembly: AssemblyTitle("InkCanvasForClass")]
|
[assembly: AssemblyTitle("InkCanvasForClass")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Dubi906w")]
|
[assembly: AssemblyCompany("CJK_mkp")]
|
||||||
[assembly: AssemblyProduct("InkCanvasForClass")]
|
[assembly: AssemblyProduct("InkCanvasForClass")]
|
||||||
[assembly: AssemblyCopyright("Copyright © HARKOTEK Studio 2024")]
|
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025-2026")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -49,5 +49,5 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.7.2.0")]
|
[assembly: AssemblyVersion("1.7.18.5")]
|
||||||
[assembly: AssemblyFileVersion("1.7.2.0")]
|
[assembly: AssemblyFileVersion("1.7.18.5")]
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<UserControl x:Class="Ink_Canvas.Controls.QuickDrawFloatingButtonControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Width="65" Height="45">
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<!-- 悬浮按钮资源 -->
|
||||||
|
<SolidColorBrush x:Key="QuickDrawFloatingButtonBackground" Color="#80000000"/>
|
||||||
|
<SolidColorBrush x:Key="QuickDrawFloatingButtonBorderBrush" Color="#40000000"/>
|
||||||
|
<SolidColorBrush x:Key="QuickDrawFloatingButtonIconForeground" Color="White"/>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
<Border Background="{DynamicResource QuickDrawFloatingButtonBackground}"
|
||||||
|
CornerRadius="8"
|
||||||
|
BorderThickness="1"
|
||||||
|
BorderBrush="{DynamicResource QuickDrawFloatingButtonBorderBrush}">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect Color="Black" Direction="315" ShadowDepth="3" Opacity="0.3" BlurRadius="5"/>
|
||||||
|
</Border.Effect>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="22"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 拖动区域 -->
|
||||||
|
<Border Grid.Column="0"
|
||||||
|
MouseLeftButtonDown="DragArea_MouseLeftButtonDown"
|
||||||
|
MouseMove="DragArea_MouseMove"
|
||||||
|
MouseLeftButtonUp="DragArea_MouseLeftButtonUp"
|
||||||
|
Cursor="SizeAll"
|
||||||
|
Background="Transparent">
|
||||||
|
<Grid VerticalAlignment="Center" Height="14" IsHitTestVisible="False">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="4"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="4"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 三个白色横线 -->
|
||||||
|
<Border Grid.Row="0" Background="{DynamicResource QuickDrawFloatingButtonIconForeground}" Height="2" Width="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
CornerRadius="1" Opacity="0.8" IsHitTestVisible="False"/>
|
||||||
|
<Border Grid.Row="2" Background="{DynamicResource QuickDrawFloatingButtonIconForeground}" Height="2" Width="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
CornerRadius="1" Opacity="0.8" IsHitTestVisible="False"/>
|
||||||
|
<Border Grid.Row="4" Background="{DynamicResource QuickDrawFloatingButtonIconForeground}" Height="2" Width="10"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
CornerRadius="1" Opacity="0.8" IsHitTestVisible="False"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- 半透明分割线 -->
|
||||||
|
<Rectangle Grid.Column="1" Width="1" Fill="#20FFFFFF" Margin="0,8,0,8"/>
|
||||||
|
|
||||||
|
<!-- 按钮区域 -->
|
||||||
|
<Border Grid.Column="2"
|
||||||
|
MouseLeftButtonDown="FloatingButton_Click"
|
||||||
|
Cursor="Hand"
|
||||||
|
Background="Transparent">
|
||||||
|
<Grid IsHitTestVisible="False">
|
||||||
|
<Path Data="M5 7C5 8.06087 5.42143 9.07828 6.17157 9.82843C6.92172 10.5786 7.93913 11 9 11C10.0609 11 11.0783 10.5786 11.8284 9.82843C12.5786 9.07828 13 8.06087 13 7C13 5.93913 12.5786 4.92172 11.8284 4.17157C11.0783 3.42143 10.0609 3 9 3C7.93913 3 6.92172 3.42143 6.17157 4.17157C5.42143 4.92172 5 5.93913 5 7Z M3 21V19C3 17.9391 3.42143 16.9217 4.17157 16.1716C4.92172 15.4214 5.93913 15 7 15H11C12.0609 15 13.0783 15.4214 13.8284 16.1716C14.5786 16.9217 15 17.9391 15 19V21 M16 3.13C16.8604 3.35031 17.623 3.85071 18.1676 4.55232C18.7122 5.25392 19.0078 6.11683 19.0078 7.005C19.0078 7.89318 18.7122 8.75608 18.1676 9.45769C17.623 10.1593 16.8604 10.6597 16 10.88 M21 21V19C20.9949 18.1172 20.6979 17.2608 20.1553 16.5644C19.6126 15.868 18.8548 15.3707 18 15.15"
|
||||||
|
Stroke="{DynamicResource QuickDrawFloatingButtonIconForeground}"
|
||||||
|
StrokeThickness="2"
|
||||||
|
StrokeLineJoin="Round"
|
||||||
|
Fill="Transparent"
|
||||||
|
Width="20" Height="20"
|
||||||
|
Stretch="Uniform"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
IsHitTestVisible="False"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
|
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using HorizontalAlignment = System.Windows.HorizontalAlignment;
|
||||||
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
|
using VerticalAlignment = System.Windows.VerticalAlignment;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 快抽悬浮按钮控件
|
||||||
|
/// </summary>
|
||||||
|
public partial class QuickDrawFloatingButtonControl : UserControl
|
||||||
|
{
|
||||||
|
private bool _isDragging = false;
|
||||||
|
private Point _dragStartPoint;
|
||||||
|
private Point _controlStartPoint;
|
||||||
|
|
||||||
|
public QuickDrawFloatingButtonControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 快抽按钮点击事件
|
||||||
|
/// </summary>
|
||||||
|
private void FloatingButton_Click(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 如果正在拖动,不触发点击事件
|
||||||
|
if (_isDragging) return;
|
||||||
|
|
||||||
|
// 打开快抽窗口
|
||||||
|
var quickDrawWindow = new QuickDrawWindow();
|
||||||
|
quickDrawWindow.ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Helpers.LogHelper.WriteLogToFile($"打开快抽窗口失败: {ex.Message}", Helpers.LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拖动区域鼠标按下事件
|
||||||
|
/// </summary>
|
||||||
|
private void DragArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
_isDragging = false;
|
||||||
|
|
||||||
|
// 记录鼠标在屏幕上的初始位置
|
||||||
|
_dragStartPoint = this.PointToScreen(e.GetPosition(this));
|
||||||
|
|
||||||
|
// 记录控件的初始位置
|
||||||
|
var parent = this.Parent as FrameworkElement;
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
var transform = this.TransformToVisual(parent);
|
||||||
|
var currentPos = transform.Transform(new Point(0, 0));
|
||||||
|
_controlStartPoint = currentPos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var currentMargin = this.Margin;
|
||||||
|
_controlStartPoint = new Point(
|
||||||
|
double.IsNaN(currentMargin.Left) ? 0 : currentMargin.Left,
|
||||||
|
double.IsNaN(currentMargin.Top) ? 0 : currentMargin.Top);
|
||||||
|
}
|
||||||
|
|
||||||
|
((UIElement)sender).CaptureMouse();
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拖动区域鼠标移动事件
|
||||||
|
/// </summary>
|
||||||
|
private void DragArea_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed && ((UIElement)sender).IsMouseCaptured)
|
||||||
|
{
|
||||||
|
// 获取鼠标在屏幕上的当前位置
|
||||||
|
Point currentScreenPoint = this.PointToScreen(e.GetPosition(this));
|
||||||
|
Vector diff = currentScreenPoint - _dragStartPoint;
|
||||||
|
|
||||||
|
if (!_isDragging && (Math.Abs(diff.X) > 3 || Math.Abs(diff.Y) > 3))
|
||||||
|
{
|
||||||
|
_isDragging = true;
|
||||||
|
// 切换到绝对定位模式
|
||||||
|
this.HorizontalAlignment = HorizontalAlignment.Left;
|
||||||
|
this.VerticalAlignment = VerticalAlignment.Top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_isDragging)
|
||||||
|
{
|
||||||
|
// 计算新位置
|
||||||
|
var parent = this.Parent as FrameworkElement;
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
// 计算屏幕坐标相对于父容器的位置
|
||||||
|
var parentPoint = parent.PointFromScreen(currentScreenPoint);
|
||||||
|
var startParentPoint = parent.PointFromScreen(_dragStartPoint);
|
||||||
|
|
||||||
|
// 计算相对于初始位置的偏移
|
||||||
|
double offsetX = parentPoint.X - startParentPoint.X;
|
||||||
|
double offsetY = parentPoint.Y - startParentPoint.Y;
|
||||||
|
|
||||||
|
// 新位置 = 初始位置 + 偏移
|
||||||
|
double newLeft = _controlStartPoint.X + offsetX;
|
||||||
|
double newTop = _controlStartPoint.Y + offsetY;
|
||||||
|
|
||||||
|
// 限制在父容器范围内
|
||||||
|
newLeft = Math.Max(0, Math.Min(newLeft, parent.ActualWidth - this.ActualWidth));
|
||||||
|
newTop = Math.Max(0, Math.Min(newTop, parent.ActualHeight - this.ActualHeight));
|
||||||
|
|
||||||
|
// 更新Margin
|
||||||
|
this.Margin = new Thickness(newLeft, newTop, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拖动区域鼠标释放事件
|
||||||
|
/// </summary>
|
||||||
|
private void DragArea_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (((UIElement)sender).IsMouseCaptured)
|
||||||
|
{
|
||||||
|
((UIElement)sender).ReleaseMouseCapture();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_isDragging)
|
||||||
|
{
|
||||||
|
Dispatcher.BeginInvoke(new Action(() => { _isDragging = false; }),
|
||||||
|
DispatcherPriority.Background);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isDragging = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||||
|
<Costura ExcludeAssemblies="IACore|IALoader|IAWinFX" />
|
||||||
|
</Weavers>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,215 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 自动备份管理器
|
||||||
|
/// 负责管理配置文件的自动备份功能
|
||||||
|
/// </summary>
|
||||||
|
public static class AutoBackupManager
|
||||||
|
{
|
||||||
|
private static readonly string BackupDir = Path.Combine(App.RootPath, "Backups");
|
||||||
|
private static readonly string SettingsFile = Path.Combine(App.RootPath, "Configs", "Settings.json");
|
||||||
|
private static readonly string BackupPrefix = "Settings_AutoBackup_";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否需要执行自动备份
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settings">设置对象</param>
|
||||||
|
/// <returns>如果需要备份返回true,否则返回false</returns>
|
||||||
|
public static bool ShouldPerformAutoBackup(Settings settings)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 如果自动备份功能未启用,不执行备份
|
||||||
|
if (!settings.Advanced.IsAutoBackupEnabled)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果从未备份过,需要创建首次备份
|
||||||
|
if (settings.Advanced.LastAutoBackupTime == DateTime.MinValue)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否已超过备份间隔
|
||||||
|
var daysSinceLastBackup = (DateTime.Now - settings.Advanced.LastAutoBackupTime).TotalDays;
|
||||||
|
return daysSinceLastBackup >= settings.Advanced.AutoBackupIntervalDays;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"检查自动备份条件时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行自动备份
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settings">设置对象</param>
|
||||||
|
/// <returns>备份是否成功</returns>
|
||||||
|
public static bool PerformAutoBackup(Settings settings)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 确保备份目录存在
|
||||||
|
if (!Directory.Exists(BackupDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(BackupDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查主配置文件是否存在
|
||||||
|
if (!File.Exists(SettingsFile))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("主配置文件不存在,跳过自动备份", LogHelper.LogType.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建备份文件名(使用当前日期时间)
|
||||||
|
string backupFileName = $"{BackupPrefix}{DateTime.Now:yyyyMMdd_HHmmss}.json";
|
||||||
|
string backupPath = Path.Combine(BackupDir, backupFileName);
|
||||||
|
|
||||||
|
// 复制主配置文件到备份位置
|
||||||
|
File.Copy(SettingsFile, backupPath, true);
|
||||||
|
|
||||||
|
// 更新最后备份时间
|
||||||
|
settings.Advanced.LastAutoBackupTime = DateTime.Now;
|
||||||
|
MainWindow.SaveSettingsToFile();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"执行自动备份时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试从备份恢复配置文件
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>恢复是否成功</returns>
|
||||||
|
public static bool TryRestoreFromBackup()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 确保备份目录存在
|
||||||
|
if (!Directory.Exists(BackupDir))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("备份目录不存在,无法从备份恢复", LogHelper.LogType.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找最新的备份文件
|
||||||
|
var backupFiles = Directory.GetFiles(BackupDir, $"{BackupPrefix}*.json")
|
||||||
|
.OrderByDescending(f => File.GetCreationTime(f))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (backupFiles.Length == 0)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("没有找到可用的备份文件", LogHelper.LogType.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试使用最新的备份文件
|
||||||
|
string latestBackup = backupFiles[0];
|
||||||
|
|
||||||
|
// 验证备份文件是否有效
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string backupJson = File.ReadAllText(latestBackup);
|
||||||
|
var testSettings = JsonConvert.DeserializeObject<Settings>(backupJson);
|
||||||
|
if (testSettings == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("备份文件内容无效,无法恢复", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"备份文件验证失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 备份当前损坏的配置文件(如果存在)
|
||||||
|
if (File.Exists(SettingsFile))
|
||||||
|
{
|
||||||
|
string corruptedBackup = Path.Combine(BackupDir, $"Settings_Corrupted_{DateTime.Now:yyyyMMdd_HHmmss}.json");
|
||||||
|
File.Copy(SettingsFile, corruptedBackup, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从备份恢复配置文件
|
||||||
|
File.Copy(latestBackup, SettingsFile, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"从备份恢复配置文件时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理过期的备份文件
|
||||||
|
/// 保留最近30天的备份文件
|
||||||
|
/// </summary>
|
||||||
|
public static void CleanupOldBackups()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(BackupDir))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cutoffDate = DateTime.Now.AddDays(-30);
|
||||||
|
var backupFiles = Directory.GetFiles(BackupDir, $"{BackupPrefix}*.json");
|
||||||
|
|
||||||
|
int deletedCount = 0;
|
||||||
|
foreach (var file in backupFiles)
|
||||||
|
{
|
||||||
|
if (File.GetCreationTime(file) < cutoffDate)
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
deletedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deletedCount > 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理过期备份文件时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化自动备份功能
|
||||||
|
/// 在应用程序启动时调用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settings">设置对象</param>
|
||||||
|
public static void Initialize(Settings settings)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查是否需要执行自动备份
|
||||||
|
if (ShouldPerformAutoBackup(settings))
|
||||||
|
{
|
||||||
|
PerformAutoBackup(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理过期备份
|
||||||
|
CleanupOldBackups();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"初始化自动备份功能时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1297
-416
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers
|
namespace Ink_Canvas.Helpers
|
||||||
@@ -8,15 +9,15 @@ namespace Ink_Canvas.Helpers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 防止窗口进入全屏状态的辅助类
|
/// 防止窗口进入全屏状态的辅助类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static partial class AvoidFullScreenHelper
|
public static class AvoidFullScreenHelper
|
||||||
{
|
{
|
||||||
private static readonly DependencyProperty IsAvoidFullScreenEnabledProperty =
|
private static readonly DependencyProperty IsAvoidFullScreenEnabledProperty =
|
||||||
DependencyProperty.RegisterAttached(
|
DependencyProperty.RegisterAttached(
|
||||||
"IsAvoidFullScreenEnabled",
|
"IsAvoidFullScreenEnabled",
|
||||||
typeof(bool),
|
typeof(bool),
|
||||||
typeof(AvoidFullScreenHelper));
|
typeof(AvoidFullScreenHelper));
|
||||||
|
|
||||||
private static bool _isBoardMode = false;
|
private static bool _isBoardMode;
|
||||||
public static void SetBoardMode(bool isBoardMode)
|
public static void SetBoardMode(bool isBoardMode)
|
||||||
{
|
{
|
||||||
_isBoardMode = isBoardMode;
|
_isBoardMode = isBoardMode;
|
||||||
@@ -120,20 +121,20 @@ namespace Ink_Canvas.Helpers
|
|||||||
private static Rect GetWorkingArea(Rect windowRect)
|
private static Rect GetWorkingArea(Rect windowRect)
|
||||||
{
|
{
|
||||||
// 获取所有显示器
|
// 获取所有显示器
|
||||||
var screens = System.Windows.Forms.Screen.AllScreens;
|
var screens = Screen.AllScreens;
|
||||||
|
|
||||||
// 确定窗口主要位于哪个显示器上
|
// 确定窗口主要位于哪个显示器上
|
||||||
System.Windows.Forms.Screen targetScreen = null;
|
Screen targetScreen = null;
|
||||||
double maxIntersection = 0;
|
double maxIntersection = 0;
|
||||||
|
|
||||||
foreach (var screen in screens)
|
foreach (var screen in screens)
|
||||||
{
|
{
|
||||||
var screenRect = new Rect(
|
var screenRect = new Rect(
|
||||||
screen.WorkingArea.X,
|
screen.WorkingArea.X,
|
||||||
screen.WorkingArea.Y,
|
screen.WorkingArea.Y,
|
||||||
screen.WorkingArea.Width,
|
screen.WorkingArea.Width,
|
||||||
screen.WorkingArea.Height);
|
screen.WorkingArea.Height);
|
||||||
|
|
||||||
var intersection = Rect.Intersect(windowRect, screenRect);
|
var intersection = Rect.Intersect(windowRect, screenRect);
|
||||||
if (intersection.Width * intersection.Height > maxIntersection)
|
if (intersection.Width * intersection.Height > maxIntersection)
|
||||||
{
|
{
|
||||||
@@ -141,11 +142,11 @@ namespace Ink_Canvas.Helpers
|
|||||||
targetScreen = screen;
|
targetScreen = screen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没找到,使用主显示器
|
// 如果没找到,使用主显示器
|
||||||
if (targetScreen == null)
|
if (targetScreen == null)
|
||||||
targetScreen = System.Windows.Forms.Screen.PrimaryScreen;
|
targetScreen = Screen.PrimaryScreen;
|
||||||
|
|
||||||
return new Rect(
|
return new Rect(
|
||||||
targetScreen.WorkingArea.X,
|
targetScreen.WorkingArea.X,
|
||||||
targetScreen.WorkingArea.Y,
|
targetScreen.WorkingArea.Y,
|
||||||
@@ -158,21 +159,21 @@ namespace Ink_Canvas.Helpers
|
|||||||
// 调整尺寸以适应工作区域
|
// 调整尺寸以适应工作区域
|
||||||
if (windowRect.Width > workingArea.Width)
|
if (windowRect.Width > workingArea.Width)
|
||||||
windowRect.Width = workingArea.Width;
|
windowRect.Width = workingArea.Width;
|
||||||
|
|
||||||
if (windowRect.Height > workingArea.Height)
|
if (windowRect.Height > workingArea.Height)
|
||||||
windowRect.Height = workingArea.Height;
|
windowRect.Height = workingArea.Height;
|
||||||
|
|
||||||
// 调整位置以确保窗口完全在工作区域内
|
// 调整位置以确保窗口完全在工作区域内
|
||||||
if (windowRect.Left < workingArea.Left)
|
if (windowRect.Left < workingArea.Left)
|
||||||
windowRect.X = workingArea.Left;
|
windowRect.X = workingArea.Left;
|
||||||
else if (windowRect.Right > workingArea.Right)
|
else if (windowRect.Right > workingArea.Right)
|
||||||
windowRect.X = workingArea.Right - windowRect.Width;
|
windowRect.X = workingArea.Right - windowRect.Width;
|
||||||
|
|
||||||
if (windowRect.Top < workingArea.Top)
|
if (windowRect.Top < workingArea.Top)
|
||||||
windowRect.Y = workingArea.Top;
|
windowRect.Y = workingArea.Top;
|
||||||
else if (windowRect.Bottom > workingArea.Bottom)
|
else if (windowRect.Bottom > workingArea.Bottom)
|
||||||
windowRect.Y = workingArea.Bottom - windowRect.Height;
|
windowRect.Y = workingArea.Bottom - windowRect.Height;
|
||||||
|
|
||||||
return windowRect;
|
return windowRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,424 @@
|
|||||||
|
using AForge.Video;
|
||||||
|
using AForge.Video.DirectShow;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
public class CameraService : IDisposable
|
||||||
|
{
|
||||||
|
private VideoCaptureDevice _videoSource;
|
||||||
|
private bool _isCapturing;
|
||||||
|
private Bitmap _currentFrame;
|
||||||
|
private readonly object _frameLock = new object();
|
||||||
|
private Dispatcher _dispatcher;
|
||||||
|
|
||||||
|
// 新增属性
|
||||||
|
private int _rotationAngle = 0; // 0=0度,1=90度,2=180度,3=270度
|
||||||
|
private int _resolutionWidth = 640;
|
||||||
|
private int _resolutionHeight = 480;
|
||||||
|
|
||||||
|
public event EventHandler<Bitmap> FrameReceived;
|
||||||
|
public event EventHandler<string> ErrorOccurred;
|
||||||
|
|
||||||
|
public bool IsCapturing => _isCapturing;
|
||||||
|
public List<FilterInfo> AvailableCameras { get; private set; }
|
||||||
|
public FilterInfo CurrentCamera { get; private set; }
|
||||||
|
|
||||||
|
// 新增属性
|
||||||
|
public int RotationAngle
|
||||||
|
{
|
||||||
|
get => _rotationAngle;
|
||||||
|
set => _rotationAngle = Math.Max(0, Math.Min(3, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ResolutionWidth
|
||||||
|
{
|
||||||
|
get => _resolutionWidth;
|
||||||
|
set => _resolutionWidth = Math.Max(320, Math.Min(1920, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ResolutionHeight
|
||||||
|
{
|
||||||
|
get => _resolutionHeight;
|
||||||
|
set => _resolutionHeight = Math.Max(240, Math.Min(1080, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CameraService()
|
||||||
|
{
|
||||||
|
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
AvailableCameras = new List<FilterInfo>();
|
||||||
|
RefreshCameraList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CameraService(int rotationAngle, int resolutionWidth, int resolutionHeight)
|
||||||
|
{
|
||||||
|
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
AvailableCameras = new List<FilterInfo>();
|
||||||
|
_rotationAngle = rotationAngle;
|
||||||
|
_resolutionWidth = resolutionWidth;
|
||||||
|
_resolutionHeight = resolutionHeight;
|
||||||
|
RefreshCameraList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新可用摄像头列表
|
||||||
|
/// </summary>
|
||||||
|
public void RefreshCameraList()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AvailableCameras.Clear();
|
||||||
|
var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||||
|
|
||||||
|
foreach (FilterInfo device in videoDevices)
|
||||||
|
{
|
||||||
|
AvailableCameras.Add(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"刷新摄像头列表失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
ErrorOccurred?.Invoke(this, $"刷新摄像头列表失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始摄像头预览
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cameraIndex">摄像头索引</param>
|
||||||
|
public bool StartPreview(int cameraIndex = 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (AvailableCameras.Count == 0)
|
||||||
|
{
|
||||||
|
RefreshCameraList();
|
||||||
|
if (AvailableCameras.Count == 0)
|
||||||
|
{
|
||||||
|
ErrorOccurred?.Invoke(this, "未找到可用的摄像头设备");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraIndex < 0 || cameraIndex >= AvailableCameras.Count)
|
||||||
|
{
|
||||||
|
ErrorOccurred?.Invoke(this, "摄像头索引超出范围");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停止当前预览
|
||||||
|
StopPreview();
|
||||||
|
|
||||||
|
CurrentCamera = AvailableCameras[cameraIndex];
|
||||||
|
_videoSource = new VideoCaptureDevice(CurrentCamera.MonikerString);
|
||||||
|
|
||||||
|
// 设置视频源事件处理
|
||||||
|
_videoSource.NewFrame += VideoSource_NewFrame;
|
||||||
|
|
||||||
|
// 启动视频源
|
||||||
|
_videoSource.Start();
|
||||||
|
|
||||||
|
_isCapturing = true;
|
||||||
|
LogHelper.WriteLogToFile($"开始摄像头预览: {CurrentCamera.Name}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"启动摄像头预览失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
ErrorOccurred?.Invoke(this, $"启动摄像头预览失败: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止摄像头预览
|
||||||
|
/// </summary>
|
||||||
|
public void StopPreview()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_videoSource != null && _videoSource.IsRunning)
|
||||||
|
{
|
||||||
|
_videoSource.SignalToStop();
|
||||||
|
_videoSource.WaitForStop();
|
||||||
|
_videoSource.NewFrame -= VideoSource_NewFrame;
|
||||||
|
_videoSource = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isCapturing = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"停止摄像头预览失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 切换到指定摄像头
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cameraIndex">摄像头索引</param>
|
||||||
|
public bool SwitchCamera(int cameraIndex)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (cameraIndex < 0 || cameraIndex >= AvailableCameras.Count)
|
||||||
|
{
|
||||||
|
ErrorOccurred?.Invoke(this, "摄像头索引超出范围");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StartPreview(cameraIndex);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"切换摄像头失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
ErrorOccurred?.Invoke(this, $"切换摄像头失败: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前帧的BitmapSource(WPF格式),直接返回可用的WPF位图
|
||||||
|
/// </summary>
|
||||||
|
public BitmapSource GetCurrentFrameAsBitmapSource()
|
||||||
|
{
|
||||||
|
lock (_frameLock)
|
||||||
|
{
|
||||||
|
if (_currentFrame == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 验证位图有效性
|
||||||
|
if (_currentFrame.Width <= 0 || _currentFrame.Height <= 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// 使用更安全的方法转换位图
|
||||||
|
var bitmapData = _currentFrame.LockBits(
|
||||||
|
new Rectangle(0, 0, _currentFrame.Width, _currentFrame.Height),
|
||||||
|
ImageLockMode.ReadOnly,
|
||||||
|
_currentFrame.PixelFormat);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 根据像素格式选择合适的WPF像素格式
|
||||||
|
System.Windows.Media.PixelFormat wpfPixelFormat;
|
||||||
|
switch (_currentFrame.PixelFormat)
|
||||||
|
{
|
||||||
|
case PixelFormat.Format24bppRgb:
|
||||||
|
wpfPixelFormat = System.Windows.Media.PixelFormats.Bgr24;
|
||||||
|
break;
|
||||||
|
case PixelFormat.Format32bppArgb:
|
||||||
|
wpfPixelFormat = System.Windows.Media.PixelFormats.Bgra32;
|
||||||
|
break;
|
||||||
|
case PixelFormat.Format32bppRgb:
|
||||||
|
wpfPixelFormat = System.Windows.Media.PixelFormats.Bgr32;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wpfPixelFormat = System.Windows.Media.PixelFormats.Bgr24;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bitmapSource = BitmapSource.Create(
|
||||||
|
bitmapData.Width,
|
||||||
|
bitmapData.Height,
|
||||||
|
_currentFrame.HorizontalResolution,
|
||||||
|
_currentFrame.VerticalResolution,
|
||||||
|
wpfPixelFormat,
|
||||||
|
null,
|
||||||
|
bitmapData.Scan0,
|
||||||
|
bitmapData.Stride * bitmapData.Height,
|
||||||
|
bitmapData.Stride);
|
||||||
|
|
||||||
|
bitmapSource.Freeze();
|
||||||
|
return bitmapSource;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_currentFrame.UnlockBits(bitmapData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"转换帧为BitmapSource失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 视频源新帧事件处理
|
||||||
|
/// </summary>
|
||||||
|
private void VideoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (_frameLock)
|
||||||
|
{
|
||||||
|
// 释放之前的帧
|
||||||
|
_currentFrame?.Dispose();
|
||||||
|
|
||||||
|
// 创建新的位图,避免Clone的问题
|
||||||
|
var sourceFrame = eventArgs.Frame;
|
||||||
|
|
||||||
|
if (sourceFrame != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var width = sourceFrame.Width;
|
||||||
|
var height = sourceFrame.Height;
|
||||||
|
|
||||||
|
if (width > 0 && height > 0)
|
||||||
|
{
|
||||||
|
// 应用旋转
|
||||||
|
Bitmap rotatedFrame = ApplyRotation(sourceFrame);
|
||||||
|
|
||||||
|
int targetWidth = _resolutionWidth;
|
||||||
|
int targetHeight = _resolutionHeight;
|
||||||
|
|
||||||
|
if (_rotationAngle == 1 || _rotationAngle == 3)
|
||||||
|
{
|
||||||
|
targetWidth = _resolutionHeight;
|
||||||
|
targetHeight = _resolutionWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentFrame = ResizeImageWithAspectRatio(rotatedFrame, targetWidth, targetHeight);
|
||||||
|
|
||||||
|
rotatedFrame?.Dispose();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_currentFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception frameEx)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理源帧失败: {frameEx.Message}", LogHelper.LogType.Error);
|
||||||
|
_currentFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_currentFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在UI线程中触发事件
|
||||||
|
_dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
FrameReceived?.Invoke(this, _currentFrame);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理新帧失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
ErrorOccurred?.Invoke(this, $"处理新帧失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取摄像头名称列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> GetCameraNames()
|
||||||
|
{
|
||||||
|
return AvailableCameras.Select(camera => camera.Name).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否有可用摄像头
|
||||||
|
/// </summary>
|
||||||
|
public bool HasAvailableCameras()
|
||||||
|
{
|
||||||
|
if (AvailableCameras.Count == 0)
|
||||||
|
{
|
||||||
|
RefreshCameraList();
|
||||||
|
}
|
||||||
|
return AvailableCameras.Count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用旋转到图像
|
||||||
|
/// </summary>
|
||||||
|
private Bitmap ApplyRotation(Bitmap source)
|
||||||
|
{
|
||||||
|
if (_rotationAngle == 0)
|
||||||
|
return new Bitmap(source);
|
||||||
|
|
||||||
|
var rotationType = RotateFlipType.RotateNoneFlipNone;
|
||||||
|
switch (_rotationAngle)
|
||||||
|
{
|
||||||
|
case 1: rotationType = RotateFlipType.Rotate90FlipNone; break;
|
||||||
|
case 2: rotationType = RotateFlipType.Rotate180FlipNone; break;
|
||||||
|
case 3: rotationType = RotateFlipType.Rotate270FlipNone; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rotated = new Bitmap(source);
|
||||||
|
rotated.RotateFlip(rotationType);
|
||||||
|
return rotated;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 调整图像大小
|
||||||
|
/// </summary>
|
||||||
|
private Bitmap ResizeImageWithAspectRatio(Bitmap source, int targetWidth, int targetHeight)
|
||||||
|
{
|
||||||
|
if (source.Width == targetWidth && source.Height == targetHeight)
|
||||||
|
return new Bitmap(source);
|
||||||
|
|
||||||
|
double scaleX = (double)targetWidth / source.Width;
|
||||||
|
double scaleY = (double)targetHeight / source.Height;
|
||||||
|
double scale = Math.Min(scaleX, scaleY);
|
||||||
|
|
||||||
|
// 计算实际尺寸
|
||||||
|
int actualWidth = (int)(source.Width * scale);
|
||||||
|
int actualHeight = (int)(source.Height * scale);
|
||||||
|
|
||||||
|
var resized = new Bitmap(actualWidth, actualHeight, PixelFormat.Format24bppRgb);
|
||||||
|
using (var graphics = Graphics.FromImage(resized))
|
||||||
|
{
|
||||||
|
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||||
|
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||||
|
graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
|
||||||
|
graphics.DrawImage(source, 0, 0, actualWidth, actualHeight);
|
||||||
|
}
|
||||||
|
return resized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 调整图像大小
|
||||||
|
/// </summary>
|
||||||
|
private Bitmap ResizeImage(Bitmap source, int width, int height)
|
||||||
|
{
|
||||||
|
if (source.Width == width && source.Height == height)
|
||||||
|
return new Bitmap(source);
|
||||||
|
|
||||||
|
var resized = new Bitmap(width, height, PixelFormat.Format24bppRgb);
|
||||||
|
using (var graphics = Graphics.FromImage(resized))
|
||||||
|
{
|
||||||
|
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||||
|
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||||
|
graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
|
||||||
|
graphics.DrawImage(source, 0, 0, width, height);
|
||||||
|
}
|
||||||
|
return resized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
StopPreview();
|
||||||
|
|
||||||
|
lock (_frameLock)
|
||||||
|
{
|
||||||
|
_currentFrame?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,125 +9,147 @@ namespace Ink_Canvas.Converter
|
|||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if ((bool)value == true)
|
if ((bool)value)
|
||||||
{
|
{
|
||||||
return Visibility.Visible;
|
return Visibility.Visible;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Visibility.Collapsed;
|
||||||
return Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if ((bool)value == true)
|
if ((bool)value)
|
||||||
{
|
{
|
||||||
return Visibility.Visible;
|
return Visibility.Visible;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Visibility.Collapsed;
|
||||||
return Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class VisibilityConverter : IValueConverter
|
public class VisibilityConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
Visibility visibility = (Visibility)value;
|
Visibility visibility = (Visibility)value;
|
||||||
if (visibility == Visibility.Visible)
|
if (visibility == Visibility.Visible)
|
||||||
{
|
{
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Visibility.Visible;
|
||||||
return Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
Visibility visibility = (Visibility)value;
|
Visibility visibility = (Visibility)value;
|
||||||
if (visibility == Visibility.Visible)
|
if (visibility == Visibility.Visible)
|
||||||
{
|
{
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Visibility.Visible;
|
||||||
return Visibility.Visible;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IntNumberToString : IValueConverter
|
public class IntNumberToString : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if ((double)value == 0)
|
if ((double)value == 0)
|
||||||
{
|
{
|
||||||
return "无限制";
|
return "无限制";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return ((double)value) + "人";
|
||||||
return ((double)value).ToString() + "人";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if ((double)value == 0)
|
if ((double)value == 0)
|
||||||
{
|
{
|
||||||
return "无限制";
|
return "无限制";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return ((double)value) + "人";
|
||||||
return ((double)value).ToString() + "人";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IntNumberToString2 : IValueConverter
|
public class IntNumberToString2 : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if ((double)value == 0)
|
if ((double)value == 0)
|
||||||
{
|
{
|
||||||
return "自动截图";
|
return "自动截图";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return ((double)value) + "条";
|
||||||
return ((double)value).ToString() + "条";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if ((double)value == 0)
|
if ((double)value == 0)
|
||||||
{
|
{
|
||||||
return "自动截图";
|
return "自动截图";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return ((double)value) + "条";
|
||||||
return ((double)value).ToString() + "条";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IsEnabledToOpacityConverter : IValueConverter
|
public class IsEnabledToOpacityConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
bool isChecked = (bool)value;
|
bool isChecked = (bool)value;
|
||||||
if (isChecked == true)
|
if (isChecked)
|
||||||
{
|
{
|
||||||
return 1d;
|
return 1d;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return 0.35;
|
||||||
return 0.35;
|
}
|
||||||
}
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InverseBooleanToVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if ((bool)value)
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if ((bool)value)
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RippleEffectTranslationConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is double d)
|
||||||
|
{
|
||||||
|
return -d / 2;
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +1,64 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers {
|
namespace Ink_Canvas.Helpers
|
||||||
internal class DelAutoSavedFiles {
|
{
|
||||||
public static void DeleteFilesOlder(string directoryPath, int daysThreshold) {
|
internal class DelAutoSavedFiles
|
||||||
|
{
|
||||||
|
public static void DeleteFilesOlder(string directoryPath, int daysThreshold)
|
||||||
|
{
|
||||||
string[] extensionsToDel = { ".icstk", ".png" };
|
string[] extensionsToDel = { ".icstk", ".png" };
|
||||||
if (Directory.Exists(directoryPath)) {
|
if (Directory.Exists(directoryPath))
|
||||||
|
{
|
||||||
// 获取目录中的所有子目录
|
// 获取目录中的所有子目录
|
||||||
string[] subDirectories = Directory.GetDirectories(directoryPath, "*", SearchOption.AllDirectories);
|
string[] subDirectories = Directory.GetDirectories(directoryPath, "*", SearchOption.AllDirectories);
|
||||||
foreach (string subDirectory in subDirectories) {
|
foreach (string subDirectory in subDirectories)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
// 获取子目录下的所有文件
|
// 获取子目录下的所有文件
|
||||||
string[] files = Directory.GetFiles(subDirectory);
|
string[] files = Directory.GetFiles(subDirectory);
|
||||||
foreach (string filePath in files) {
|
foreach (string filePath in files)
|
||||||
|
{
|
||||||
// 获取文件的创建日期
|
// 获取文件的创建日期
|
||||||
DateTime creationDate = File.GetCreationTime(filePath);
|
DateTime creationDate = File.GetCreationTime(filePath);
|
||||||
// 获取文件的扩展名
|
// 获取文件的扩展名
|
||||||
string fileExtension = Path.GetExtension(filePath);
|
string fileExtension = Path.GetExtension(filePath);
|
||||||
// 如果文件的创建日期早于指定天数且是要删除的扩展名,则删除文件
|
// 如果文件的创建日期早于指定天数且是要删除的扩展名,则删除文件
|
||||||
if (creationDate < DateTime.Now.AddDays(-daysThreshold)) {
|
if (creationDate < DateTime.Now.AddDays(-daysThreshold))
|
||||||
|
{
|
||||||
if (Array.Exists(extensionsToDel, ext => ext.Equals(fileExtension, StringComparison.OrdinalIgnoreCase))
|
if (Array.Exists(extensionsToDel, ext => ext.Equals(fileExtension, StringComparison.OrdinalIgnoreCase))
|
||||||
|| Path.GetFileName(filePath).Equals("Position", StringComparison.OrdinalIgnoreCase)) {
|
|| Path.GetFileName(filePath).Equals("Position", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
File.Delete(filePath);
|
File.Delete(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
}
|
||||||
LogHelper.WriteLogToFile("DelAutoSavedFiles | 处理文件时出错: " + ex.ToString(), LogHelper.LogType.Error);
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("DelAutoSavedFiles | 处理文件时出错: " + ex, LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try { // 递归删除空文件夹
|
try
|
||||||
|
{ // 递归删除空文件夹
|
||||||
DeleteEmptyFolders(directoryPath);
|
DeleteEmptyFolders(directoryPath);
|
||||||
} catch (Exception ex) {
|
}
|
||||||
LogHelper.WriteLogToFile("DelAutoSavedFiles | 处理文件时出错: " + ex.ToString(), LogHelper.LogType.Error);
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("DelAutoSavedFiles | 处理文件时出错: " + ex, LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DeleteEmptyFolders(string directoryPath) {
|
private static void DeleteEmptyFolders(string directoryPath)
|
||||||
foreach (string dir in Directory.GetDirectories(directoryPath)) {
|
{
|
||||||
|
foreach (string dir in Directory.GetDirectories(directoryPath))
|
||||||
|
{
|
||||||
DeleteEmptyFolders(dir);
|
DeleteEmptyFolders(dir);
|
||||||
if (Directory.GetFiles(dir).Length == 0 && Directory.GetDirectories(dir).Length == 0) {
|
if (Directory.GetFiles(dir).Length == 0 && Directory.GetDirectories(dir).Length == 0)
|
||||||
|
{
|
||||||
Directory.Delete(dir, false);
|
Directory.Delete(dir, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,13 @@ namespace Ink_Canvas.Helpers
|
|||||||
/// <param name="inv">同步的對象,一般傳入控件,不需要可null</param>
|
/// <param name="inv">同步的對象,一般傳入控件,不需要可null</param>
|
||||||
public void DebounceAction(int timeMs, ISynchronizeInvoke inv, Action action)
|
public void DebounceAction(int timeMs, ISynchronizeInvoke inv, Action action)
|
||||||
{
|
{
|
||||||
lock (this) {
|
lock (this)
|
||||||
if (_timerDebounce == null) {
|
{
|
||||||
|
if (_timerDebounce == null)
|
||||||
|
{
|
||||||
_timerDebounce = new Timer(timeMs) { AutoReset = false };
|
_timerDebounce = new Timer(timeMs) { AutoReset = false };
|
||||||
_timerDebounce.Elapsed += (o, e) => {
|
_timerDebounce.Elapsed += (o, e) =>
|
||||||
|
{
|
||||||
_timerDebounce.Stop(); _timerDebounce.Close(); _timerDebounce = null;
|
_timerDebounce.Stop(); _timerDebounce.Close(); _timerDebounce = null;
|
||||||
InvokeAction(action, inv);
|
InvokeAction(action, inv);
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,455 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Dlass API 客户端,用于与服务端通信
|
||||||
|
/// </summary>
|
||||||
|
public class DlassApiClient : IDisposable
|
||||||
|
{
|
||||||
|
private const string DEFAULT_BASE_URL = "https://dlass.tech";
|
||||||
|
private readonly string _appId;
|
||||||
|
private readonly string _appSecret;
|
||||||
|
private readonly string _baseUrl;
|
||||||
|
private HttpClient _httpClient;
|
||||||
|
private string _accessToken;
|
||||||
|
private DateTime _tokenExpiresAt;
|
||||||
|
|
||||||
|
private string _userToken;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化 Dlass API 客户端
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appId">应用ID</param>
|
||||||
|
/// <param name="appSecret">应用密钥</param>
|
||||||
|
/// <param name="baseUrl">API基础URL,如果为空则使用默认URL</param>
|
||||||
|
/// <param name="userToken">用户Token,如果提供则优先使用用户token而不是App Secret</param>
|
||||||
|
public DlassApiClient(string appId, string appSecret, string baseUrl = null, string userToken = null)
|
||||||
|
{
|
||||||
|
_appId = appId ?? throw new ArgumentNullException(nameof(appId));
|
||||||
|
_appSecret = appSecret ?? throw new ArgumentNullException(nameof(appSecret));
|
||||||
|
_userToken = userToken;
|
||||||
|
_baseUrl = baseUrl ?? DEFAULT_BASE_URL;
|
||||||
|
|
||||||
|
_baseUrl = _baseUrl.TrimEnd('/');
|
||||||
|
if (!_baseUrl.StartsWith("http://") && !_baseUrl.StartsWith("https://"))
|
||||||
|
{
|
||||||
|
_baseUrl = "https://" + _baseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
_httpClient = new HttpClient
|
||||||
|
{
|
||||||
|
BaseAddress = new Uri(_baseUrl),
|
||||||
|
Timeout = TimeSpan.FromSeconds(30)
|
||||||
|
};
|
||||||
|
_httpClient.DefaultRequestHeaders.Add("User-Agent", "InkCanvas/1.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取访问令牌(Access Token)
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> GetAccessTokenAsync()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(_userToken))
|
||||||
|
{
|
||||||
|
return _userToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(_accessToken) && DateTime.Now < _tokenExpiresAt.AddMinutes(-5))
|
||||||
|
{
|
||||||
|
return _accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var requestData = new
|
||||||
|
{
|
||||||
|
app_id = _appId,
|
||||||
|
app_secret = _appSecret,
|
||||||
|
grant_type = "client_credentials"
|
||||||
|
};
|
||||||
|
|
||||||
|
var json = JsonConvert.SerializeObject(requestData);
|
||||||
|
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
var response = await _httpClient.PostAsync("/oauth/token", content);
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var tokenResponse = JsonConvert.DeserializeObject<TokenResponse>(responseContent);
|
||||||
|
_accessToken = tokenResponse.AccessToken;
|
||||||
|
_tokenExpiresAt = DateTime.Now.AddSeconds(tokenResponse.ExpiresIn ?? 3600);
|
||||||
|
return _accessToken;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"获取Access Token失败: {response.StatusCode}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException httpEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"获取Access Token时网络错误: {httpEx.Message}", httpEx);
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException timeoutEx)
|
||||||
|
{
|
||||||
|
throw new Exception("获取Access Token时请求超时", timeoutEx);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception($"获取Access Token时出错: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送GET请求
|
||||||
|
/// </summary>
|
||||||
|
public async Task<T> GetAsync<T>(string endpoint, bool requireAuth = true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string token = null;
|
||||||
|
if (requireAuth)
|
||||||
|
{
|
||||||
|
token = await GetAccessTokenAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Get, endpoint);
|
||||||
|
|
||||||
|
if (requireAuth && !string.IsNullOrEmpty(token))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(_userToken))
|
||||||
|
{
|
||||||
|
request.Headers.Add("X-User-Token", token);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await _httpClient.SendAsync(request);
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(content))
|
||||||
|
{
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
return JsonConvert.DeserializeObject<T>(content);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"API请求失败: {response.StatusCode} - {content}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException httpEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"发送请求时出错: {httpEx.Message}", httpEx);
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException timeoutEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"请求超时: {endpoint}", timeoutEx);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception($"发送请求时出错: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送POST请求
|
||||||
|
/// </summary>
|
||||||
|
public async Task<T> PostAsync<T>(string endpoint, object data = null, bool requireAuth = true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string token = null;
|
||||||
|
if (requireAuth)
|
||||||
|
{
|
||||||
|
token = await GetAccessTokenAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Post, endpoint);
|
||||||
|
|
||||||
|
if (requireAuth && !string.IsNullOrEmpty(token))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(_userToken))
|
||||||
|
{
|
||||||
|
request.Headers.Add("X-User-Token", token);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
var json = JsonConvert.SerializeObject(data);
|
||||||
|
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await _httpClient.SendAsync(request);
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(content))
|
||||||
|
{
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
return JsonConvert.DeserializeObject<T>(content);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"API请求失败: {response.StatusCode} - {content}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException httpEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"发送请求时出错: {httpEx.Message}", httpEx);
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException timeoutEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"请求超时: {endpoint}", timeoutEx);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception($"发送请求时出错: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送PUT请求
|
||||||
|
/// </summary>
|
||||||
|
public async Task<T> PutAsync<T>(string endpoint, object data = null, bool requireAuth = true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string token = null;
|
||||||
|
if (requireAuth)
|
||||||
|
{
|
||||||
|
token = await GetAccessTokenAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Put, endpoint);
|
||||||
|
|
||||||
|
if (requireAuth && !string.IsNullOrEmpty(token))
|
||||||
|
{
|
||||||
|
// 如果是用户token,使用X-User-Token header
|
||||||
|
if (!string.IsNullOrEmpty(_userToken))
|
||||||
|
{
|
||||||
|
request.Headers.Add("X-User-Token", token);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
var json = JsonConvert.SerializeObject(data);
|
||||||
|
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await _httpClient.SendAsync(request);
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(content))
|
||||||
|
{
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
return JsonConvert.DeserializeObject<T>(content);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"API请求失败: {response.StatusCode} - {content}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException httpEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"发送请求时出错: {httpEx.Message}", httpEx);
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException timeoutEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"请求超时: {endpoint}", timeoutEx);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception($"发送请求时出错: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送DELETE请求
|
||||||
|
/// </summary>
|
||||||
|
public async Task<bool> DeleteAsync(string endpoint, bool requireAuth = true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string token = null;
|
||||||
|
if (requireAuth)
|
||||||
|
{
|
||||||
|
token = await GetAccessTokenAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Delete, endpoint);
|
||||||
|
|
||||||
|
if (requireAuth && !string.IsNullOrEmpty(token))
|
||||||
|
{
|
||||||
|
// 如果是用户token,使用X-User-Token header
|
||||||
|
if (!string.IsNullOrEmpty(_userToken))
|
||||||
|
{
|
||||||
|
request.Headers.Add("X-User-Token", token);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = await _httpClient.SendAsync(request);
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传笔记文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="endpoint">上传端点</param>
|
||||||
|
/// <param name="filePath">文件路径</param>
|
||||||
|
/// <param name="boardId">白板ID</param>
|
||||||
|
/// <param name="secretKey">白板密钥</param>
|
||||||
|
/// <param name="title">笔记标题(可选)</param>
|
||||||
|
/// <param name="description">笔记描述(可选)</param>
|
||||||
|
/// <param name="tags">笔记标签(可选)</param>
|
||||||
|
public async Task<T> UploadNoteAsync<T>(string endpoint, string filePath, string boardId, string secretKey, string title = null, string description = null, string tags = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException($"文件不存在: {filePath}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Post, endpoint);
|
||||||
|
|
||||||
|
// 设置白板认证头
|
||||||
|
request.Headers.Add("X-Board-ID", boardId);
|
||||||
|
request.Headers.Add("X-Secret-Key", secretKey);
|
||||||
|
|
||||||
|
// 创建multipart/form-data内容
|
||||||
|
var content = new MultipartFormDataContent();
|
||||||
|
|
||||||
|
// 添加文件
|
||||||
|
var fileContent = new ByteArrayContent(File.ReadAllBytes(filePath));
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
||||||
|
content.Add(fileContent, "file", fileName);
|
||||||
|
|
||||||
|
// 添加可选参数
|
||||||
|
if (!string.IsNullOrEmpty(title))
|
||||||
|
{
|
||||||
|
content.Add(new StringContent(title), "title");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(description))
|
||||||
|
{
|
||||||
|
content.Add(new StringContent(description), "description");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(tags))
|
||||||
|
{
|
||||||
|
content.Add(new StringContent(tags), "tags");
|
||||||
|
}
|
||||||
|
|
||||||
|
request.Content = content;
|
||||||
|
|
||||||
|
var response = await _httpClient.SendAsync(request);
|
||||||
|
var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(responseContent))
|
||||||
|
{
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
return JsonConvert.DeserializeObject<T>(responseContent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"上传文件失败: {response.StatusCode} - {responseContent}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException httpEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"上传文件时网络错误: {httpEx.Message}", httpEx);
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException timeoutEx)
|
||||||
|
{
|
||||||
|
throw new Exception($"上传文件超时: {endpoint}", timeoutEx);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception($"上传文件时出错: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_httpClient?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 内部类
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Token响应模型
|
||||||
|
/// </summary>
|
||||||
|
private class TokenResponse
|
||||||
|
{
|
||||||
|
[JsonProperty("access_token")]
|
||||||
|
public string AccessToken { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("expires_in")]
|
||||||
|
public int? ExpiresIn { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("token_type")]
|
||||||
|
public string TokenType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,762 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Dlass笔记自动上传辅助类
|
||||||
|
/// </summary>
|
||||||
|
public class DlassNoteUploader
|
||||||
|
{
|
||||||
|
private const string APP_ID = "app_WkjocWqsrVY7T6zQV2CfiA";
|
||||||
|
private const string APP_SECRET = "o7dx5b5ASGUMcM72PCpmRQYAhSijqaOVHoGyBK0IxbA";
|
||||||
|
private const int BATCH_SIZE = 10; // 批量上传大小
|
||||||
|
private const int MAX_RETRY_COUNT = 3; // 最大重试次数
|
||||||
|
private const string QUEUE_FILE_NAME = "DlassUploadQueue.json";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传队列项
|
||||||
|
/// </summary>
|
||||||
|
private class UploadQueueItemData
|
||||||
|
{
|
||||||
|
[JsonProperty("file_path")]
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("retry_count")]
|
||||||
|
public int RetryCount { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("added_time")]
|
||||||
|
public DateTime AddedTime { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传队列项
|
||||||
|
/// </summary>
|
||||||
|
private class UploadQueueItem
|
||||||
|
{
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
public int RetryCount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传队列
|
||||||
|
/// </summary>
|
||||||
|
private static readonly ConcurrentQueue<UploadQueueItem> _uploadQueue = new ConcurrentQueue<UploadQueueItem>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 队列处理锁,防止并发处理
|
||||||
|
/// </summary>
|
||||||
|
private static readonly SemaphoreSlim _queueProcessingLock = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 队列保存锁,防止并发保存
|
||||||
|
/// </summary>
|
||||||
|
private static readonly SemaphoreSlim _queueSaveLock = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否已初始化队列
|
||||||
|
/// </summary>
|
||||||
|
private static bool _isQueueInitialized = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取队列文件路径
|
||||||
|
/// </summary>
|
||||||
|
private static string GetQueueFilePath()
|
||||||
|
{
|
||||||
|
var configsDir = Path.Combine(App.RootPath, "Configs");
|
||||||
|
if (!Directory.Exists(configsDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(configsDir);
|
||||||
|
}
|
||||||
|
return Path.Combine(configsDir, QUEUE_FILE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化上传队列
|
||||||
|
/// </summary>
|
||||||
|
public static void InitializeQueue()
|
||||||
|
{
|
||||||
|
if (_isQueueInitialized)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var queueFilePath = GetQueueFilePath();
|
||||||
|
if (!File.Exists(queueFilePath))
|
||||||
|
{
|
||||||
|
_isQueueInitialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonContent = File.ReadAllText(queueFilePath);
|
||||||
|
if (string.IsNullOrWhiteSpace(jsonContent))
|
||||||
|
{
|
||||||
|
_isQueueInitialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var queueData = JsonConvert.DeserializeObject<List<UploadQueueItemData>>(jsonContent);
|
||||||
|
if (queueData == null || queueData.Count == 0)
|
||||||
|
{
|
||||||
|
_isQueueInitialized = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int restoredCount = 0;
|
||||||
|
int skippedCount = 0;
|
||||||
|
|
||||||
|
foreach (var item in queueData)
|
||||||
|
{
|
||||||
|
// 验证文件是否存在
|
||||||
|
if (!File.Exists(item.FilePath))
|
||||||
|
{
|
||||||
|
skippedCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证文件格式和大小
|
||||||
|
var fileExtension = Path.GetExtension(item.FilePath).ToLower();
|
||||||
|
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||||
|
{
|
||||||
|
skippedCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var fileInfo = new FileInfo(item.FilePath);
|
||||||
|
long maxSize = fileExtension == ".zip" ? 50 * 1024 * 1024 : 10 * 1024 * 1024;
|
||||||
|
if (fileInfo.Length > maxSize)
|
||||||
|
{
|
||||||
|
skippedCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
skippedCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 恢复队列项
|
||||||
|
_uploadQueue.Enqueue(new UploadQueueItem
|
||||||
|
{
|
||||||
|
FilePath = item.FilePath,
|
||||||
|
RetryCount = item.RetryCount
|
||||||
|
});
|
||||||
|
restoredCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isQueueInitialized = true;
|
||||||
|
|
||||||
|
if (restoredCount > 0)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"已恢复上传队列:{restoredCount}个文件,跳过{skippedCount}个无效文件", LogHelper.LogType.Event);
|
||||||
|
// 如果恢复了队列,触发处理
|
||||||
|
_ = ProcessUploadQueueAsync();
|
||||||
|
}
|
||||||
|
else if (skippedCount > 0)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"队列恢复完成:跳过{skippedCount}个无效文件", LogHelper.LogType.Event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"恢复上传队列时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
_isQueueInitialized = true; // 即使出错也标记为已初始化,避免重复尝试
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存队列到文件
|
||||||
|
/// </summary>
|
||||||
|
private static async Task SaveQueueToFileAsync()
|
||||||
|
{
|
||||||
|
if (!await _queueSaveLock.WaitAsync(1000)) // 最多等待1秒
|
||||||
|
{
|
||||||
|
return; // 如果无法获取锁,跳过保存(避免阻塞)
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var queueData = new List<UploadQueueItemData>();
|
||||||
|
|
||||||
|
// 将队列转换为可序列化的格式
|
||||||
|
foreach (var item in _uploadQueue)
|
||||||
|
{
|
||||||
|
queueData.Add(new UploadQueueItemData
|
||||||
|
{
|
||||||
|
FilePath = item.FilePath,
|
||||||
|
RetryCount = item.RetryCount,
|
||||||
|
AddedTime = DateTime.Now
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var queueFilePath = GetQueueFilePath();
|
||||||
|
|
||||||
|
// 如果队列为空,清空文件
|
||||||
|
if (queueData.Count == 0)
|
||||||
|
{
|
||||||
|
ClearQueueFile();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonContent = JsonConvert.SerializeObject(queueData, Formatting.Indented);
|
||||||
|
|
||||||
|
// 使用临时文件写入,然后替换,确保原子性
|
||||||
|
var tempFilePath = queueFilePath + ".tmp";
|
||||||
|
File.WriteAllText(tempFilePath, jsonContent);
|
||||||
|
|
||||||
|
// 如果原文件存在,先删除
|
||||||
|
if (File.Exists(queueFilePath))
|
||||||
|
{
|
||||||
|
File.Delete(queueFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重命名临时文件
|
||||||
|
File.Move(tempFilePath, queueFilePath);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存上传队列时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_queueSaveLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清空队列文件
|
||||||
|
/// </summary>
|
||||||
|
private static void ClearQueueFile()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var queueFilePath = GetQueueFilePath();
|
||||||
|
if (File.Exists(queueFilePath))
|
||||||
|
{
|
||||||
|
File.WriteAllText(queueFilePath, "[]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清空队列文件时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传笔记响应模型
|
||||||
|
/// </summary>
|
||||||
|
public class UploadNoteResponse
|
||||||
|
{
|
||||||
|
[JsonProperty("success")]
|
||||||
|
public bool Success { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("message")]
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("note_id")]
|
||||||
|
public int? NoteId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("filename")]
|
||||||
|
public string Filename { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("file_path")]
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("file_url")]
|
||||||
|
public string FileUrl { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 白板信息模型(用于查找白板)
|
||||||
|
/// </summary>
|
||||||
|
private class WhiteboardInfo
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("board_id")]
|
||||||
|
public string BoardId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("secret_key")]
|
||||||
|
public string SecretKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("class_name")]
|
||||||
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("class_id")]
|
||||||
|
public int ClassId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 认证响应模型
|
||||||
|
/// </summary>
|
||||||
|
private class AuthWithTokenResponse
|
||||||
|
{
|
||||||
|
[JsonProperty("success")]
|
||||||
|
public bool Success { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("whiteboards")]
|
||||||
|
public List<WhiteboardInfo> Whiteboards { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异步上传笔记文件到Dlass(支持PNG、ICSTK、XML和ZIP格式)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径(支持PNG、ICSTK、XML和ZIP)</param>
|
||||||
|
/// <returns>是否成功加入队列(不等待实际上传完成)</returns>
|
||||||
|
public static async Task<bool> UploadNoteFileAsync(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查是否启用自动上传
|
||||||
|
if (MainWindow.Settings?.Dlass?.IsAutoUploadNotes != true)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 基本验证
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败:文件不存在 - {filePath}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileExtension = Path.GetExtension(filePath).ToLower();
|
||||||
|
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileInfo = new FileInfo(filePath);
|
||||||
|
long maxSize = fileExtension == ".zip" ? 50 * 1024 * 1024 : 10 * 1024 * 1024;
|
||||||
|
if (fileInfo.Length > maxSize)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败:文件过大({fileInfo.Length / 1024 / 1024}MB),超过{maxSize / 1024 / 1024}MB限制", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取上传延迟时间(分钟)
|
||||||
|
var delayMinutes = MainWindow.Settings?.Dlass?.AutoUploadDelayMinutes ?? 0;
|
||||||
|
|
||||||
|
// 如果设置了延迟时间,在后台任务中等待后再加入队列
|
||||||
|
if (delayMinutes > 0)
|
||||||
|
{
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromMinutes(delayMinutes));
|
||||||
|
EnqueueFile(filePath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EnqueueFile(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"加入上传队列时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将文件加入上传队列
|
||||||
|
/// </summary>
|
||||||
|
private static void EnqueueFile(string filePath, int retryCount = 0)
|
||||||
|
{
|
||||||
|
_uploadQueue.Enqueue(new UploadQueueItem
|
||||||
|
{
|
||||||
|
FilePath = filePath,
|
||||||
|
RetryCount = retryCount
|
||||||
|
});
|
||||||
|
|
||||||
|
// 异步保存队列到文件
|
||||||
|
_ = Task.Run(async () => await SaveQueueToFileAsync());
|
||||||
|
|
||||||
|
// 如果队列达到批量大小,触发批量上传
|
||||||
|
if (_uploadQueue.Count >= BATCH_SIZE)
|
||||||
|
{
|
||||||
|
_ = ProcessUploadQueueAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理上传队列,批量上传文件
|
||||||
|
/// </summary>
|
||||||
|
private static async Task ProcessUploadQueueAsync()
|
||||||
|
{
|
||||||
|
// 使用信号量防止并发处理
|
||||||
|
if (!await _queueProcessingLock.WaitAsync(0))
|
||||||
|
{
|
||||||
|
return; // 已有处理任务在运行
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var filesToUpload = new List<UploadQueueItem>();
|
||||||
|
|
||||||
|
// 从队列中取出最多BATCH_SIZE个文件
|
||||||
|
while (filesToUpload.Count < BATCH_SIZE && _uploadQueue.TryDequeue(out UploadQueueItem item))
|
||||||
|
{
|
||||||
|
// 再次检查文件是否存在
|
||||||
|
if (File.Exists(item.FilePath))
|
||||||
|
{
|
||||||
|
filesToUpload.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filesToUpload.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取共享的白板信息(同一批次的所有文件共享认证信息)
|
||||||
|
WhiteboardInfo sharedWhiteboard = null;
|
||||||
|
string apiBaseUrl = null;
|
||||||
|
string userToken = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var selectedClassName = MainWindow.Settings?.Dlass?.SelectedClassName;
|
||||||
|
if (string.IsNullOrEmpty(selectedClassName))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("上传失败:未选择班级", LogHelper.LogType.Error);
|
||||||
|
// 将文件重新加入队列
|
||||||
|
foreach (var item in filesToUpload)
|
||||||
|
{
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userToken = MainWindow.Settings?.Dlass?.UserToken;
|
||||||
|
if (string.IsNullOrEmpty(userToken))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("上传失败:未设置用户Token", LogHelper.LogType.Error);
|
||||||
|
// 将文件重新加入队列
|
||||||
|
foreach (var item in filesToUpload)
|
||||||
|
{
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiBaseUrl = MainWindow.Settings?.Dlass?.ApiBaseUrl ?? "https://dlass.tech";
|
||||||
|
|
||||||
|
// 获取白板信息(只获取一次,所有文件共享)
|
||||||
|
using (var apiClient = new DlassApiClient(APP_ID, APP_SECRET, apiBaseUrl, userToken))
|
||||||
|
{
|
||||||
|
var authData = new
|
||||||
|
{
|
||||||
|
app_id = APP_ID,
|
||||||
|
app_secret = APP_SECRET,
|
||||||
|
user_token = userToken
|
||||||
|
};
|
||||||
|
|
||||||
|
var authResult = await apiClient.PostAsync<AuthWithTokenResponse>("/api/whiteboard/framework/auth-with-token", authData, requireAuth: false);
|
||||||
|
|
||||||
|
if (authResult == null || !authResult.Success || authResult.Whiteboards == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("上传失败:无法获取白板信息", LogHelper.LogType.Error);
|
||||||
|
// 将文件重新加入队列
|
||||||
|
foreach (var item in filesToUpload)
|
||||||
|
{
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sharedWhiteboard = authResult.Whiteboards
|
||||||
|
.FirstOrDefault(w => !string.IsNullOrEmpty(w.ClassName) && w.ClassName == selectedClassName);
|
||||||
|
|
||||||
|
if (sharedWhiteboard == null || string.IsNullOrEmpty(sharedWhiteboard.BoardId) || string.IsNullOrEmpty(sharedWhiteboard.SecretKey))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败:未找到班级'{selectedClassName}'对应的白板", LogHelper.LogType.Error);
|
||||||
|
// 将文件重新加入队列
|
||||||
|
foreach (var item in filesToUpload)
|
||||||
|
{
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"批量上传获取白板信息时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
// 将文件重新加入队列
|
||||||
|
foreach (var item in filesToUpload)
|
||||||
|
{
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 并发上传所有文件(共享白板信息),并处理失败重试
|
||||||
|
var uploadTasks = filesToUpload.Select(async item =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var success = await UploadFileInternalAsync(item.FilePath, sharedWhiteboard, apiBaseUrl, userToken);
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
// 检查是否是可重试的错误
|
||||||
|
if (IsRetryableError(item.FilePath))
|
||||||
|
{
|
||||||
|
// 检查重试次数
|
||||||
|
if (item.RetryCount < MAX_RETRY_COUNT)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败,将重试 ({item.RetryCount + 1}/{MAX_RETRY_COUNT}): {Path.GetFileName(item.FilePath)}", LogHelper.LogType.Event);
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败,已达到最大重试次数: {Path.GetFileName(item.FilePath)}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 检查是否是可重试的错误(超时、网络错误等)
|
||||||
|
var errorMessage = ex.Message.ToLower();
|
||||||
|
bool isRetryable = errorMessage.Contains("超时") ||
|
||||||
|
errorMessage.Contains("timeout") ||
|
||||||
|
errorMessage.Contains("网络错误") ||
|
||||||
|
errorMessage.Contains("network");
|
||||||
|
|
||||||
|
if (isRetryable && IsRetryableError(item.FilePath))
|
||||||
|
{
|
||||||
|
// 检查重试次数
|
||||||
|
if (item.RetryCount < MAX_RETRY_COUNT)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败({ex.Message}),将重试 ({item.RetryCount + 1}/{MAX_RETRY_COUNT}): {Path.GetFileName(item.FilePath)}", LogHelper.LogType.Event);
|
||||||
|
EnqueueFile(item.FilePath, item.RetryCount + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败,已达到最大重试次数: {Path.GetFileName(item.FilePath)}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await Task.WhenAll(uploadTasks);
|
||||||
|
|
||||||
|
// 上传完成后保存队列状态
|
||||||
|
await SaveQueueToFileAsync();
|
||||||
|
|
||||||
|
// 如果队列达到批量大小,继续处理
|
||||||
|
if (_uploadQueue.Count >= BATCH_SIZE)
|
||||||
|
{
|
||||||
|
_ = ProcessUploadQueueAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_queueProcessingLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内部上传方法,执行实际上传操作
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径</param>
|
||||||
|
/// <param name="whiteboard">白板信息(如果为null则重新获取)</param>
|
||||||
|
/// <param name="apiBaseUrl">API基础URL(如果为null则从设置获取)</param>
|
||||||
|
/// <param name="userToken">用户Token(如果为null则从设置获取)</param>
|
||||||
|
private static async Task<bool> UploadFileInternalAsync(string filePath, WhiteboardInfo whiteboard = null, string apiBaseUrl = null, string userToken = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 再次检查文件是否存在(可能在队列等待时被删除)
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件扩展名
|
||||||
|
var fileExtension = Path.GetExtension(filePath).ToLower();
|
||||||
|
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件大小(最大10MB,ZIP文件可能更大,允许50MB)
|
||||||
|
var fileInfo = new FileInfo(filePath);
|
||||||
|
long maxSize = fileExtension == ".zip" ? 50 * 1024 * 1024 : 10 * 1024 * 1024;
|
||||||
|
if (fileInfo.Length > maxSize)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败:文件过大({fileInfo.Length / 1024 / 1024}MB),超过{maxSize / 1024 / 1024}MB限制", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果白板信息未提供,则重新获取
|
||||||
|
if (whiteboard == null)
|
||||||
|
{
|
||||||
|
var selectedClassName = MainWindow.Settings?.Dlass?.SelectedClassName;
|
||||||
|
if (string.IsNullOrEmpty(selectedClassName))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("上传失败:未选择班级", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
userToken = userToken ?? MainWindow.Settings?.Dlass?.UserToken;
|
||||||
|
if (string.IsNullOrEmpty(userToken))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("上传失败:未设置用户Token", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiBaseUrl = apiBaseUrl ?? MainWindow.Settings?.Dlass?.ApiBaseUrl ?? "https://dlass.tech";
|
||||||
|
|
||||||
|
// 创建API客户端并获取白板信息
|
||||||
|
using (var apiClient = new DlassApiClient(APP_ID, APP_SECRET, apiBaseUrl, userToken))
|
||||||
|
{
|
||||||
|
var authData = new
|
||||||
|
{
|
||||||
|
app_id = APP_ID,
|
||||||
|
app_secret = APP_SECRET,
|
||||||
|
user_token = userToken
|
||||||
|
};
|
||||||
|
|
||||||
|
var authResult = await apiClient.PostAsync<AuthWithTokenResponse>("/api/whiteboard/framework/auth-with-token", authData, requireAuth: false);
|
||||||
|
|
||||||
|
if (authResult == null || !authResult.Success || authResult.Whiteboards == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("上传失败:无法获取白板信息", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找匹配班级的白板
|
||||||
|
whiteboard = authResult.Whiteboards
|
||||||
|
.FirstOrDefault(w => !string.IsNullOrEmpty(w.ClassName) && w.ClassName == selectedClassName);
|
||||||
|
|
||||||
|
if (whiteboard == null || string.IsNullOrEmpty(whiteboard.BoardId) || string.IsNullOrEmpty(whiteboard.SecretKey))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败:未找到班级'{selectedClassName}'对应的白板", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取API基础URL和用户Token(如果未提供)
|
||||||
|
apiBaseUrl = apiBaseUrl ?? MainWindow.Settings?.Dlass?.ApiBaseUrl ?? "https://dlass.tech";
|
||||||
|
userToken = userToken ?? MainWindow.Settings?.Dlass?.UserToken;
|
||||||
|
|
||||||
|
// 准备上传参数
|
||||||
|
var fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||||
|
var title = fileName;
|
||||||
|
string fileType;
|
||||||
|
string tags;
|
||||||
|
if (fileExtension == ".zip")
|
||||||
|
{
|
||||||
|
fileType = "多页面墨迹压缩包";
|
||||||
|
tags = "自动上传,多页面,zip,压缩包";
|
||||||
|
}
|
||||||
|
else if (fileExtension == ".icstk")
|
||||||
|
{
|
||||||
|
fileType = "墨迹文件";
|
||||||
|
tags = "自动上传,墨迹,icstk";
|
||||||
|
}
|
||||||
|
else if (fileExtension == ".xml")
|
||||||
|
{
|
||||||
|
fileType = "XML文件";
|
||||||
|
tags = "自动上传,xml";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileType = "笔记";
|
||||||
|
tags = "自动上传,笔记,png";
|
||||||
|
}
|
||||||
|
var description = $"自动上传的{fileType} - {DateTime.Now:yyyy-MM-dd HH:mm:ss}";
|
||||||
|
|
||||||
|
// 创建API客户端并上传文件
|
||||||
|
using (var apiClient = new DlassApiClient(APP_ID, APP_SECRET, apiBaseUrl, userToken))
|
||||||
|
{
|
||||||
|
var uploadResult = await apiClient.UploadNoteAsync<UploadNoteResponse>(
|
||||||
|
"/api/whiteboard/upload_note",
|
||||||
|
filePath,
|
||||||
|
whiteboard.BoardId,
|
||||||
|
whiteboard.SecretKey,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
tags);
|
||||||
|
|
||||||
|
if (uploadResult != null && uploadResult.Success)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"笔记上传成功:{fileName} -> {uploadResult.FileUrl}", LogHelper.LogType.Event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"上传失败:服务器响应失败 - {uploadResult?.Message ?? "未知错误"}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 记录错误信息,抛出异常以便调用方判断是否可重试
|
||||||
|
LogHelper.WriteLogToFile($"上传笔记时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断错误是否可重试(超时、网络错误等)
|
||||||
|
/// </summary>
|
||||||
|
private static bool IsRetryableError(string filePath)
|
||||||
|
{
|
||||||
|
// 检查文件是否存在
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
return false; // 文件不存在,不可重试
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件扩展名
|
||||||
|
var fileExtension = Path.GetExtension(filePath).ToLower();
|
||||||
|
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||||
|
{
|
||||||
|
return false; // 文件格式错误,不可重试
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件大小
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var fileInfo = new FileInfo(filePath);
|
||||||
|
long maxSize = fileExtension == ".zip" ? 50 * 1024 * 1024 : 10 * 1024 * 1024;
|
||||||
|
if (fileInfo.Length > maxSize)
|
||||||
|
{
|
||||||
|
return false; // 文件过大,不可重试
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false; // 无法读取文件信息,不可重试
|
||||||
|
}
|
||||||
|
|
||||||
|
// 其他错误(超时、网络错误等)可以重试
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers
|
namespace Ink_Canvas.Helpers
|
||||||
{
|
{
|
||||||
@@ -70,7 +71,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
[FieldOffset(8)]
|
[FieldOffset(8)]
|
||||||
private DateTime date;
|
private DateTime date;
|
||||||
[FieldOffset(8)]
|
[FieldOffset(8)]
|
||||||
private System.Runtime.InteropServices.ComTypes.FILETIME filetime;
|
private FILETIME filetime;
|
||||||
|
|
||||||
[FieldOffset(8)]
|
[FieldOffset(8)]
|
||||||
private Blob blobVal;
|
private Blob blobVal;
|
||||||
@@ -115,7 +116,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
case VarEnum.VT_BLOB:
|
case VarEnum.VT_BLOB:
|
||||||
return GetBlob();
|
return GetBlob();
|
||||||
}
|
}
|
||||||
throw new NotImplementedException("PropVariant " + ve.ToString());
|
throw new NotImplementedException("PropVariant " + ve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,17 +145,17 @@ namespace Ink_Canvas.Helpers
|
|||||||
|
|
||||||
#region "Interfaces"
|
#region "Interfaces"
|
||||||
|
|
||||||
[ComImport(), Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
[ComImport, Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
public interface IPropertyStore
|
public interface IPropertyStore
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
void GetCount([Out(), In()] ref uint cProps);
|
void GetCount([Out, In] ref uint cProps);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
void GetAt([In()] uint iProp, ref PropertyKey pkey);
|
void GetAt([In] uint iProp, ref PropertyKey pkey);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
void GetValue([In()] ref PropertyKey key, ref PropVariant pv);
|
void GetValue([In] ref PropertyKey key, ref PropVariant pv);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
void SetValue([In()] ref PropertyKey key, [In()] ref PropVariant pv);
|
void SetValue([In] ref PropertyKey key, [In] ref PropVariant pv);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
void Commit();
|
void Commit();
|
||||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
|||||||
@@ -0,0 +1,589 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件关联管理器,用于注册和处理.icstk文件的关联
|
||||||
|
/// </summary>
|
||||||
|
public static class FileAssociationManager
|
||||||
|
{
|
||||||
|
private const string FileExtension = ".icstk";
|
||||||
|
private const string FileTypeName = "InkCanvasStrokesFile";
|
||||||
|
private const string AppName = "Ink Canvas";
|
||||||
|
private const string AppDescription = "Ink Canvas Strokes File";
|
||||||
|
|
||||||
|
// IPC相关常量
|
||||||
|
private const string IpcMutexName = "InkCanvasFileAssociationIpc";
|
||||||
|
private const string IpcEventName = "InkCanvasFileAssociationEvent";
|
||||||
|
private const string IpcFilePrefix = "InkCanvasFileAssociation_";
|
||||||
|
private const string IpcBoardModePrefix = "InkCanvasBoardMode_";
|
||||||
|
private const string IpcShowModePrefix = "InkCanvasShowMode_";
|
||||||
|
private const int IpcTimeout = 5000; // 5秒超时
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册.icstk文件关联
|
||||||
|
/// </summary>
|
||||||
|
public static bool RegisterFileAssociation()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
|
|
||||||
|
// 注册文件类型
|
||||||
|
using (RegistryKey fileTypeKey = Registry.ClassesRoot.CreateSubKey(FileTypeName))
|
||||||
|
{
|
||||||
|
fileTypeKey.SetValue("", AppDescription);
|
||||||
|
fileTypeKey.SetValue("FriendlyTypeName", AppDescription);
|
||||||
|
|
||||||
|
// 设置默认图标
|
||||||
|
using (RegistryKey defaultIconKey = fileTypeKey.CreateSubKey("DefaultIcon"))
|
||||||
|
{
|
||||||
|
defaultIconKey.SetValue("", $"\"{exePath}\",0");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置打开命令
|
||||||
|
using (RegistryKey shellKey = fileTypeKey.CreateSubKey("shell"))
|
||||||
|
using (RegistryKey openKey = shellKey.CreateSubKey("open"))
|
||||||
|
using (RegistryKey commandKey = openKey.CreateSubKey("command"))
|
||||||
|
{
|
||||||
|
commandKey.SetValue("", $"\"{exePath}\" \"%1\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注册文件扩展名
|
||||||
|
using (RegistryKey extensionKey = Registry.ClassesRoot.CreateSubKey(FileExtension))
|
||||||
|
{
|
||||||
|
extensionKey.SetValue("", FileTypeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新系统文件关联缓存
|
||||||
|
RefreshSystemFileAssociations();
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile($"成功注册{FileExtension}文件关联", LogHelper.LogType.Event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (SecurityException ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"注册文件关联时权限不足: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"注册文件关联时访问被拒绝: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"注册文件关联时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注销.icstk文件关联
|
||||||
|
/// </summary>
|
||||||
|
public static bool UnregisterFileAssociation()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 删除文件扩展名关联
|
||||||
|
Registry.ClassesRoot.DeleteSubKeyTree(FileExtension, false);
|
||||||
|
|
||||||
|
// 删除文件类型定义
|
||||||
|
Registry.ClassesRoot.DeleteSubKeyTree(FileTypeName, false);
|
||||||
|
|
||||||
|
// 刷新系统文件关联缓存
|
||||||
|
RefreshSystemFileAssociations();
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile($"成功注销{FileExtension}文件关联", LogHelper.LogType.Event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"注销文件关联时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查文件关联是否已注册
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsFileAssociationRegistered()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (RegistryKey extensionKey = Registry.ClassesRoot.OpenSubKey(FileExtension))
|
||||||
|
{
|
||||||
|
if (extensionKey == null) return false;
|
||||||
|
|
||||||
|
string fileType = extensionKey.GetValue("") as string;
|
||||||
|
if (string.IsNullOrEmpty(fileType)) return false;
|
||||||
|
|
||||||
|
using (RegistryKey fileTypeKey = Registry.ClassesRoot.OpenSubKey(fileType))
|
||||||
|
{
|
||||||
|
if (fileTypeKey == null) return false;
|
||||||
|
|
||||||
|
using (RegistryKey shellKey = fileTypeKey.OpenSubKey("shell\\open\\command"))
|
||||||
|
{
|
||||||
|
if (shellKey == null) return false;
|
||||||
|
|
||||||
|
string command = shellKey.GetValue("") as string;
|
||||||
|
if (string.IsNullOrEmpty(command)) return false;
|
||||||
|
|
||||||
|
// 检查命令是否指向当前应用程序
|
||||||
|
string currentExePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
|
return command.Contains(currentExePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"检查文件关联状态时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示文件关联状态
|
||||||
|
/// </summary>
|
||||||
|
public static void ShowFileAssociationStatus()
|
||||||
|
{
|
||||||
|
bool isRegistered = IsFileAssociationRegistered();
|
||||||
|
LogHelper.WriteLogToFile($"{FileExtension}文件关联状态: {(isRegistered ? "已注册" : "未注册")}", LogHelper.LogType.Event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新系统文件关联缓存
|
||||||
|
/// </summary>
|
||||||
|
private static void RefreshSystemFileAssociations()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 通知系统文件关联已更改
|
||||||
|
SHChangeNotify(0x08000000, 0, IntPtr.Zero, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"刷新文件关联缓存时出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理命令行参数中的文件路径
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">命令行参数</param>
|
||||||
|
/// <returns>找到的.icstk文件路径,如果没有找到则返回null</returns>
|
||||||
|
public static string GetIcstkFileFromArgs(string[] args)
|
||||||
|
{
|
||||||
|
if (args == null || args.Length == 0) return null;
|
||||||
|
|
||||||
|
foreach (string arg in args)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(arg)) continue;
|
||||||
|
|
||||||
|
// 检查是否为.icstk文件
|
||||||
|
if (Path.GetExtension(arg).Equals(FileExtension, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// 检查文件是否存在
|
||||||
|
if (File.Exists(arg))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"从命令行参数中找到.icstk文件: {arg}", LogHelper.LogType.Event);
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"命令行参数中的.icstk文件不存在: {arg}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试通过IPC将文件路径发送给已运行的实例
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">要打开的文件路径</param>
|
||||||
|
/// <returns>是否成功发送</returns>
|
||||||
|
public static bool TrySendFileToExistingInstance(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"尝试通过IPC发送文件路径给已运行实例: {filePath}", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 创建IPC文件
|
||||||
|
string tempDir = Path.GetTempPath();
|
||||||
|
string ipcFileName = IpcFilePrefix + Guid.NewGuid().ToString("N") + ".tmp";
|
||||||
|
string ipcFilePath = Path.Combine(tempDir, ipcFileName);
|
||||||
|
|
||||||
|
// 写入文件路径到IPC文件
|
||||||
|
File.WriteAllText(ipcFilePath, filePath, Encoding.UTF8);
|
||||||
|
|
||||||
|
// 创建事件通知已运行实例
|
||||||
|
using (EventWaitHandle ipcEvent = new EventWaitHandle(false, EventResetMode.ManualReset, IpcEventName))
|
||||||
|
{
|
||||||
|
ipcEvent.Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待一段时间让已运行实例处理文件
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
// 清理IPC文件
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(ipcFilePath))
|
||||||
|
{
|
||||||
|
File.Delete(ipcFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理IPC文件失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile("IPC文件路径发送完成", LogHelper.LogType.Event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"通过IPC发送文件路径失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试通过IPC将白板模式命令发送给已运行的实例
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>是否成功发送</returns>
|
||||||
|
public static bool TrySendBoardModeCommandToExistingInstance()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("尝试通过IPC发送白板模式命令给已运行实例", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 创建IPC文件
|
||||||
|
string tempDir = Path.GetTempPath();
|
||||||
|
string ipcFileName = IpcBoardModePrefix + Guid.NewGuid().ToString("N") + ".tmp";
|
||||||
|
string ipcFilePath = Path.Combine(tempDir, ipcFileName);
|
||||||
|
|
||||||
|
// 写入白板模式命令到IPC文件
|
||||||
|
File.WriteAllText(ipcFilePath, "BOARD_MODE", Encoding.UTF8);
|
||||||
|
|
||||||
|
// 创建事件通知已运行实例
|
||||||
|
using (EventWaitHandle ipcEvent = new EventWaitHandle(false, EventResetMode.ManualReset, IpcEventName))
|
||||||
|
{
|
||||||
|
ipcEvent.Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待一段时间让已运行实例处理命令
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
// 清理IPC文件
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(ipcFilePath))
|
||||||
|
{
|
||||||
|
File.Delete(ipcFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理IPC文件失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile("IPC白板模式命令发送完成", LogHelper.LogType.Event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"通过IPC发送白板模式命令失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试通过IPC将展开浮动栏命令发送给已运行的实例
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>是否成功发送</returns>
|
||||||
|
public static bool TrySendShowModeCommandToExistingInstance()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("尝试通过IPC发送展开浮动栏命令给已运行实例", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 创建IPC文件
|
||||||
|
string tempDir = Path.GetTempPath();
|
||||||
|
string ipcFileName = IpcShowModePrefix + Guid.NewGuid().ToString("N") + ".tmp";
|
||||||
|
string ipcFilePath = Path.Combine(tempDir, ipcFileName);
|
||||||
|
|
||||||
|
// 写入展开浮动栏命令到IPC文件
|
||||||
|
File.WriteAllText(ipcFilePath, "SHOW_MODE", Encoding.UTF8);
|
||||||
|
|
||||||
|
// 创建事件通知已运行实例
|
||||||
|
using (EventWaitHandle ipcEvent = new EventWaitHandle(false, EventResetMode.ManualReset, IpcEventName))
|
||||||
|
{
|
||||||
|
ipcEvent.Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待一段时间让已运行实例处理命令
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
// 清理IPC文件
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(ipcFilePath))
|
||||||
|
{
|
||||||
|
File.Delete(ipcFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理IPC文件失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile("IPC展开浮动栏命令发送完成", LogHelper.LogType.Event);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"通过IPC发送展开浮动栏命令失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启动IPC监听器,等待其他实例发送文件路径
|
||||||
|
/// </summary>
|
||||||
|
public static void StartIpcListener()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread ipcThread = new Thread(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("启动IPC监听器", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
using (EventWaitHandle ipcEvent = new EventWaitHandle(false, EventResetMode.ManualReset, IpcEventName))
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
// 等待IPC事件
|
||||||
|
if (ipcEvent.WaitOne(IpcTimeout))
|
||||||
|
{
|
||||||
|
// 处理IPC文件
|
||||||
|
ProcessIpcFiles();
|
||||||
|
|
||||||
|
// 重置事件
|
||||||
|
ipcEvent.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查应用是否还在运行
|
||||||
|
if (Application.Current == null || Application.Current.Dispatcher == null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"IPC监听器出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcThread.IsBackground = true;
|
||||||
|
ipcThread.Start();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"启动IPC监听器失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理IPC文件
|
||||||
|
/// </summary>
|
||||||
|
private static void ProcessIpcFiles()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string tempDir = Path.GetTempPath();
|
||||||
|
|
||||||
|
// 处理文件路径IPC文件
|
||||||
|
string[] ipcFiles = Directory.GetFiles(tempDir, IpcFilePrefix + "*.tmp");
|
||||||
|
foreach (string ipcFile in ipcFiles)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 读取文件路径
|
||||||
|
string filePath = File.ReadAllText(ipcFile, Encoding.UTF8);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"IPC接收到文件路径: {filePath}", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 在UI线程中处理文件打开
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取主窗口并打开文件
|
||||||
|
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
mainWindow.OpenSingleStrokeFile(filePath);
|
||||||
|
mainWindow.ShowNotification($"已加载墨迹文件: {Path.GetFileName(filePath)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"IPC处理文件打开失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除IPC文件
|
||||||
|
File.Delete(ipcFile);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理IPC文件失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
|
||||||
|
// 尝试删除损坏的IPC文件
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(ipcFile))
|
||||||
|
{
|
||||||
|
File.Delete(ipcFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理白板模式命令IPC文件
|
||||||
|
string[] boardModeFiles = Directory.GetFiles(tempDir, IpcBoardModePrefix + "*.tmp");
|
||||||
|
foreach (string ipcFile in boardModeFiles)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 读取命令内容
|
||||||
|
string command = File.ReadAllText(ipcFile, Encoding.UTF8);
|
||||||
|
|
||||||
|
if (command == "BOARD_MODE")
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("IPC接收到白板模式命令", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 在UI线程中处理白板模式切换
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取主窗口并切换到白板模式
|
||||||
|
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
mainWindow.SwitchToBoardMode();
|
||||||
|
mainWindow.ShowNotification("已切换到白板模式");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"IPC处理白板模式切换失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除IPC文件
|
||||||
|
File.Delete(ipcFile);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理白板模式IPC文件失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
|
||||||
|
// 尝试删除损坏的IPC文件
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(ipcFile))
|
||||||
|
{
|
||||||
|
File.Delete(ipcFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理展开浮动栏命令IPC文件
|
||||||
|
string[] showModeFiles = Directory.GetFiles(tempDir, IpcShowModePrefix + "*.tmp");
|
||||||
|
foreach (string ipcFile in showModeFiles)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 读取命令内容
|
||||||
|
string command = File.ReadAllText(ipcFile, Encoding.UTF8);
|
||||||
|
|
||||||
|
if (command == "SHOW_MODE")
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("IPC接收到展开浮动栏命令", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 在UI线程中处理展开浮动栏
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(new Action(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取主窗口并展开浮动栏
|
||||||
|
if (Application.Current.MainWindow is MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
// 如果当前处于收纳模式,则展开浮动栏
|
||||||
|
if (mainWindow.isFloatingBarFolded)
|
||||||
|
{
|
||||||
|
await mainWindow.UnFoldFloatingBar(new object());
|
||||||
|
}
|
||||||
|
mainWindow.ShowNotification("已退出收纳模式并恢复浮动栏");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"IPC处理展开浮动栏失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除IPC文件
|
||||||
|
File.Delete(ipcFile);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理展开浮动栏IPC文件失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
|
||||||
|
// 尝试删除损坏的IPC文件
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(ipcFile))
|
||||||
|
{
|
||||||
|
File.Delete(ipcFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理IPC文件时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("shell32.dll")]
|
||||||
|
private static extern void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,398 @@
|
|||||||
|
using Ink_Canvas.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Ink_Canvas
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 悬浮窗拦截管理器
|
||||||
|
/// </summary>
|
||||||
|
public class FloatingWindowInterceptorManager : IDisposable
|
||||||
|
{
|
||||||
|
#region 私有字段
|
||||||
|
|
||||||
|
private FloatingWindowInterceptor _interceptor;
|
||||||
|
private bool _isInitialized;
|
||||||
|
private bool _disposed;
|
||||||
|
private FloatingWindowInterceptorSettings _settings;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 事件
|
||||||
|
|
||||||
|
public event EventHandler<FloatingWindowInterceptor.WindowInterceptedEventArgs> WindowIntercepted;
|
||||||
|
public event EventHandler<FloatingWindowInterceptor.WindowRestoredEventArgs> WindowRestored;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 公共属性
|
||||||
|
|
||||||
|
public bool IsEnabled => _interceptor != null && _settings != null && _settings.IsEnabled;
|
||||||
|
public bool IsRunning => _interceptor != null && _interceptor.IsRunning;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 公共方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化拦截器
|
||||||
|
/// </summary>
|
||||||
|
public void Initialize(FloatingWindowInterceptorSettings settings)
|
||||||
|
{
|
||||||
|
if (_isInitialized) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_settings = settings ?? new FloatingWindowInterceptorSettings();
|
||||||
|
_interceptor = new FloatingWindowInterceptor();
|
||||||
|
|
||||||
|
// 订阅事件
|
||||||
|
_interceptor.WindowIntercepted += OnWindowIntercepted;
|
||||||
|
_interceptor.WindowRestored += OnWindowRestored;
|
||||||
|
|
||||||
|
// 应用配置
|
||||||
|
ApplySettings();
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
|
|
||||||
|
// 如果设置了自动启动,则启动拦截器
|
||||||
|
if (_settings.AutoStart && _settings.IsEnabled)
|
||||||
|
{
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"初始化悬浮窗拦截器失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启动拦截器
|
||||||
|
/// </summary>
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
if (!_isInitialized || _settings == null) return;
|
||||||
|
|
||||||
|
if (_interceptor == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_interceptor.Start(_settings.ScanIntervalMs);
|
||||||
|
LogHelper.WriteLogToFile("悬浮窗拦截器已启动", LogHelper.LogType.Event);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"启动悬浮窗拦截器失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止拦截器
|
||||||
|
/// </summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (_interceptor == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_interceptor.Stop();
|
||||||
|
LogHelper.WriteLogToFile("悬浮窗拦截器已停止", LogHelper.LogType.Event);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"停止悬浮窗拦截器失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置拦截规则
|
||||||
|
/// </summary>
|
||||||
|
public void SetInterceptRule(FloatingWindowInterceptor.InterceptType type, bool enabled)
|
||||||
|
{
|
||||||
|
if (_interceptor == null || _settings == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_interceptor.SetInterceptRule(type, enabled);
|
||||||
|
|
||||||
|
// 更新设置
|
||||||
|
var ruleName = type.ToString();
|
||||||
|
if (_settings.InterceptRules.ContainsKey(ruleName))
|
||||||
|
{
|
||||||
|
_settings.InterceptRules[ruleName] = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取规则信息以处理父子关系
|
||||||
|
var rule = _interceptor.GetInterceptRule(type);
|
||||||
|
if (rule != null)
|
||||||
|
{
|
||||||
|
// 如果是父规则,更新所有子规则的设置
|
||||||
|
if (rule.ChildTypes.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var childType in rule.ChildTypes)
|
||||||
|
{
|
||||||
|
var childRuleName = childType.ToString();
|
||||||
|
if (_settings.InterceptRules.ContainsKey(childRuleName))
|
||||||
|
{
|
||||||
|
_settings.InterceptRules[childRuleName] = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果是子规则,更新父规则的设置
|
||||||
|
else if (rule.ParentType.HasValue)
|
||||||
|
{
|
||||||
|
var parentRule = _interceptor.GetInterceptRule(rule.ParentType.Value);
|
||||||
|
if (parentRule != null)
|
||||||
|
{
|
||||||
|
var parentRuleName = rule.ParentType.Value.ToString();
|
||||||
|
if (_settings.InterceptRules.ContainsKey(parentRuleName))
|
||||||
|
{
|
||||||
|
_settings.InterceptRules[parentRuleName] = parentRule.IsEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"设置拦截规则失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取拦截规则
|
||||||
|
/// </summary>
|
||||||
|
public FloatingWindowInterceptor.InterceptRule GetInterceptRule(FloatingWindowInterceptor.InterceptType type)
|
||||||
|
{
|
||||||
|
return _interceptor?.GetInterceptRule(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有拦截规则
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<FloatingWindowInterceptor.InterceptType, FloatingWindowInterceptor.InterceptRule> GetAllRules()
|
||||||
|
{
|
||||||
|
return _interceptor?.GetAllRules() ?? new Dictionary<FloatingWindowInterceptor.InterceptType, FloatingWindowInterceptor.InterceptRule>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 手动扫描一次
|
||||||
|
/// </summary>
|
||||||
|
public void ScanOnce()
|
||||||
|
{
|
||||||
|
if (_interceptor == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_interceptor.ScanOnce();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"手动扫描失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 恢复所有被拦截的窗口
|
||||||
|
/// </summary>
|
||||||
|
public void RestoreAllWindows()
|
||||||
|
{
|
||||||
|
if (_interceptor == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_interceptor.RestoreAllWindows();
|
||||||
|
LogHelper.WriteLogToFile("已恢复所有被拦截的窗口", LogHelper.LogType.Event);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"恢复窗口失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用设置
|
||||||
|
/// </summary>
|
||||||
|
public void ApplySettings()
|
||||||
|
{
|
||||||
|
if (_interceptor == null || _settings == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 应用拦截规则设置
|
||||||
|
foreach (var kvp in _settings.InterceptRules)
|
||||||
|
{
|
||||||
|
if (Enum.TryParse<FloatingWindowInterceptor.InterceptType>(kvp.Key, out var type))
|
||||||
|
{
|
||||||
|
_interceptor.SetInterceptRule(type, kvp.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果启用了拦截器,则启动
|
||||||
|
if (_settings.IsEnabled && !IsRunning)
|
||||||
|
{
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
// 如果禁用了拦截器,则停止
|
||||||
|
else if (!_settings.IsEnabled && IsRunning)
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"应用设置失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新扫描间隔
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateScanInterval(int intervalMs)
|
||||||
|
{
|
||||||
|
if (_interceptor == null || _settings == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_settings.ScanIntervalMs = intervalMs;
|
||||||
|
|
||||||
|
// 如果正在运行,重启以应用新间隔
|
||||||
|
if (IsRunning)
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新扫描间隔失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取拦截统计信息
|
||||||
|
/// </summary>
|
||||||
|
public InterceptStatistics GetStatistics()
|
||||||
|
{
|
||||||
|
if (_interceptor == null || _settings == null) return new InterceptStatistics();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var rules = GetAllRules();
|
||||||
|
var enabledRules = rules.Count(r => r.Value.IsEnabled);
|
||||||
|
var totalRules = rules.Count;
|
||||||
|
|
||||||
|
return new InterceptStatistics
|
||||||
|
{
|
||||||
|
TotalRules = totalRules,
|
||||||
|
EnabledRules = enabledRules,
|
||||||
|
IsRunning = IsRunning,
|
||||||
|
ScanIntervalMs = _settings.ScanIntervalMs
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"获取统计信息失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return new InterceptStatistics();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 私有方法
|
||||||
|
|
||||||
|
private void OnWindowIntercepted(object sender, FloatingWindowInterceptor.WindowInterceptedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 记录日志
|
||||||
|
LogHelper.WriteLogToFile($"拦截窗口: {e.WindowTitle} ({e.InterceptType})", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 显示通知(如果启用)
|
||||||
|
if (_settings != null && _settings.ShowNotifications)
|
||||||
|
{
|
||||||
|
ShowNotification($"已拦截悬浮窗: {e.Rule.Description}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 触发事件
|
||||||
|
WindowIntercepted?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理窗口拦截事件失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWindowRestored(object sender, FloatingWindowInterceptor.WindowRestoredEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 记录日志
|
||||||
|
LogHelper.WriteLogToFile($"恢复窗口: {e.InterceptType}", LogHelper.LogType.Event);
|
||||||
|
|
||||||
|
// 触发事件
|
||||||
|
WindowRestored?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理窗口恢复事件失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowNotification(string message)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 这里可以集成系统通知或自定义通知
|
||||||
|
// 暂时使用调试输出
|
||||||
|
System.Diagnostics.Debug.WriteLine($"通知: {message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"显示通知失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 辅助类
|
||||||
|
|
||||||
|
public class InterceptStatistics
|
||||||
|
{
|
||||||
|
public int TotalRules { get; set; }
|
||||||
|
public int EnabledRules { get; set; }
|
||||||
|
public bool IsRunning { get; set; }
|
||||||
|
public int ScanIntervalMs { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IDisposable
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_disposed) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
_interceptor?.Dispose();
|
||||||
|
_interceptor = null;
|
||||||
|
_isInitialized = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"释放悬浮窗拦截器失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers
|
namespace Ink_Canvas.Helpers
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,8 @@ namespace Ink_Canvas.Helpers
|
|||||||
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct RECT {
|
public struct RECT
|
||||||
|
{
|
||||||
public int Left;
|
public int Left;
|
||||||
public int Top;
|
public int Top;
|
||||||
public int Right;
|
public int Right;
|
||||||
@@ -34,7 +36,26 @@ namespace Ink_Canvas.Helpers
|
|||||||
public int Height => Bottom - Top;
|
public int Height => Bottom - Top;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string WindowTitle() {
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct MONITORINFO
|
||||||
|
{
|
||||||
|
public uint cbSize;
|
||||||
|
public RECT rcMonitor;
|
||||||
|
public RECT rcWork;
|
||||||
|
public uint dwFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern IntPtr MonitorFromRect(ref RECT lprc, uint dwFlags);
|
||||||
|
|
||||||
|
public static string WindowTitle()
|
||||||
|
{
|
||||||
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
||||||
|
|
||||||
const int nChars = 256;
|
const int nChars = 256;
|
||||||
@@ -44,7 +65,8 @@ namespace Ink_Canvas.Helpers
|
|||||||
return windowTitle.ToString();
|
return windowTitle.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string WindowClassName() {
|
public static string WindowClassName()
|
||||||
|
{
|
||||||
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
||||||
|
|
||||||
const int nChars = 256;
|
const int nChars = 256;
|
||||||
@@ -54,7 +76,8 @@ namespace Ink_Canvas.Helpers
|
|||||||
return className.ToString();
|
return className.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RECT WindowRect() {
|
public static RECT WindowRect()
|
||||||
|
{
|
||||||
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
||||||
|
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
@@ -63,15 +86,19 @@ namespace Ink_Canvas.Helpers
|
|||||||
return windowRect;
|
return windowRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ProcessName() {
|
public static string ProcessName()
|
||||||
|
{
|
||||||
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
IntPtr foregroundWindowHandle = GetForegroundWindow();
|
||||||
uint processId;
|
uint processId;
|
||||||
GetWindowThreadProcessId(foregroundWindowHandle, out processId);
|
GetWindowThreadProcessId(foregroundWindowHandle, out processId);
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
Process process = Process.GetProcessById((int)processId);
|
Process process = Process.GetProcessById((int)processId);
|
||||||
return process.ProcessName;
|
return process.ProcessName;
|
||||||
} catch (ArgumentException) {
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
// Process with the given ID not found
|
// Process with the given ID not found
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
@@ -88,18 +115,37 @@ namespace Ink_Canvas.Helpers
|
|||||||
Process process = Process.GetProcessById((int)processId);
|
Process process = Process.GetProcessById((int)processId);
|
||||||
return process.MainModule.FileName;
|
return process.MainModule.FileName;
|
||||||
}
|
}
|
||||||
catch {
|
catch
|
||||||
|
{
|
||||||
// Process with the given ID not found
|
// Process with the given ID not found
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double GetTaskbarHeight(System.Windows.Forms.Screen screen, double dpiScaleY)
|
public static double GetTaskbarHeight(Screen screen, double dpiScaleY)
|
||||||
{
|
{
|
||||||
// 获取工作区和屏幕高度的差值
|
// 创建RECT结构体表示屏幕边界
|
||||||
var workingArea = screen.WorkingArea;
|
RECT screenRect = new RECT
|
||||||
var bounds = screen.Bounds;
|
{
|
||||||
int taskbarHeight = bounds.Height - workingArea.Height;
|
Left = screen.Bounds.Left,
|
||||||
|
Top = screen.Bounds.Top,
|
||||||
|
Right = screen.Bounds.Right,
|
||||||
|
Bottom = screen.Bounds.Bottom
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取屏幕句柄
|
||||||
|
const uint MONITOR_DEFAULTTONEAREST = 0x00000002;
|
||||||
|
IntPtr hMonitor = MonitorFromRect(ref screenRect, MONITOR_DEFAULTTONEAREST);
|
||||||
|
|
||||||
|
// 初始化MONITORINFO结构体
|
||||||
|
MONITORINFO monitorInfo = new MONITORINFO();
|
||||||
|
monitorInfo.cbSize = (uint)Marshal.SizeOf(typeof(MONITORINFO));
|
||||||
|
|
||||||
|
// 获取监视器信息
|
||||||
|
GetMonitorInfo(hMonitor, ref monitorInfo);
|
||||||
|
|
||||||
|
// 计算任务栏高度:monitorInfo.rcMonitor.bottom减去monitorInfo.rcWork.bottom的值
|
||||||
|
int taskbarHeight = monitorInfo.rcMonitor.Bottom - monitorInfo.rcWork.Bottom;
|
||||||
// 考虑 DPI 缩放
|
// 考虑 DPI 缩放
|
||||||
return taskbarHeight / dpiScaleY;
|
return taskbarHeight / dpiScaleY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
|
||||||
|
|
||||||
public static IntPtr GetWindowLongPtr(IntPtr hWnd, GetWindowLongFields nIndex) =>
|
public static IntPtr GetWindowLongPtr(IntPtr hWnd, GetWindowLongFields nIndex) =>
|
||||||
GetWindowLongPtr(hWnd, (int) nIndex);
|
GetWindowLongPtr(hWnd, (int)nIndex);
|
||||||
|
|
||||||
public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex)
|
public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex)
|
||||||
{
|
{
|
||||||
@@ -99,7 +99,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
public static extern IntPtr GetWindowLongPtr_x64(IntPtr hWnd, int nIndex);
|
public static extern IntPtr GetWindowLongPtr_x64(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
public static IntPtr SetWindowLongPtr(IntPtr hWnd, GetWindowLongFields nIndex, IntPtr dwNewLong) =>
|
public static IntPtr SetWindowLongPtr(IntPtr hWnd, GetWindowLongFields nIndex, IntPtr dwNewLong) =>
|
||||||
SetWindowLongPtr(hWnd, (int) nIndex, dwNewLong);
|
SetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
|
||||||
|
|
||||||
public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
|
public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
|
||||||
{
|
{
|
||||||
@@ -264,8 +264,8 @@ namespace Ink_Canvas.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Width
|
public int Width
|
||||||
{
|
{
|
||||||
get { return unchecked((int) (Right - Left)); }
|
get { return unchecked(Right - Left); }
|
||||||
set { Right = unchecked((int) (Left + value)); }
|
set { Right = unchecked(Left + value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -273,8 +273,8 @@ namespace Ink_Canvas.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Height
|
public int Height
|
||||||
{
|
{
|
||||||
get { return unchecked((int) (Bottom - Top)); }
|
get { return unchecked(Bottom - Top); }
|
||||||
set { Bottom = unchecked((int) (Top + value)); }
|
set { Bottom = unchecked(Top + value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Rectangle other)
|
public bool Equals(Rectangle other)
|
||||||
@@ -296,10 +296,10 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
var hashCode = (int) Left;
|
var hashCode = Left;
|
||||||
hashCode = (hashCode * 397) ^ (int) Top;
|
hashCode = (hashCode * 397) ^ Top;
|
||||||
hashCode = (hashCode * 397) ^ (int) Right;
|
hashCode = (hashCode * 397) ^ Right;
|
||||||
hashCode = (hashCode * 397) ^ (int) Bottom;
|
hashCode = (hashCode * 397) ^ Bottom;
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ namespace Ink_Canvas.Helpers
|
|||||||
|
|
||||||
//获取当前窗口的位置大小状态并保存
|
//获取当前窗口的位置大小状态并保存
|
||||||
var placement = new WINDOWPLACEMENT();
|
var placement = new WINDOWPLACEMENT();
|
||||||
placement.Size = (uint) Marshal.SizeOf(placement);
|
placement.Size = (uint)Marshal.SizeOf(placement);
|
||||||
Win32.User32.GetWindowPlacement(hwnd, ref placement);
|
Win32.User32.GetWindowPlacement(hwnd, ref placement);
|
||||||
window.SetValue(BeforeFullScreenWindowPlacementProperty, placement);
|
window.SetValue(BeforeFullScreenWindowPlacementProperty, placement);
|
||||||
|
|
||||||
//修改窗口样式
|
//修改窗口样式
|
||||||
var style = (WindowStyles) Win32.User32.GetWindowLongPtr(hwnd, GetWindowLongFields.GWL_STYLE);
|
var style = (WindowStyles)Win32.User32.GetWindowLongPtr(hwnd, GetWindowLongFields.GWL_STYLE);
|
||||||
window.SetValue(BeforeFullScreenWindowStyleProperty, style);
|
window.SetValue(BeforeFullScreenWindowStyleProperty, style);
|
||||||
//将窗口恢复到还原模式,在有标题栏的情况下最大化模式下无法全屏,
|
//将窗口恢复到还原模式,在有标题栏的情况下最大化模式下无法全屏,
|
||||||
//这里采用还原,不修改标题栏的方式
|
//这里采用还原,不修改标题栏的方式
|
||||||
@@ -81,7 +81,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
//去掉WS_MAXIMIZEBOX,禁用最大化,如果最大化会退出全屏
|
//去掉WS_MAXIMIZEBOX,禁用最大化,如果最大化会退出全屏
|
||||||
//去掉WS_MAXIMIZE,使窗口变成还原状态,不使用ShowWindow(hwnd, ShowWindowCommands.SW_RESTORE),避免看到窗口变成还原状态这一过程(也避免影响窗口的Visible状态)
|
//去掉WS_MAXIMIZE,使窗口变成还原状态,不使用ShowWindow(hwnd, ShowWindowCommands.SW_RESTORE),避免看到窗口变成还原状态这一过程(也避免影响窗口的Visible状态)
|
||||||
style &= (~(WindowStyles.WS_THICKFRAME | WindowStyles.WS_MAXIMIZEBOX | WindowStyles.WS_MAXIMIZE));
|
style &= (~(WindowStyles.WS_THICKFRAME | WindowStyles.WS_MAXIMIZEBOX | WindowStyles.WS_MAXIMIZE));
|
||||||
Win32.User32.SetWindowLongPtr(hwnd, GetWindowLongFields.GWL_STYLE, (IntPtr) style);
|
Win32.User32.SetWindowLongPtr(hwnd, GetWindowLongFields.GWL_STYLE, (IntPtr)style);
|
||||||
|
|
||||||
//禁用 DWM 过渡动画 忽略返回值,若DWM关闭不做处理
|
//禁用 DWM 过渡动画 忽略返回值,若DWM关闭不做处理
|
||||||
Win32.Dwmapi.DwmSetWindowAttribute(hwnd, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 1,
|
Win32.Dwmapi.DwmSetWindowAttribute(hwnd, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 1,
|
||||||
@@ -95,8 +95,8 @@ namespace Ink_Canvas.Helpers
|
|||||||
//不能用 placement 的坐标,placement是工作区坐标,不是屏幕坐标。
|
//不能用 placement 的坐标,placement是工作区坐标,不是屏幕坐标。
|
||||||
|
|
||||||
//使用窗口当前的矩形调用下设置窗口位置和尺寸的方法,让Hook来进行调整窗口位置和尺寸到全屏模式
|
//使用窗口当前的矩形调用下设置窗口位置和尺寸的方法,让Hook来进行调整窗口位置和尺寸到全屏模式
|
||||||
Win32.User32.SetWindowPos(hwnd, (IntPtr) HwndZOrder.HWND_TOPMOST, rect.Left, rect.Top, rect.Width,
|
Win32.User32.SetWindowPos(hwnd, (IntPtr)HwndZOrder.HWND_TOPMOST, rect.Left, rect.Top, rect.Width,
|
||||||
rect.Height, (int) WindowPositionFlags.SWP_NOZORDER);
|
rect.Height, (int)WindowPositionFlags.SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
//不要改变Style里的WS_MAXIMIZE,否则会使窗口变成最大化状态,但是尺寸不对
|
//不要改变Style里的WS_MAXIMIZE,否则会使窗口变成最大化状态,但是尺寸不对
|
||||||
//也不要设置回Style里的WS_MINIMIZE,否则会导致窗口最小化按钮显示成还原按钮
|
//也不要设置回Style里的WS_MINIMIZE,否则会导致窗口最小化按钮显示成还原按钮
|
||||||
Win32.User32.SetWindowLongPtr(hwnd, GetWindowLongFields.GWL_STYLE,
|
Win32.User32.SetWindowLongPtr(hwnd, GetWindowLongFields.GWL_STYLE,
|
||||||
(IntPtr) (style & (~(WindowStyles.WS_MAXIMIZE | WindowStyles.WS_MINIMIZE))));
|
(IntPtr)(style & (~(WindowStyles.WS_MAXIMIZE | WindowStyles.WS_MINIMIZE))));
|
||||||
|
|
||||||
if ((style & WindowStyles.WS_MINIMIZE) != 0)
|
if ((style & WindowStyles.WS_MINIMIZE) != 0)
|
||||||
{
|
{
|
||||||
@@ -201,7 +201,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//得到WINDOWPOS结构体
|
//得到WINDOWPOS结构体
|
||||||
var pos = (WindowPosition) Marshal.PtrToStructure(lParam, typeof(WindowPosition));
|
var pos = (WindowPosition)Marshal.PtrToStructure(lParam, typeof(WindowPosition));
|
||||||
|
|
||||||
if ((pos.Flags & WindowPositionFlags.SWP_NOMOVE) != 0 &&
|
if ((pos.Flags & WindowPositionFlags.SWP_NOMOVE) != 0 &&
|
||||||
(pos.Flags & WindowPositionFlags.SWP_NOSIZE) != 0)
|
(pos.Flags & WindowPositionFlags.SWP_NOSIZE) != 0)
|
||||||
@@ -245,7 +245,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
//使用目标矩形获取显示器信息
|
//使用目标矩形获取显示器信息
|
||||||
var monitor = Win32.User32.MonitorFromRect(targetRect, MonitorFlag.MONITOR_DEFAULTTOPRIMARY);
|
var monitor = Win32.User32.MonitorFromRect(targetRect, MonitorFlag.MONITOR_DEFAULTTOPRIMARY);
|
||||||
var info = new MonitorInfo();
|
var info = new MonitorInfo();
|
||||||
info.Size = (uint) Marshal.SizeOf(info);
|
info.Size = (uint)Marshal.SizeOf(info);
|
||||||
if (Win32.User32.GetMonitorInfo(monitor, ref info))
|
if (Win32.User32.GetMonitorInfo(monitor, ref info))
|
||||||
{
|
{
|
||||||
//基于显示器信息设置窗口尺寸位置
|
//基于显示器信息设置窗口尺寸位置
|
||||||
@@ -278,10 +278,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
window.Width = logicalSize.X;
|
window.Width = logicalSize.X;
|
||||||
window.Height = logicalSize.Y;
|
window.Height = logicalSize.Y;
|
||||||
}
|
}
|
||||||
else
|
//这个hwnd是前面从Window来的,如果现在他不是Window...... 你信么
|
||||||
{
|
|
||||||
//这个hwnd是前面从Window来的,如果现在他不是Window...... 你信么
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//将修改后的结构体拷贝回去
|
//将修改后的结构体拷贝回去
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,199 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Ink;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 硬件加速的墨迹处理器,利用WPF的GPU渲染能力
|
||||||
|
/// </summary>
|
||||||
|
public class HardwareAcceleratedInkProcessor
|
||||||
|
{
|
||||||
|
private readonly RenderTargetBitmap _renderTarget;
|
||||||
|
private readonly DrawingVisual _drawingVisual;
|
||||||
|
private bool _isInitialized;
|
||||||
|
|
||||||
|
public HardwareAcceleratedInkProcessor(int width = 1920, int height = 1080)
|
||||||
|
{
|
||||||
|
// 创建硬件加速的渲染目标
|
||||||
|
_renderTarget = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
|
||||||
|
_drawingVisual = new DrawingVisual();
|
||||||
|
|
||||||
|
// 启用硬件加速
|
||||||
|
RenderOptions.SetBitmapScalingMode(_drawingVisual, BitmapScalingMode.HighQuality);
|
||||||
|
RenderOptions.SetEdgeMode(_drawingVisual, EdgeMode.Aliased);
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用GPU加速的贝塞尔曲线平滑
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Stroke> SmoothStrokeWithGPU(Stroke originalStroke)
|
||||||
|
{
|
||||||
|
if (!_isInitialized || originalStroke == null || originalStroke.StylusPoints.Count < 2)
|
||||||
|
return originalStroke;
|
||||||
|
|
||||||
|
return await Task.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 使用PathGeometry进行硬件加速的曲线拟合
|
||||||
|
var pathGeometry = CreateSmoothPathGeometry(originalStroke.StylusPoints);
|
||||||
|
|
||||||
|
// 将PathGeometry转换回StylusPoint集合
|
||||||
|
var smoothedPoints = ConvertPathGeometryToStylusPoints(pathGeometry, originalStroke.StylusPoints);
|
||||||
|
|
||||||
|
return new Stroke(new StylusPointCollection(smoothedPoints))
|
||||||
|
{
|
||||||
|
DrawingAttributes = originalStroke.DrawingAttributes.Clone()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return originalStroke;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建平滑的路径几何体
|
||||||
|
/// </summary>
|
||||||
|
private PathGeometry CreateSmoothPathGeometry(StylusPointCollection points)
|
||||||
|
{
|
||||||
|
var pathGeometry = new PathGeometry();
|
||||||
|
var pathFigure = new PathFigure();
|
||||||
|
|
||||||
|
if (points.Count < 2) return pathGeometry;
|
||||||
|
|
||||||
|
pathFigure.StartPoint = new Point(points[0].X, points[0].Y);
|
||||||
|
|
||||||
|
// 使用贝塞尔曲线段创建平滑路径,增加插点密度
|
||||||
|
for (int i = 0; i < points.Count - 1; i += 2) // 从i+=3改为i+=2,增加插点密度
|
||||||
|
{
|
||||||
|
var p1 = i + 1 < points.Count ? new Point(points[i + 1].X, points[i + 1].Y) : pathFigure.StartPoint;
|
||||||
|
var p2 = i + 2 < points.Count ? new Point(points[i + 2].X, points[i + 2].Y) : p1;
|
||||||
|
var p3 = i + 3 < points.Count ? new Point(points[i + 3].X, points[i + 3].Y) : p2;
|
||||||
|
|
||||||
|
var bezierSegment = new BezierSegment(p1, p2, p3, true);
|
||||||
|
pathFigure.Segments.Add(bezierSegment);
|
||||||
|
}
|
||||||
|
|
||||||
|
pathGeometry.Figures.Add(pathFigure);
|
||||||
|
return pathGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将PathGeometry转换为StylusPoint集合
|
||||||
|
/// </summary>
|
||||||
|
private List<StylusPoint> ConvertPathGeometryToStylusPoints(PathGeometry pathGeometry, StylusPointCollection originalPoints)
|
||||||
|
{
|
||||||
|
var result = new List<StylusPoint>();
|
||||||
|
var flattened = pathGeometry.GetFlattenedPathGeometry();
|
||||||
|
|
||||||
|
foreach (var figure in flattened.Figures)
|
||||||
|
{
|
||||||
|
result.Add(new StylusPoint(figure.StartPoint.X, figure.StartPoint.Y, 0.5f));
|
||||||
|
|
||||||
|
foreach (var segment in figure.Segments)
|
||||||
|
{
|
||||||
|
if (segment is LineSegment lineSegment)
|
||||||
|
{
|
||||||
|
result.Add(new StylusPoint(lineSegment.Point.X, lineSegment.Point.Y, 0.5f));
|
||||||
|
}
|
||||||
|
else if (segment is PolyLineSegment polyLineSegment)
|
||||||
|
{
|
||||||
|
foreach (var point in polyLineSegment.Points)
|
||||||
|
{
|
||||||
|
result.Add(new StylusPoint(point.X, point.Y, 0.5f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保持原始压感信息
|
||||||
|
InterpolatePressure(result, originalPoints);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插值压感信息
|
||||||
|
/// </summary>
|
||||||
|
private void InterpolatePressure(List<StylusPoint> smoothedPoints, StylusPointCollection originalPoints)
|
||||||
|
{
|
||||||
|
if (originalPoints.Count == 0 || smoothedPoints.Count == 0) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < smoothedPoints.Count; i++)
|
||||||
|
{
|
||||||
|
double ratio = (double)i / (smoothedPoints.Count - 1);
|
||||||
|
int originalIndex = (int)(ratio * (originalPoints.Count - 1));
|
||||||
|
originalIndex = Math.Max(0, Math.Min(originalIndex, originalPoints.Count - 1));
|
||||||
|
|
||||||
|
var point = smoothedPoints[i];
|
||||||
|
float pressure = originalPoints[originalIndex].PressureFactor;
|
||||||
|
smoothedPoints[i] = new StylusPoint(point.X, point.Y, Math.Max(pressure, 0.1f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用GPU加速的并行贝塞尔计算
|
||||||
|
/// </summary>
|
||||||
|
public static StylusPoint[] ParallelBezierInterpolation(StylusPoint[] controlPoints, int segments = 32)
|
||||||
|
{
|
||||||
|
if (controlPoints.Length < 4) return controlPoints;
|
||||||
|
|
||||||
|
var result = new StylusPoint[segments * (controlPoints.Length / 4)];
|
||||||
|
|
||||||
|
Parallel.For(0, controlPoints.Length / 4, segmentIndex =>
|
||||||
|
{
|
||||||
|
var p0 = controlPoints[segmentIndex * 4];
|
||||||
|
var p1 = controlPoints[segmentIndex * 4 + 1];
|
||||||
|
var p2 = controlPoints[segmentIndex * 4 + 2];
|
||||||
|
var p3 = controlPoints[segmentIndex * 4 + 3];
|
||||||
|
|
||||||
|
for (int i = 0; i < segments; i++)
|
||||||
|
{
|
||||||
|
double t = (double)i / (segments - 1);
|
||||||
|
result[segmentIndex * segments + i] = CubicBezierFast(p0, p1, p2, p3, t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 优化的三次贝塞尔曲线计算
|
||||||
|
/// </summary>
|
||||||
|
private static StylusPoint CubicBezierFast(StylusPoint p0, StylusPoint p1, StylusPoint p2, StylusPoint p3, double t)
|
||||||
|
{
|
||||||
|
double u = 1 - t;
|
||||||
|
double tt = t * t;
|
||||||
|
double uu = u * u;
|
||||||
|
double uuu = uu * u;
|
||||||
|
double ttt = tt * t;
|
||||||
|
|
||||||
|
double x = uuu * p0.X + 3 * uu * t * p1.X + 3 * u * tt * p2.X + ttt * p3.X;
|
||||||
|
double y = uuu * p0.Y + 3 * uu * t * p1.Y + 3 * u * tt * p2.Y + ttt * p3.Y;
|
||||||
|
float pressure = (float)(p1.PressureFactor * u + p2.PressureFactor * t);
|
||||||
|
|
||||||
|
return new StylusPoint(x, y, Math.Max(pressure, 0.1f));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放GPU资源
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_renderTarget?.Clear();
|
||||||
|
_isInitialized = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// IACore DLL自动释放器
|
||||||
|
/// 在应用启动时自动释放IACore相关的DLL文件到应用程序目录
|
||||||
|
/// </summary>
|
||||||
|
public static class IACoreDllExtractor
|
||||||
|
{
|
||||||
|
private static readonly string[] RequiredDlls = {
|
||||||
|
"IACore.dll",
|
||||||
|
"IALoader.dll",
|
||||||
|
"IAWinFX.dll"
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在应用启动时释放IACore相关DLL
|
||||||
|
/// </summary>
|
||||||
|
public static void ExtractIACoreDlls()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string appDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
LogHelper.WriteLogToFile("开始检查并释放IACore相关DLL文件");
|
||||||
|
|
||||||
|
foreach (string dllName in RequiredDlls)
|
||||||
|
{
|
||||||
|
string targetPath = Path.Combine(appDirectory, dllName);
|
||||||
|
|
||||||
|
// 检查文件是否已存在且有效
|
||||||
|
if (File.Exists(targetPath) && IsValidDll(targetPath))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"{dllName} 已存在且有效,跳过释放");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从嵌入资源中释放DLL
|
||||||
|
if (ExtractDllFromResource(dllName, targetPath))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"成功释放 {dllName} 到 {targetPath}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"警告:无法释放 {dllName},可能影响形状识别功能", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile("IACore DLL释放检查完成");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"释放IACore DLL时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从嵌入资源中提取DLL文件
|
||||||
|
/// </summary>
|
||||||
|
private static bool ExtractDllFromResource(string dllName, string targetPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
|
string resourceName = $"Ink_Canvas.Resources.IACore.{dllName}";
|
||||||
|
|
||||||
|
using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName))
|
||||||
|
{
|
||||||
|
if (resourceStream == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"未找到嵌入资源: {resourceName}", LogHelper.LogType.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保目标目录存在
|
||||||
|
string targetDirectory = Path.GetDirectoryName(targetPath);
|
||||||
|
if (!Directory.Exists(targetDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(targetDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入文件
|
||||||
|
using (FileStream fileStream = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
|
||||||
|
{
|
||||||
|
resourceStream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"从资源提取 {dllName} 失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查DLL文件是否有效
|
||||||
|
/// </summary>
|
||||||
|
private static bool IsValidDll(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
FileInfo fileInfo = new FileInfo(filePath);
|
||||||
|
|
||||||
|
// 检查文件大小(空文件或过小的文件可能无效)
|
||||||
|
if (fileInfo.Length < 1024) // 小于1KB可能无效
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 简单检查PE头(DLL文件应该以MZ开头)
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
byte[] buffer = new byte[2];
|
||||||
|
if (fs.Read(buffer, 0, 2) == 2)
|
||||||
|
{
|
||||||
|
return buffer[0] == 0x4D && buffer[1] == 0x5A; // "MZ"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理释放的DLL文件(可选,在应用退出时调用)
|
||||||
|
/// </summary>
|
||||||
|
public static void CleanupExtractedDlls()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string appDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
|
foreach (string dllName in RequiredDlls)
|
||||||
|
{
|
||||||
|
string filePath = Path.Combine(appDirectory, dllName);
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(filePath);
|
||||||
|
LogHelper.WriteLogToFile($"已清理 {dllName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理 {dllName} 失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理IACore DLL时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,325 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Ink;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 改进的三次贝塞尔曲线平滑算法
|
||||||
|
/// </summary>
|
||||||
|
public class ImprovedBezierSmoothing
|
||||||
|
{
|
||||||
|
private readonly InkSmoothingConfig _config;
|
||||||
|
|
||||||
|
public ImprovedBezierSmoothing(InkSmoothingConfig config = null)
|
||||||
|
{
|
||||||
|
_config = config ?? new InkSmoothingConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用改进的贝塞尔曲线算法平滑笔画
|
||||||
|
/// </summary>
|
||||||
|
public Stroke SmoothStroke(Stroke originalStroke)
|
||||||
|
{
|
||||||
|
if (originalStroke == null || originalStroke.StylusPoints.Count < 3)
|
||||||
|
return originalStroke;
|
||||||
|
|
||||||
|
var originalPoints = originalStroke.StylusPoints.ToArray();
|
||||||
|
|
||||||
|
// 预处理:去除噪声点
|
||||||
|
var cleanedPoints = RemoveNoisePoints(originalPoints);
|
||||||
|
|
||||||
|
// 使用改进的贝塞尔曲线拟合
|
||||||
|
var smoothedPoints = ApplyCubicBezierSmoothing(cleanedPoints);
|
||||||
|
|
||||||
|
// 后处理:重采样和优化
|
||||||
|
var finalPoints = PostProcessPoints(smoothedPoints);
|
||||||
|
|
||||||
|
return new Stroke(new StylusPointCollection(finalPoints))
|
||||||
|
{
|
||||||
|
DrawingAttributes = originalStroke.DrawingAttributes.Clone()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 去除噪声点
|
||||||
|
/// </summary>
|
||||||
|
private StylusPoint[] RemoveNoisePoints(StylusPoint[] points)
|
||||||
|
{
|
||||||
|
if (points.Length < 3) return points;
|
||||||
|
|
||||||
|
var result = new List<StylusPoint> { points[0] };
|
||||||
|
double minDistance = _config.ResampleInterval * 0.5;
|
||||||
|
|
||||||
|
for (int i = 1; i < points.Length - 1; i++)
|
||||||
|
{
|
||||||
|
var prev = result[result.Count - 1];
|
||||||
|
var curr = points[i];
|
||||||
|
var next = points[i + 1];
|
||||||
|
|
||||||
|
// 计算到前一个点的距离
|
||||||
|
double distToPrev = Math.Sqrt((curr.X - prev.X) * (curr.X - prev.X) +
|
||||||
|
(curr.Y - prev.Y) * (curr.Y - prev.Y));
|
||||||
|
|
||||||
|
// 如果距离太近,跳过这个点
|
||||||
|
if (distToPrev < minDistance)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 检查是否为异常点(与前后点形成锐角)
|
||||||
|
if (IsOutlierPoint(prev, curr, next))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
result.Add(curr);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add(points[points.Length - 1]);
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否为异常点
|
||||||
|
/// </summary>
|
||||||
|
private bool IsOutlierPoint(StylusPoint prev, StylusPoint curr, StylusPoint next)
|
||||||
|
{
|
||||||
|
var v1 = new Vector(curr.X - prev.X, curr.Y - prev.Y);
|
||||||
|
var v2 = new Vector(next.X - curr.X, next.Y - curr.Y);
|
||||||
|
|
||||||
|
if (v1.Length == 0 || v2.Length == 0) return false;
|
||||||
|
|
||||||
|
v1.Normalize();
|
||||||
|
v2.Normalize();
|
||||||
|
|
||||||
|
double dotProduct = Vector.Multiply(v1, v2);
|
||||||
|
double angle = Math.Acos(Math.Max(-1, Math.Min(1, dotProduct)));
|
||||||
|
|
||||||
|
// 如果角度小于30度,认为是异常点
|
||||||
|
return angle < Math.PI / 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用三次贝塞尔曲线平滑
|
||||||
|
/// </summary>
|
||||||
|
private StylusPoint[] ApplyCubicBezierSmoothing(StylusPoint[] points)
|
||||||
|
{
|
||||||
|
if (points.Length < 4) return points;
|
||||||
|
|
||||||
|
var result = new List<StylusPoint>();
|
||||||
|
result.Add(points[0]);
|
||||||
|
|
||||||
|
// 使用滑动窗口进行贝塞尔曲线拟合
|
||||||
|
for (int i = 0; i <= points.Length - 4; i++)
|
||||||
|
{
|
||||||
|
var p0 = points[i];
|
||||||
|
var p1 = points[i + 1];
|
||||||
|
var p2 = points[i + 2];
|
||||||
|
var p3 = points[i + 3];
|
||||||
|
|
||||||
|
// 计算控制点
|
||||||
|
var controlPoints = CalculateOptimalControlPoints(p0, p1, p2, p3);
|
||||||
|
|
||||||
|
// 计算插值步数
|
||||||
|
int steps = CalculateInterpolationSteps(p0, p1, p2, p3);
|
||||||
|
|
||||||
|
// 生成贝塞尔曲线点
|
||||||
|
for (int j = 1; j <= steps; j++)
|
||||||
|
{
|
||||||
|
double t = (double)j / steps;
|
||||||
|
var bezierPoint = CalculateBezierPoint(p0, controlPoints.cp1, controlPoints.cp2, p3, t);
|
||||||
|
result.Add(bezierPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add(points[points.Length - 1]);
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算最优控制点
|
||||||
|
/// </summary>
|
||||||
|
private (Point cp1, Point cp2) CalculateOptimalControlPoints(StylusPoint p0, StylusPoint p1, StylusPoint p2, StylusPoint p3)
|
||||||
|
{
|
||||||
|
// 计算切线方向
|
||||||
|
var tangent1 = CalculateTangent(p0, p1, p2);
|
||||||
|
var tangent2 = CalculateTangent(p1, p2, p3);
|
||||||
|
|
||||||
|
// 计算控制点距离
|
||||||
|
double dist1 = CalculateDistance(p0, p1);
|
||||||
|
double dist2 = CalculateDistance(p2, p3);
|
||||||
|
|
||||||
|
double controlDist1 = dist1 * _config.CurveTension;
|
||||||
|
double controlDist2 = dist2 * _config.CurveTension;
|
||||||
|
|
||||||
|
// 计算控制点
|
||||||
|
var cp1 = new Point(
|
||||||
|
p1.X + tangent1.X * controlDist1,
|
||||||
|
p1.Y + tangent1.Y * controlDist1
|
||||||
|
);
|
||||||
|
|
||||||
|
var cp2 = new Point(
|
||||||
|
p2.X - tangent2.X * controlDist2,
|
||||||
|
p2.Y - tangent2.Y * controlDist2
|
||||||
|
);
|
||||||
|
|
||||||
|
return (cp1, cp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算切线方向
|
||||||
|
/// </summary>
|
||||||
|
private Vector CalculateTangent(StylusPoint p0, StylusPoint p1, StylusPoint p2)
|
||||||
|
{
|
||||||
|
var v1 = new Vector(p1.X - p0.X, p1.Y - p0.Y);
|
||||||
|
var v2 = new Vector(p2.X - p1.X, p2.Y - p1.Y);
|
||||||
|
|
||||||
|
// 如果向量长度为零,返回零向量
|
||||||
|
if (v1.Length == 0 || v2.Length == 0)
|
||||||
|
return new Vector(0, 0);
|
||||||
|
|
||||||
|
v1.Normalize();
|
||||||
|
v2.Normalize();
|
||||||
|
|
||||||
|
// 返回平均方向
|
||||||
|
var tangent = (v1 + v2) / 2;
|
||||||
|
if (tangent.Length > 0)
|
||||||
|
tangent.Normalize();
|
||||||
|
|
||||||
|
return tangent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算两点间距离
|
||||||
|
/// </summary>
|
||||||
|
private double CalculateDistance(StylusPoint p1, StylusPoint p2)
|
||||||
|
{
|
||||||
|
double dx = p2.X - p1.X;
|
||||||
|
double dy = p2.Y - p1.Y;
|
||||||
|
return Math.Sqrt(dx * dx + dy * dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算插值步数
|
||||||
|
/// </summary>
|
||||||
|
private int CalculateInterpolationSteps(StylusPoint p0, StylusPoint p1, StylusPoint p2, StylusPoint p3)
|
||||||
|
{
|
||||||
|
if (!_config.UseAdaptiveInterpolation)
|
||||||
|
return _config.InterpolationSteps;
|
||||||
|
|
||||||
|
// 计算曲线长度
|
||||||
|
double totalLength = CalculateDistance(p0, p1) + CalculateDistance(p1, p2) + CalculateDistance(p2, p3);
|
||||||
|
|
||||||
|
// 计算曲率
|
||||||
|
double curvature = CalculateCurvature(p0, p1, p2, p3);
|
||||||
|
|
||||||
|
// 基于长度和曲率计算步数
|
||||||
|
int baseSteps = Math.Max(8, Math.Min(20, (int)(totalLength / 10)));
|
||||||
|
int curvatureSteps = (int)(curvature * 15);
|
||||||
|
|
||||||
|
return Math.Max(_config.InterpolationSteps, Math.Min(30, baseSteps + curvatureSteps));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算曲率
|
||||||
|
/// </summary>
|
||||||
|
private double CalculateCurvature(StylusPoint p0, StylusPoint p1, StylusPoint p2, StylusPoint p3)
|
||||||
|
{
|
||||||
|
var v1 = new Vector(p1.X - p0.X, p1.Y - p0.Y);
|
||||||
|
var v2 = new Vector(p2.X - p1.X, p2.Y - p1.Y);
|
||||||
|
var v3 = new Vector(p3.X - p2.X, p3.Y - p2.Y);
|
||||||
|
|
||||||
|
if (v1.Length == 0 || v2.Length == 0 || v3.Length == 0) return 0;
|
||||||
|
|
||||||
|
v1.Normalize();
|
||||||
|
v2.Normalize();
|
||||||
|
v3.Normalize();
|
||||||
|
|
||||||
|
// 计算角度变化
|
||||||
|
double angle1 = Math.Acos(Math.Max(-1, Math.Min(1, Vector.Multiply(v1, v2))));
|
||||||
|
double angle2 = Math.Acos(Math.Max(-1, Math.Min(1, Vector.Multiply(v2, v3))));
|
||||||
|
|
||||||
|
return (angle1 + angle2) / Math.PI; // 归一化到0-1
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算贝塞尔曲线上的点
|
||||||
|
/// </summary>
|
||||||
|
private StylusPoint CalculateBezierPoint(StylusPoint p0, Point cp1, Point cp2, StylusPoint p3, double t)
|
||||||
|
{
|
||||||
|
double u = 1 - t;
|
||||||
|
double tt = t * t;
|
||||||
|
double uu = u * u;
|
||||||
|
double uuu = uu * u;
|
||||||
|
double ttt = tt * t;
|
||||||
|
|
||||||
|
// 预计算系数
|
||||||
|
double c0 = uuu;
|
||||||
|
double c1 = 3 * uu * t;
|
||||||
|
double c2 = 3 * u * tt;
|
||||||
|
double c3 = ttt;
|
||||||
|
|
||||||
|
double x = c0 * p0.X + c1 * cp1.X + c2 * cp2.X + c3 * p3.X;
|
||||||
|
double y = c0 * p0.Y + c1 * cp1.Y + c2 * cp2.Y + c3 * p3.Y;
|
||||||
|
|
||||||
|
// 插值压力值
|
||||||
|
float pressure = (float)(p0.PressureFactor * u + p3.PressureFactor * t);
|
||||||
|
pressure = Math.Max(pressure, 0.1f);
|
||||||
|
|
||||||
|
return new StylusPoint(x, y, pressure);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 后处理点集
|
||||||
|
/// </summary>
|
||||||
|
private StylusPoint[] PostProcessPoints(StylusPoint[] points)
|
||||||
|
{
|
||||||
|
if (points.Length == 0) return points;
|
||||||
|
|
||||||
|
// 如果点数过多,进行重采样
|
||||||
|
if (points.Length > _config.MaxPointsPerStroke)
|
||||||
|
{
|
||||||
|
return ResamplePoints(points, _config.ResampleInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重采样点集
|
||||||
|
/// </summary>
|
||||||
|
private StylusPoint[] ResamplePoints(StylusPoint[] points, double interval)
|
||||||
|
{
|
||||||
|
var result = new List<StylusPoint> { points[0] };
|
||||||
|
double accumulated = 0;
|
||||||
|
|
||||||
|
for (int i = 1; i < points.Length; i++)
|
||||||
|
{
|
||||||
|
var prev = result[result.Count - 1];
|
||||||
|
var curr = points[i];
|
||||||
|
double dx = curr.X - prev.X;
|
||||||
|
double dy = curr.Y - prev.Y;
|
||||||
|
double dist = Math.Sqrt(dx * dx + dy * dy);
|
||||||
|
|
||||||
|
if (dist + accumulated >= interval)
|
||||||
|
{
|
||||||
|
double t = (interval - accumulated) / dist;
|
||||||
|
double x = prev.X + t * dx;
|
||||||
|
double y = prev.Y + t * dy;
|
||||||
|
float pressure = (float)(prev.PressureFactor * (1 - t) + curr.PressureFactor * t);
|
||||||
|
pressure = Math.Max(pressure, 0.1f);
|
||||||
|
|
||||||
|
result.Add(new StylusPoint(x, y, pressure));
|
||||||
|
accumulated = 0;
|
||||||
|
i--; // 重新处理当前点
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
accumulated += dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,897 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Ink;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media.Effects;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 墨迹渐隐管理器 - 管理墨迹的渐隐动画和状态
|
||||||
|
/// </summary>
|
||||||
|
public class InkFadeManager
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用墨迹渐隐功能
|
||||||
|
/// </summary>
|
||||||
|
public bool IsEnabled { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 墨迹渐隐时间(毫秒)
|
||||||
|
/// </summary>
|
||||||
|
public int FadeTime { get; set; } = 3000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 渐隐动画持续时间(毫秒)
|
||||||
|
/// </summary>
|
||||||
|
public int AnimationDuration { get; set; } = 1000;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
private readonly MainWindow _mainWindow;
|
||||||
|
private readonly Dispatcher _dispatcher;
|
||||||
|
private readonly Dictionary<Stroke, DispatcherTimer> _fadeTimers;
|
||||||
|
private readonly Dictionary<Stroke, UIElement> _strokeVisuals;
|
||||||
|
private readonly Dictionary<Stroke, Point> _strokeStartPoints;
|
||||||
|
private readonly Dictionary<Stroke, Point> _strokeEndPoints;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public InkFadeManager(MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
_mainWindow = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow));
|
||||||
|
_dispatcher = _mainWindow.Dispatcher;
|
||||||
|
_fadeTimers = new Dictionary<Stroke, DispatcherTimer>();
|
||||||
|
_strokeVisuals = new Dictionary<Stroke, UIElement>();
|
||||||
|
_strokeStartPoints = new Dictionary<Stroke, Point>();
|
||||||
|
_strokeEndPoints = new Dictionary<Stroke, Point>();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
/// <summary>
|
||||||
|
/// 添加需要渐隐的墨迹
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stroke">墨迹对象</param>
|
||||||
|
/// <param name="startPoint">落笔点</param>
|
||||||
|
/// <param name="endPoint">抬笔点</param>
|
||||||
|
public void AddFadingStroke(Stroke stroke, Point startPoint, Point endPoint)
|
||||||
|
{
|
||||||
|
if (!IsEnabled || stroke == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 确保主窗口的InkCanvas保持Ink编辑模式,防止墨迹渐隐时切换到鼠标模式
|
||||||
|
if (_mainWindow.inkCanvas.EditingMode != InkCanvasEditingMode.Ink)
|
||||||
|
{
|
||||||
|
_mainWindow.inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录墨迹的起点和终点
|
||||||
|
_strokeStartPoints[stroke] = startPoint;
|
||||||
|
_strokeEndPoints[stroke] = endPoint;
|
||||||
|
|
||||||
|
// 创建墨迹的视觉元素(湿墨迹状态)
|
||||||
|
var strokeVisual = CreateStrokeVisual(stroke);
|
||||||
|
if (strokeVisual == null) return;
|
||||||
|
|
||||||
|
_strokeVisuals[stroke] = strokeVisual;
|
||||||
|
|
||||||
|
// 创建定时器,在指定时间后开始渐隐动画
|
||||||
|
var timer = new DispatcherTimer
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromMilliseconds(FadeTime)
|
||||||
|
};
|
||||||
|
|
||||||
|
timer.Tick += (sender, e) =>
|
||||||
|
{
|
||||||
|
StartFadeAnimation(stroke);
|
||||||
|
timer.Stop();
|
||||||
|
_fadeTimers.Remove(stroke);
|
||||||
|
};
|
||||||
|
|
||||||
|
_fadeTimers[stroke] = timer;
|
||||||
|
timer.Start();
|
||||||
|
|
||||||
|
// 将视觉元素添加到画布上
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_mainWindow.inkCanvas != null)
|
||||||
|
{
|
||||||
|
// 将墨迹添加到 inkCanvas 的父容器中,而不是 inkCanvas.Children
|
||||||
|
// 这样可以避免坐标系统问题
|
||||||
|
var parent = _mainWindow.inkCanvas.Parent as Panel;
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
parent.Children.Add(strokeVisual);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果无法获取父容器,则添加到 inkCanvas.Children
|
||||||
|
_mainWindow.inkCanvas.Children.Add(strokeVisual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"添加墨迹视觉元素到画布失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"添加渐隐墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移除墨迹
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stroke">要移除的墨迹</param>
|
||||||
|
public void RemoveStroke(Stroke stroke)
|
||||||
|
{
|
||||||
|
if (stroke == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_fadeTimers.TryGetValue(stroke, out var timer))
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
_fadeTimers.Remove(stroke);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_strokeVisuals.TryGetValue(stroke, out var visual))
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 从父容器中移除墨迹
|
||||||
|
var parent = _mainWindow.inkCanvas?.Parent as Panel;
|
||||||
|
if (parent != null && parent.Children.Contains(visual))
|
||||||
|
{
|
||||||
|
parent.Children.Remove(visual);
|
||||||
|
}
|
||||||
|
else if (_mainWindow.inkCanvas != null && _mainWindow.inkCanvas.Children.Contains(visual))
|
||||||
|
{
|
||||||
|
_mainWindow.inkCanvas.Children.Remove(visual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"从画布移除墨迹视觉元素失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_strokeVisuals.Remove(stroke);
|
||||||
|
}
|
||||||
|
|
||||||
|
_strokeStartPoints.Remove(stroke);
|
||||||
|
_strokeEndPoints.Remove(stroke);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"移除渐隐墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除所有渐隐墨迹
|
||||||
|
/// </summary>
|
||||||
|
public void ClearAllFadingStrokes()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var timer in _fadeTimers.Values)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
_fadeTimers.Clear();
|
||||||
|
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_mainWindow.inkCanvas != null)
|
||||||
|
{
|
||||||
|
var parent = _mainWindow.inkCanvas.Parent as Panel;
|
||||||
|
foreach (var visual in _strokeVisuals.Values)
|
||||||
|
{
|
||||||
|
if (parent != null && parent.Children.Contains(visual))
|
||||||
|
{
|
||||||
|
parent.Children.Remove(visual);
|
||||||
|
}
|
||||||
|
else if (_mainWindow.inkCanvas.Children.Contains(visual))
|
||||||
|
{
|
||||||
|
_mainWindow.inkCanvas.Children.Remove(visual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清除所有墨迹视觉元素失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_strokeVisuals.Clear();
|
||||||
|
_strokeStartPoints.Clear();
|
||||||
|
_strokeEndPoints.Clear();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清除所有渐隐墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新渐隐时间设置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fadeTime">新的渐隐时间(毫秒)</param>
|
||||||
|
public void UpdateFadeTime(int fadeTime)
|
||||||
|
{
|
||||||
|
FadeTime = fadeTime;
|
||||||
|
|
||||||
|
foreach (var kvp in _fadeTimers)
|
||||||
|
{
|
||||||
|
var stroke = kvp.Key;
|
||||||
|
var timer = kvp.Value;
|
||||||
|
|
||||||
|
timer.Stop();
|
||||||
|
timer.Interval = TimeSpan.FromMilliseconds(FadeTime);
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用墨迹渐隐功能
|
||||||
|
/// </summary>
|
||||||
|
public void Enable()
|
||||||
|
{
|
||||||
|
IsEnabled = true;
|
||||||
|
LogHelper.WriteLogToFile("墨迹渐隐功能已启用");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁用墨迹渐隐功能
|
||||||
|
/// </summary>
|
||||||
|
public void Disable()
|
||||||
|
{
|
||||||
|
IsEnabled = false;
|
||||||
|
LogHelper.WriteLogToFile("墨迹渐隐功能已禁用");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
/// <summary>
|
||||||
|
/// 创建墨迹的视觉元素
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stroke">墨迹对象</param>
|
||||||
|
/// <returns>视觉元素</returns>
|
||||||
|
private UIElement CreateStrokeVisual(Stroke stroke)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 创建路径几何,使用墨迹的实际位置
|
||||||
|
var geometry = stroke.GetGeometry();
|
||||||
|
if (geometry == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取绘画属性
|
||||||
|
var drawingAttribs = stroke.DrawingAttributes;
|
||||||
|
|
||||||
|
// 创建路径元素,确保使用正确的绘画属性
|
||||||
|
var path = new Path
|
||||||
|
{
|
||||||
|
Data = geometry,
|
||||||
|
Stroke = new SolidColorBrush(drawingAttribs.Color),
|
||||||
|
StrokeThickness = drawingAttribs.Width, // 使用原始墨迹的粗细
|
||||||
|
StrokeStartLineCap = PenLineCap.Round,
|
||||||
|
StrokeEndLineCap = PenLineCap.Round,
|
||||||
|
StrokeLineJoin = PenLineJoin.Round,
|
||||||
|
Fill = drawingAttribs.IsHighlighter ? new SolidColorBrush(drawingAttribs.Color) : null, // 高亮笔需要填充
|
||||||
|
Opacity = 0.95, // 初始透明度更高,显得更自然
|
||||||
|
|
||||||
|
// 优化渲染质量
|
||||||
|
UseLayoutRounding = false,
|
||||||
|
SnapsToDevicePixels = false
|
||||||
|
};
|
||||||
|
|
||||||
|
// 如果是高亮笔,调整透明度和混合模式
|
||||||
|
if (drawingAttribs.IsHighlighter)
|
||||||
|
{
|
||||||
|
path.Opacity = 0.4; // 高亮笔初始透明度更低,更符合荧光笔特性
|
||||||
|
|
||||||
|
// 为高亮笔添加特殊的混合效果
|
||||||
|
// 使用更柔和的笔触样式
|
||||||
|
path.StrokeStartLineCap = PenLineCap.Flat;
|
||||||
|
path.StrokeEndLineCap = PenLineCap.Flat;
|
||||||
|
path.StrokeLineJoin = PenLineJoin.Miter;
|
||||||
|
|
||||||
|
// 高亮笔通常需要更宽的笔触来覆盖下面的内容
|
||||||
|
if (drawingAttribs.Width < 20)
|
||||||
|
{
|
||||||
|
path.StrokeThickness = Math.Max(drawingAttribs.Width * 1.5, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为高亮笔添加轻微的模糊效果,使渐隐更加自然
|
||||||
|
path.Effect = new BlurEffect
|
||||||
|
{
|
||||||
|
Radius = 0.5, // 轻微的模糊效果
|
||||||
|
KernelType = KernelType.Gaussian
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不设置任何变换,保持墨迹原有粗细
|
||||||
|
var bounds = geometry.Bounds;
|
||||||
|
|
||||||
|
// 设置墨迹的初始位置
|
||||||
|
System.Windows.Controls.Canvas.SetLeft(path, bounds.Left);
|
||||||
|
System.Windows.Controls.Canvas.SetTop(path, bounds.Top);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始渐隐动画
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stroke">要渐隐的墨迹</param>
|
||||||
|
private void StartFadeAnimation(Stroke stroke)
|
||||||
|
{
|
||||||
|
if (!_strokeVisuals.TryGetValue(stroke, out var visual)) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
// 获取当前透明度和判断是否为高亮笔
|
||||||
|
var currentOpacity = visual.Opacity;
|
||||||
|
var isHighlighter = stroke.DrawingAttributes.IsHighlighter;
|
||||||
|
|
||||||
|
// 根据墨迹类型选择不同的动画效果
|
||||||
|
if (isHighlighter)
|
||||||
|
{
|
||||||
|
StartHighlighterFadeAnimation(visual, stroke, currentOpacity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartNormalStrokeFadeAnimation(visual, stroke, currentOpacity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"开始渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始普通墨迹的渐隐动画
|
||||||
|
/// </summary>
|
||||||
|
private void StartNormalStrokeFadeAnimation(UIElement visual, Stroke stroke, double currentOpacity)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StartProgressiveFadeAnimation(visual, stroke, currentOpacity, AnimationDuration);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"开始普通墨迹渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 统一渐隐动画 - 整个墨迹作为一个整体进行渐隐,与擦除效果一致
|
||||||
|
/// </summary>
|
||||||
|
private void StartUnifiedFadeAnimation(UIElement visual, Stroke stroke, double currentOpacity, int duration)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 创建透明度动画,模拟擦除时的效果
|
||||||
|
var fadeAnimation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = currentOpacity,
|
||||||
|
To = 0.0,
|
||||||
|
Duration = TimeSpan.FromMilliseconds(duration),
|
||||||
|
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseInOut }
|
||||||
|
};
|
||||||
|
|
||||||
|
// 如果是高亮笔,添加轻微的缩放效果,使渐隐更加自然
|
||||||
|
if (stroke.DrawingAttributes.IsHighlighter)
|
||||||
|
{
|
||||||
|
// 创建轻微的缩放动画,模拟墨迹"蒸发"的效果
|
||||||
|
var scaleAnimation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = 1.0,
|
||||||
|
To = 0.95, // 轻微缩小,增加自然感
|
||||||
|
Duration = TimeSpan.FromMilliseconds(duration),
|
||||||
|
EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseIn }
|
||||||
|
};
|
||||||
|
|
||||||
|
// 创建缩放变换
|
||||||
|
var scaleTransform = new ScaleTransform();
|
||||||
|
visual.RenderTransform = scaleTransform;
|
||||||
|
visual.RenderTransformOrigin = new Point(0.5, 0.5);
|
||||||
|
|
||||||
|
// 应用缩放动画
|
||||||
|
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);
|
||||||
|
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加动画完成事件
|
||||||
|
fadeAnimation.Completed += (sender, e) => OnAnimationCompleted(visual, stroke);
|
||||||
|
|
||||||
|
// 应用透明度动画
|
||||||
|
visual.BeginAnimation(UIElement.OpacityProperty, fadeAnimation);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"统一渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
OnAnimationCompleted(visual, stroke);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始高亮笔的渐隐动画
|
||||||
|
/// </summary>
|
||||||
|
private void StartHighlighterFadeAnimation(UIElement visual, Stroke stroke, double currentOpacity)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 高亮笔使用统一的渐隐动画,与擦除效果一致
|
||||||
|
StartUnifiedFadeAnimation(visual, stroke, currentOpacity, (int)(AnimationDuration * 1.2));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"开始高亮笔渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 渐进式渐隐动画 - 从起点到终点逐渐消失
|
||||||
|
/// </summary>
|
||||||
|
private void StartProgressiveFadeAnimation(UIElement visual, Stroke stroke, double currentOpacity, int duration)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 确保所有墨迹都能显示动画,包括短墨迹
|
||||||
|
if (stroke.StylusPoints.Count < 2)
|
||||||
|
{
|
||||||
|
// 只有1个点的墨迹也使用分段动画,确保视觉效果
|
||||||
|
CreateSegmentedStroke(visual, stroke, currentOpacity, duration);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将墨迹分段并创建多个 Path
|
||||||
|
CreateSegmentedStroke(visual, stroke, currentOpacity, duration);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"渐进式渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
// 失败时回退到简单动画
|
||||||
|
StartSimpleFadeAnimation(visual, stroke, currentOpacity, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建分段墨迹并开始渐进消失
|
||||||
|
/// </summary>
|
||||||
|
private void CreateSegmentedStroke(UIElement originalVisual, Stroke stroke, double opacity, int duration)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var stylusPoints = stroke.StylusPoints;
|
||||||
|
var totalPoints = stylusPoints.Count;
|
||||||
|
|
||||||
|
// 分段算法 - 确保所有墨迹都有足够的动画效果
|
||||||
|
var strokeLength = CalculateStrokeLength(stylusPoints);
|
||||||
|
var segmentCount = CalculateOptimalSegmentCount(totalPoints, strokeLength);
|
||||||
|
|
||||||
|
// 强制最小分段数量,确保短墨迹也有动画效果
|
||||||
|
segmentCount = Math.Max(segmentCount, 4);
|
||||||
|
|
||||||
|
var pointsPerSegment = Math.Max(1, totalPoints / segmentCount);
|
||||||
|
|
||||||
|
// 隐藏原始视觉元素
|
||||||
|
originalVisual.Visibility = Visibility.Hidden;
|
||||||
|
|
||||||
|
var segments = new List<UIElement>();
|
||||||
|
var parent = _mainWindow.inkCanvas?.Parent as Panel;
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
// 如果父容器不是Panel,直接使用InkCanvas
|
||||||
|
parent = null; // 稍后会检查并使用InkCanvas.Children
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建各个分段 - 确保短墨迹也能正确分段
|
||||||
|
for (int i = 0; i < segmentCount; i++)
|
||||||
|
{
|
||||||
|
var startIndex = i * pointsPerSegment;
|
||||||
|
var endIndex = (i == segmentCount - 1) ? totalPoints - 1 : (i + 1) * pointsPerSegment;
|
||||||
|
|
||||||
|
// 确保有足够的点来创建分段,对于短墨迹特殊处理
|
||||||
|
if (endIndex <= startIndex && totalPoints > 1)
|
||||||
|
{
|
||||||
|
// 短墨迹:每个点作为一个分段
|
||||||
|
startIndex = i;
|
||||||
|
endIndex = Math.Min(i + 1, totalPoints - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为每个分段添加重叠,确保连接处平滑
|
||||||
|
var overlap = Math.Max(1, pointsPerSegment / 6); // 15%的重叠,平衡平滑与速度
|
||||||
|
var actualStartIndex = Math.Max(0, startIndex - overlap);
|
||||||
|
var actualEndIndex = Math.Min(totalPoints - 1, endIndex + overlap);
|
||||||
|
|
||||||
|
var segment = CreateStrokeSegment(stroke, actualStartIndex, actualEndIndex, opacity);
|
||||||
|
if (segment != null)
|
||||||
|
{
|
||||||
|
segments.Add(segment);
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
parent.Children.Add(segment);
|
||||||
|
}
|
||||||
|
else if (_mainWindow.inkCanvas != null)
|
||||||
|
{
|
||||||
|
_mainWindow.inkCanvas.Children.Add(segment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始分段渐隐动画
|
||||||
|
StartSegmentedFadeAnimation(segments, stroke, originalVisual, duration);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
StartSimpleFadeAnimation(originalVisual, stroke, opacity, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建墨迹分段
|
||||||
|
/// </summary>
|
||||||
|
private UIElement CreateStrokeSegment(Stroke originalStroke, int startIndex, int endIndex, double opacity)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 创建分段的 StylusPoint 集合
|
||||||
|
var segmentPoints = new StylusPointCollection();
|
||||||
|
for (int i = startIndex; i <= endIndex && i < originalStroke.StylusPoints.Count; i++)
|
||||||
|
{
|
||||||
|
segmentPoints.Add(originalStroke.StylusPoints[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (segmentPoints.Count < 2) return null;
|
||||||
|
|
||||||
|
// 创建分段墨迹
|
||||||
|
var segmentStroke = new Stroke(segmentPoints)
|
||||||
|
{
|
||||||
|
DrawingAttributes = originalStroke.DrawingAttributes.Clone()
|
||||||
|
};
|
||||||
|
|
||||||
|
// 创建分段的视觉元素
|
||||||
|
var geometry = segmentStroke.GetGeometry();
|
||||||
|
if (geometry == null) return null;
|
||||||
|
|
||||||
|
var drawingAttribs = segmentStroke.DrawingAttributes;
|
||||||
|
var path = new Path
|
||||||
|
{
|
||||||
|
Data = geometry,
|
||||||
|
Stroke = new SolidColorBrush(drawingAttribs.Color),
|
||||||
|
StrokeThickness = drawingAttribs.Width,
|
||||||
|
StrokeStartLineCap = drawingAttribs.IsHighlighter ? PenLineCap.Flat : PenLineCap.Round,
|
||||||
|
StrokeEndLineCap = drawingAttribs.IsHighlighter ? PenLineCap.Flat : PenLineCap.Round,
|
||||||
|
StrokeLineJoin = drawingAttribs.IsHighlighter ? PenLineJoin.Miter : PenLineJoin.Round,
|
||||||
|
Fill = drawingAttribs.IsHighlighter ? new SolidColorBrush(drawingAttribs.Color) : null,
|
||||||
|
Opacity = opacity,
|
||||||
|
UseLayoutRounding = false,
|
||||||
|
SnapsToDevicePixels = false
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置位置
|
||||||
|
var bounds = geometry.Bounds;
|
||||||
|
System.Windows.Controls.Canvas.SetLeft(path, bounds.Left);
|
||||||
|
System.Windows.Controls.Canvas.SetTop(path, bounds.Top);
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始分段渐隐动画
|
||||||
|
/// </summary>
|
||||||
|
private void StartSegmentedFadeAnimation(List<UIElement> segments, Stroke originalStroke, UIElement originalVisual, int totalDuration)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 动画时序算法
|
||||||
|
var segmentDuration = CalculateOptimalSegmentDuration(totalDuration, segments.Count);
|
||||||
|
var animationCurve = CreateAppleStyleAnimationCurve(segments.Count, totalDuration);
|
||||||
|
|
||||||
|
// 跟踪动画完成状态
|
||||||
|
var completedSegments = new HashSet<UIElement>();
|
||||||
|
var totalSegments = segments.Count;
|
||||||
|
|
||||||
|
// 渐隐效果 - 使用自然的动画曲线
|
||||||
|
for (int i = 0; i < segments.Count; i++)
|
||||||
|
{
|
||||||
|
var segment = segments[i];
|
||||||
|
|
||||||
|
// 使用预计算的动画曲线获取延迟时间
|
||||||
|
var delay = animationCurve[i];
|
||||||
|
|
||||||
|
// 使用定时器延迟启动每个分段的动画
|
||||||
|
var timer = new DispatcherTimer
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromMilliseconds(delay)
|
||||||
|
};
|
||||||
|
|
||||||
|
int segmentIndex = i; // 捕获当前索引
|
||||||
|
timer.Tick += (sender, e) =>
|
||||||
|
{
|
||||||
|
StartSingleSegmentFadeAnimation(segment, segmentDuration, () =>
|
||||||
|
{
|
||||||
|
// 动画完成回调
|
||||||
|
lock (completedSegments)
|
||||||
|
{
|
||||||
|
completedSegments.Add(segment);
|
||||||
|
|
||||||
|
// 检查是否所有分段都完成了
|
||||||
|
if (completedSegments.Count >= totalSegments)
|
||||||
|
{
|
||||||
|
CleanupSegmentedAnimation(segments, originalStroke, originalVisual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
timer.Stop();
|
||||||
|
};
|
||||||
|
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置一个安全超时定时器,防止无限等待
|
||||||
|
var safetyTimeout = totalDuration + (segments.Count * segmentDuration) + 1200; // 额外1.2秒缓冲,确保动画完整
|
||||||
|
var safetyTimer = new DispatcherTimer
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromMilliseconds(safetyTimeout)
|
||||||
|
};
|
||||||
|
|
||||||
|
safetyTimer.Tick += (sender, e) =>
|
||||||
|
{
|
||||||
|
CleanupSegmentedAnimation(segments, originalStroke, originalVisual);
|
||||||
|
safetyTimer.Stop();
|
||||||
|
};
|
||||||
|
|
||||||
|
safetyTimer.Start();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"分段渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
CleanupSegmentedAnimation(segments, originalStroke, originalVisual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单个分段的渐隐动画
|
||||||
|
/// </summary>
|
||||||
|
private void StartSingleSegmentFadeAnimation(UIElement segment, int duration, Action onCompleted = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 只使用透明度动画,保持墨迹原有粗细
|
||||||
|
var fadeAnimation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = segment.Opacity,
|
||||||
|
To = 0.0,
|
||||||
|
Duration = TimeSpan.FromMilliseconds(duration),
|
||||||
|
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseInOut } // 更平滑的缓动
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加动画完成事件
|
||||||
|
if (onCompleted != null)
|
||||||
|
{
|
||||||
|
fadeAnimation.Completed += (sender, e) =>
|
||||||
|
{
|
||||||
|
onCompleted?.Invoke();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只应用透明度动画,不改变墨迹大小
|
||||||
|
segment.BeginAnimation(UIElement.OpacityProperty, fadeAnimation);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"单个分段渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
// 即使失败也要调用完成回调
|
||||||
|
onCompleted?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理分段动画
|
||||||
|
/// </summary>
|
||||||
|
private void CleanupSegmentedAnimation(List<UIElement> segments, Stroke originalStroke, UIElement originalVisual)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 移除所有分段
|
||||||
|
var parent = _mainWindow.inkCanvas?.Parent as Panel;
|
||||||
|
|
||||||
|
foreach (var segment in segments)
|
||||||
|
{
|
||||||
|
if (parent != null && parent.Children.Contains(segment))
|
||||||
|
{
|
||||||
|
parent.Children.Remove(segment);
|
||||||
|
}
|
||||||
|
else if (_mainWindow.inkCanvas != null && _mainWindow.inkCanvas.Children.Contains(segment))
|
||||||
|
{
|
||||||
|
_mainWindow.inkCanvas.Children.Remove(segment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理原始墨迹
|
||||||
|
OnAnimationCompleted(originalVisual, originalStroke);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理分段动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 简单渐隐动画(备用方案)
|
||||||
|
/// </summary>
|
||||||
|
private void StartSimpleFadeAnimation(UIElement visual, Stroke stroke, double currentOpacity, int duration)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var fadeAnimation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
From = currentOpacity,
|
||||||
|
To = 0.0,
|
||||||
|
Duration = TimeSpan.FromMilliseconds(duration),
|
||||||
|
EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseIn }
|
||||||
|
};
|
||||||
|
|
||||||
|
fadeAnimation.Completed += (sender, e) => OnAnimationCompleted(visual, stroke);
|
||||||
|
visual.BeginAnimation(UIElement.OpacityProperty, fadeAnimation);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"简单渐隐动画失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
OnAnimationCompleted(visual, stroke);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算墨迹的实际长度
|
||||||
|
/// </summary>
|
||||||
|
private double CalculateStrokeLength(StylusPointCollection points)
|
||||||
|
{
|
||||||
|
if (points.Count < 2) return 0;
|
||||||
|
|
||||||
|
double totalLength = 0;
|
||||||
|
for (int i = 1; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
var p1 = points[i - 1].ToPoint();
|
||||||
|
var p2 = points[i].ToPoint();
|
||||||
|
totalLength += Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2));
|
||||||
|
}
|
||||||
|
return totalLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据墨迹特性计算最优分段数量 - 平衡速度与完整性
|
||||||
|
/// </summary>
|
||||||
|
private int CalculateOptimalSegmentCount(int pointCount, double strokeLength)
|
||||||
|
{
|
||||||
|
// 平衡速度与完整性,确保动画效果的同时提高速度
|
||||||
|
const double PIXELS_PER_SEGMENT = 12.0; // 每段适中长度,平衡效果与速度
|
||||||
|
const int MIN_SEGMENTS = 5; // 适当的最小分段数,确保动画效果
|
||||||
|
const int MAX_SEGMENTS = 100; // 适中的最大分段数,平衡性能与效果
|
||||||
|
|
||||||
|
// 根据长度计算基础分段数
|
||||||
|
var lengthBasedSegments = Math.Max(MIN_SEGMENTS, (int)(strokeLength / PIXELS_PER_SEGMENT));
|
||||||
|
|
||||||
|
// 根据点密度调整,平衡效果与速度
|
||||||
|
var density = pointCount > 0 ? strokeLength / pointCount : 1;
|
||||||
|
var densityFactor = Math.Max(0.4, Math.Min(2.5, density / 1.8));
|
||||||
|
|
||||||
|
var finalSegments = (int)(lengthBasedSegments * densityFactor);
|
||||||
|
|
||||||
|
// 对于短墨迹,确保至少有4个分段
|
||||||
|
if (pointCount <= 5)
|
||||||
|
{
|
||||||
|
finalSegments = Math.Max(finalSegments, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 限制在合理范围内
|
||||||
|
return Math.Min(MAX_SEGMENTS, Math.Max(MIN_SEGMENTS, finalSegments));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算最优的单段动画持续时间 - 平衡速度与完整性
|
||||||
|
/// </summary>
|
||||||
|
private int CalculateOptimalSegmentDuration(int totalDuration, int segmentCount)
|
||||||
|
{
|
||||||
|
// 平衡速度与动画完整性
|
||||||
|
var baseDuration = totalDuration / Math.Max(segmentCount, 1);
|
||||||
|
var minDuration = 150; // 每段最少150ms,确保动画完整显示
|
||||||
|
var maxDuration = 500; // 每段最多500ms,平衡速度与完整性
|
||||||
|
|
||||||
|
return Math.Max(minDuration, Math.Min(maxDuration, baseDuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建优化的动画时间曲线 - 平衡速度与完整性
|
||||||
|
/// </summary>
|
||||||
|
private int[] CreateAppleStyleAnimationCurve(int segmentCount, int totalDuration)
|
||||||
|
{
|
||||||
|
var curve = new int[segmentCount];
|
||||||
|
|
||||||
|
// 平衡速度与完整性,确保动画有足够时间播放
|
||||||
|
var availableTime = totalDuration * 0.6; // 使用60%的总时间,给动画留足够缓冲
|
||||||
|
var delayBetweenSegments = Math.Max(60, availableTime / Math.Max(segmentCount, 1));
|
||||||
|
|
||||||
|
for (int i = 0; i < segmentCount; i++)
|
||||||
|
{
|
||||||
|
// 线性延迟,确保每个分段都有足够时间
|
||||||
|
curve[i] = (int)(i * delayBetweenSegments);
|
||||||
|
}
|
||||||
|
|
||||||
|
return curve;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动画完成后的统一处理
|
||||||
|
/// </summary>
|
||||||
|
private void OnAnimationCompleted(UIElement visual, Stroke stroke)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 从父容器中移除墨迹
|
||||||
|
var parent = _mainWindow.inkCanvas?.Parent as Panel;
|
||||||
|
if (parent != null && parent.Children.Contains(visual))
|
||||||
|
{
|
||||||
|
parent.Children.Remove(visual);
|
||||||
|
}
|
||||||
|
else if (_mainWindow.inkCanvas != null && _mainWindow.inkCanvas.Children.Contains(visual))
|
||||||
|
{
|
||||||
|
_mainWindow.inkCanvas.Children.Remove(visual);
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveStroke(stroke);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"渐隐动画完成后清理墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
|
|
||||||
var analyzer = new InkAnalyzer();
|
var analyzer = new InkAnalyzer();
|
||||||
analyzer.AddStrokes(strokes);
|
analyzer.AddStrokes(strokes);
|
||||||
analyzer.SetStrokesType(strokes, System.Windows.Ink.StrokeType.Drawing);
|
analyzer.SetStrokesType(strokes, StrokeType.Drawing);
|
||||||
|
|
||||||
AnalysisAlternate analysisAlternate = null;
|
AnalysisAlternate analysisAlternate = null;
|
||||||
int strokesCount = strokes.Count;
|
int strokesCount = strokes.Count;
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 墨迹平滑配置类
|
||||||
|
/// </summary>
|
||||||
|
public class InkSmoothingConfig
|
||||||
|
{
|
||||||
|
// 基本平滑参数
|
||||||
|
public double SmoothingStrength { get; set; } = 0.4;
|
||||||
|
public double ResampleInterval { get; set; } = 2.5;
|
||||||
|
public int InterpolationSteps { get; set; } = 12;
|
||||||
|
|
||||||
|
// 贝塞尔曲线参数
|
||||||
|
public bool UseAdaptiveInterpolation { get; set; } = true;
|
||||||
|
public double CurveTension { get; set; } = 0.3;
|
||||||
|
public double MinCurvatureThreshold { get; set; } = 0.1;
|
||||||
|
public double MaxCurvatureThreshold { get; set; } = 0.8;
|
||||||
|
|
||||||
|
// 性能参数
|
||||||
|
public bool UseHardwareAcceleration { get; set; } = true;
|
||||||
|
public bool UseAsyncProcessing { get; set; } = true;
|
||||||
|
public int MaxConcurrentTasks { get; set; } = Environment.ProcessorCount;
|
||||||
|
public int MaxPointsPerStroke { get; set; } = 10000;
|
||||||
|
|
||||||
|
// 质量设置
|
||||||
|
public SmoothingQuality Quality { get; set; } = SmoothingQuality.Balanced;
|
||||||
|
|
||||||
|
public enum SmoothingQuality
|
||||||
|
{
|
||||||
|
Performance, // 性能优先
|
||||||
|
Balanced, // 平衡
|
||||||
|
Quality // 质量优先
|
||||||
|
}
|
||||||
|
|
||||||
|
// 兼容性枚举
|
||||||
|
public enum InkSmoothingQuality
|
||||||
|
{
|
||||||
|
HighPerformance = 0, // 高性能低质量
|
||||||
|
Balanced = 1, // 平衡
|
||||||
|
HighQuality = 2 // 高质量低性能
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从设置中加载配置
|
||||||
|
/// </summary>
|
||||||
|
public static InkSmoothingConfig FromSettings()
|
||||||
|
{
|
||||||
|
var config = new InkSmoothingConfig();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 尝试从MainWindow.Settings加载配置(兼容性)
|
||||||
|
if (MainWindow.Settings?.Canvas != null)
|
||||||
|
{
|
||||||
|
config.Quality = (SmoothingQuality)MainWindow.Settings.Canvas.InkSmoothingQuality;
|
||||||
|
config.UseHardwareAcceleration = MainWindow.Settings.Canvas.UseHardwareAcceleration;
|
||||||
|
config.UseAsyncProcessing = MainWindow.Settings.Canvas.UseAsyncInkSmoothing;
|
||||||
|
config.MaxConcurrentTasks = MainWindow.Settings.Canvas.MaxConcurrentSmoothingTasks > 0 ?
|
||||||
|
MainWindow.Settings.Canvas.MaxConcurrentSmoothingTasks : Environment.ProcessorCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"加载平滑配置失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用质量设置
|
||||||
|
/// </summary>
|
||||||
|
public void ApplyQualitySettings()
|
||||||
|
{
|
||||||
|
// 保存用户设置的异步处理偏好
|
||||||
|
bool userAsyncPreference = UseAsyncProcessing;
|
||||||
|
|
||||||
|
switch (Quality)
|
||||||
|
{
|
||||||
|
case SmoothingQuality.Performance:
|
||||||
|
SmoothingStrength = 0.15;
|
||||||
|
ResampleInterval = 5.0;
|
||||||
|
InterpolationSteps = 4;
|
||||||
|
UseAdaptiveInterpolation = false;
|
||||||
|
CurveTension = 0.15;
|
||||||
|
MaxConcurrentTasks = Math.Max(1, Environment.ProcessorCount / 2);
|
||||||
|
UseHardwareAcceleration = true;
|
||||||
|
UseAsyncProcessing = userAsyncPreference;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SmoothingQuality.Balanced:
|
||||||
|
SmoothingStrength = 0.3;
|
||||||
|
ResampleInterval = 3.0;
|
||||||
|
InterpolationSteps = 8;
|
||||||
|
UseAdaptiveInterpolation = true;
|
||||||
|
CurveTension = 0.25;
|
||||||
|
MaxConcurrentTasks = Environment.ProcessorCount;
|
||||||
|
UseHardwareAcceleration = true;
|
||||||
|
UseAsyncProcessing = userAsyncPreference;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SmoothingQuality.Quality:
|
||||||
|
SmoothingStrength = 0.5;
|
||||||
|
ResampleInterval = 2.0;
|
||||||
|
InterpolationSteps = 15;
|
||||||
|
UseAdaptiveInterpolation = true;
|
||||||
|
CurveTension = 0.35;
|
||||||
|
MaxConcurrentTasks = Environment.ProcessorCount;
|
||||||
|
UseHardwareAcceleration = true;
|
||||||
|
UseAsyncProcessing = userAsyncPreference;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存配置到设置
|
||||||
|
/// </summary>
|
||||||
|
public void SaveToSettings()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 尝试保存到MainWindow.Settings(兼容性)
|
||||||
|
if (MainWindow.Settings?.Canvas != null)
|
||||||
|
{
|
||||||
|
MainWindow.Settings.Canvas.InkSmoothingQuality = (int)Quality;
|
||||||
|
MainWindow.Settings.Canvas.UseHardwareAcceleration = UseHardwareAcceleration;
|
||||||
|
MainWindow.Settings.Canvas.UseAsyncInkSmoothing = UseAsyncProcessing;
|
||||||
|
MainWindow.Settings.Canvas.MaxConcurrentSmoothingTasks = MaxConcurrentTasks;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"保存平滑配置失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证配置参数
|
||||||
|
/// </summary>
|
||||||
|
public bool Validate()
|
||||||
|
{
|
||||||
|
return SmoothingStrength >= 0.0 && SmoothingStrength <= 1.0 &&
|
||||||
|
ResampleInterval > 0.0 &&
|
||||||
|
InterpolationSteps > 0 && InterpolationSteps <= 50 &&
|
||||||
|
CurveTension >= 0.0 && CurveTension <= 1.0 &&
|
||||||
|
MaxConcurrentTasks > 0 &&
|
||||||
|
MaxPointsPerStroke > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取配置摘要
|
||||||
|
/// </summary>
|
||||||
|
public string GetSummary()
|
||||||
|
{
|
||||||
|
return $"质量: {Quality}, 强度: {SmoothingStrength:F2}, 间隔: {ResampleInterval:F1}, " +
|
||||||
|
$"步数: {InterpolationSteps}, 自适应: {UseAdaptiveInterpolation}, " +
|
||||||
|
$"张力: {CurveTension:F2}, 硬件加速: {UseHardwareAcceleration}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Ink;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 统一的墨迹平滑管理器,整合异步处理和硬件加速
|
||||||
|
/// </summary>
|
||||||
|
public class InkSmoothingManager : IDisposable
|
||||||
|
{
|
||||||
|
private readonly AsyncAdvancedBezierSmoothing _asyncSmoothing;
|
||||||
|
private readonly HardwareAcceleratedInkProcessor _hardwareProcessor;
|
||||||
|
private readonly InkSmoothingPerformanceMonitor _performanceMonitor;
|
||||||
|
private readonly InkSmoothingConfig _config;
|
||||||
|
private readonly Dispatcher _uiDispatcher;
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
public InkSmoothingManager(Dispatcher uiDispatcher)
|
||||||
|
{
|
||||||
|
_uiDispatcher = uiDispatcher;
|
||||||
|
_config = InkSmoothingConfig.FromSettings();
|
||||||
|
_config.ApplyQualitySettings();
|
||||||
|
|
||||||
|
_asyncSmoothing = new AsyncAdvancedBezierSmoothing(uiDispatcher)
|
||||||
|
{
|
||||||
|
SmoothingStrength = _config.SmoothingStrength,
|
||||||
|
ResampleInterval = _config.ResampleInterval,
|
||||||
|
InterpolationSteps = _config.InterpolationSteps,
|
||||||
|
UseHardwareAcceleration = _config.UseHardwareAcceleration,
|
||||||
|
MaxConcurrentTasks = _config.MaxConcurrentTasks
|
||||||
|
};
|
||||||
|
|
||||||
|
_hardwareProcessor = new HardwareAcceleratedInkProcessor();
|
||||||
|
_performanceMonitor = new InkSmoothingPerformanceMonitor();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 平滑笔画(自动选择最佳方法)
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Stroke> SmoothStrokeAsync(Stroke originalStroke,
|
||||||
|
Action<Stroke, Stroke> onCompleted = null,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (originalStroke == null || originalStroke.StylusPoints.Count < 2)
|
||||||
|
return originalStroke;
|
||||||
|
|
||||||
|
var stopwatch = Stopwatch.StartNew();
|
||||||
|
Stroke result = originalStroke;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_config.UseAsyncProcessing)
|
||||||
|
{
|
||||||
|
// 使用异步处理
|
||||||
|
result = await _asyncSmoothing.SmoothStrokeAsync(originalStroke, onCompleted, cancellationToken);
|
||||||
|
}
|
||||||
|
else if (_config.UseHardwareAcceleration)
|
||||||
|
{
|
||||||
|
// 使用硬件加速但同步处理
|
||||||
|
result = await _hardwareProcessor.SmoothStrokeWithGPU(originalStroke);
|
||||||
|
onCompleted?.Invoke(originalStroke, result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 回退到传统同步处理
|
||||||
|
result = await Task.Run(() =>
|
||||||
|
{
|
||||||
|
var traditionalSmoothing = new AdvancedBezierSmoothing();
|
||||||
|
return traditionalSmoothing.SmoothStroke(originalStroke);
|
||||||
|
}, cancellationToken);
|
||||||
|
onCompleted?.Invoke(originalStroke, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
result = originalStroke;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"墨迹平滑失败: {ex.Message}");
|
||||||
|
result = originalStroke;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
stopwatch.Stop();
|
||||||
|
_performanceMonitor.RecordProcessingTime(stopwatch.Elapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 同步平滑笔画(用于向后兼容)
|
||||||
|
/// </summary>
|
||||||
|
public Stroke SmoothStroke(Stroke originalStroke)
|
||||||
|
{
|
||||||
|
if (originalStroke == null || originalStroke.StylusPoints.Count < 2)
|
||||||
|
return originalStroke;
|
||||||
|
|
||||||
|
var stopwatch = Stopwatch.StartNew();
|
||||||
|
Stroke result;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_config.UseHardwareAcceleration)
|
||||||
|
{
|
||||||
|
// 使用硬件加速的同步版本
|
||||||
|
var task = _hardwareProcessor.SmoothStrokeWithGPU(originalStroke);
|
||||||
|
task.Wait(5000); // 5秒超时
|
||||||
|
result = task.Status == TaskStatus.RanToCompletion ? task.Result : originalStroke;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 传统同步处理
|
||||||
|
var traditionalSmoothing = new AdvancedBezierSmoothing();
|
||||||
|
result = traditionalSmoothing.SmoothStroke(originalStroke);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"同步墨迹平滑失败: {ex.Message}");
|
||||||
|
result = originalStroke;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
stopwatch.Stop();
|
||||||
|
_performanceMonitor.RecordProcessingTime(stopwatch.Elapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新配置
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateConfig()
|
||||||
|
{
|
||||||
|
var newConfig = InkSmoothingConfig.FromSettings();
|
||||||
|
newConfig.ApplyQualitySettings();
|
||||||
|
|
||||||
|
_asyncSmoothing.SmoothingStrength = newConfig.SmoothingStrength;
|
||||||
|
_asyncSmoothing.ResampleInterval = newConfig.ResampleInterval;
|
||||||
|
_asyncSmoothing.InterpolationSteps = newConfig.InterpolationSteps;
|
||||||
|
_asyncSmoothing.UseHardwareAcceleration = newConfig.UseHardwareAcceleration;
|
||||||
|
_asyncSmoothing.MaxConcurrentTasks = newConfig.MaxConcurrentTasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取性能统计信息
|
||||||
|
/// </summary>
|
||||||
|
public string GetPerformanceStats()
|
||||||
|
{
|
||||||
|
return $"平均处理时间: {_performanceMonitor.GetAverageProcessingTimeMs():F2}ms, " +
|
||||||
|
$"最大处理时间: {_performanceMonitor.GetMaxProcessingTimeMs():F2}ms, " +
|
||||||
|
$"样本数: {_performanceMonitor.GetSampleCount()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取消所有正在进行的任务
|
||||||
|
/// </summary>
|
||||||
|
public void CancelAllTasks()
|
||||||
|
{
|
||||||
|
_asyncSmoothing?.CancelAllTasks();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查系统是否支持硬件加速
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsHardwareAccelerationSupported()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return RenderCapability.Tier >= 0x00020000;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取推荐的配置
|
||||||
|
/// </summary>
|
||||||
|
public static InkSmoothingConfig GetRecommendedConfig()
|
||||||
|
{
|
||||||
|
var config = new InkSmoothingConfig();
|
||||||
|
|
||||||
|
// 根据系统性能调整配置
|
||||||
|
var processorCount = Environment.ProcessorCount;
|
||||||
|
var isHardwareAccelerated = IsHardwareAccelerationSupported();
|
||||||
|
|
||||||
|
if (processorCount >= 4 && isHardwareAccelerated)
|
||||||
|
{
|
||||||
|
// 降低高质量模式的门槛,4核以上且支持硬件加速就使用高质量
|
||||||
|
config.Quality = (InkSmoothingConfig.SmoothingQuality)InkSmoothingConfig.InkSmoothingQuality.HighQuality;
|
||||||
|
config.UseHardwareAcceleration = true;
|
||||||
|
config.UseAsyncProcessing = true;
|
||||||
|
config.MaxConcurrentTasks = Math.Min(processorCount, 8);
|
||||||
|
}
|
||||||
|
else if (processorCount >= 2)
|
||||||
|
{
|
||||||
|
// 2核以上使用平衡模式
|
||||||
|
config.Quality = (InkSmoothingConfig.SmoothingQuality)InkSmoothingConfig.InkSmoothingQuality.Balanced;
|
||||||
|
config.UseHardwareAcceleration = isHardwareAccelerated;
|
||||||
|
config.UseAsyncProcessing = true;
|
||||||
|
config.MaxConcurrentTasks = Math.Min(processorCount, 4);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 单核或性能较低的设备使用高性能模式
|
||||||
|
config.Quality = (InkSmoothingConfig.SmoothingQuality)InkSmoothingConfig.InkSmoothingQuality.HighPerformance;
|
||||||
|
config.UseHardwareAcceleration = false;
|
||||||
|
config.UseAsyncProcessing = false;
|
||||||
|
config.MaxConcurrentTasks = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.ApplyQualitySettings();
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用推荐配置到设置
|
||||||
|
/// </summary>
|
||||||
|
public static void ApplyRecommendedSettings()
|
||||||
|
{
|
||||||
|
var config = GetRecommendedConfig();
|
||||||
|
|
||||||
|
MainWindow.Settings.Canvas.InkSmoothingQuality = (int)config.Quality;
|
||||||
|
MainWindow.Settings.Canvas.UseHardwareAcceleration = config.UseHardwareAcceleration;
|
||||||
|
MainWindow.Settings.Canvas.UseAsyncInkSmoothing = config.UseAsyncProcessing;
|
||||||
|
MainWindow.Settings.Canvas.MaxConcurrentSmoothingTasks = config.MaxConcurrentTasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (!_disposed)
|
||||||
|
{
|
||||||
|
CancelAllTasks();
|
||||||
|
_asyncSmoothing?.Dispose();
|
||||||
|
_hardwareProcessor?.Dispose();
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 墨迹平滑事件参数
|
||||||
|
/// </summary>
|
||||||
|
public class InkSmoothingEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public Stroke OriginalStroke { get; set; }
|
||||||
|
public Stroke SmoothedStroke { get; set; }
|
||||||
|
public TimeSpan ProcessingTime { get; set; }
|
||||||
|
public bool WasAsync { get; set; }
|
||||||
|
public bool UsedHardwareAcceleration { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +1,36 @@
|
|||||||
using System.Linq;
|
using System.Drawing;
|
||||||
using System.Windows.Interop;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using Point = System.Windows.Point;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers {
|
namespace Ink_Canvas.Helpers
|
||||||
internal class IsOutsideOfScreenHelper {
|
{
|
||||||
public static bool IsOutsideOfScreen(FrameworkElement target) {
|
internal class IsOutsideOfScreenHelper
|
||||||
|
{
|
||||||
|
public static bool IsOutsideOfScreen(FrameworkElement target)
|
||||||
|
{
|
||||||
var hwndSource = (HwndSource)PresentationSource.FromVisual(target);
|
var hwndSource = (HwndSource)PresentationSource.FromVisual(target);
|
||||||
if (hwndSource is null) {
|
if (hwndSource is null)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hWnd = hwndSource.Handle;
|
var hWnd = hwndSource.Handle;
|
||||||
var targetBounds = GetPixelBoundsToScreen(target);
|
var targetBounds = GetPixelBoundsToScreen(target);
|
||||||
|
|
||||||
var screens = System.Windows.Forms.Screen.AllScreens;
|
var screens = Screen.AllScreens;
|
||||||
return !screens.Any(x => x.Bounds.IntersectsWith(targetBounds));
|
return !screens.Any(x => x.Bounds.IntersectsWith(targetBounds));
|
||||||
|
|
||||||
System.Drawing.Rectangle GetPixelBoundsToScreen(FrameworkElement visual) {
|
Rectangle GetPixelBoundsToScreen(FrameworkElement visual)
|
||||||
|
{
|
||||||
var pixelBoundsToScreen = Rect.Empty;
|
var pixelBoundsToScreen = Rect.Empty;
|
||||||
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(0, 0)));
|
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(0, 0)));
|
||||||
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(visual.ActualWidth, 0)));
|
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(visual.ActualWidth, 0)));
|
||||||
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(0, visual.ActualHeight)));
|
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(0, visual.ActualHeight)));
|
||||||
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(visual.ActualWidth, visual.ActualHeight)));
|
pixelBoundsToScreen.Union(visual.PointToScreen(new Point(visual.ActualWidth, visual.ActualHeight)));
|
||||||
return new System.Drawing.Rectangle(
|
return new Rectangle(
|
||||||
(int)pixelBoundsToScreen.X, (int)pixelBoundsToScreen.Y,
|
(int)pixelBoundsToScreen.X, (int)pixelBoundsToScreen.Y,
|
||||||
(int)pixelBoundsToScreen.Width, (int)pixelBoundsToScreen.Height);
|
(int)pixelBoundsToScreen.Width, (int)pixelBoundsToScreen.Height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
|
|
||||||
public static void NewLog(string str)
|
public static void NewLog(string str)
|
||||||
{
|
{
|
||||||
WriteLogToFile(str, LogType.Info);
|
WriteLogToFile(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NewLog(Exception ex)
|
public static void NewLog(Exception ex)
|
||||||
@@ -33,12 +33,12 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
// 检查日志是否启用
|
// 检查日志是否启用
|
||||||
if (MainWindow.Settings != null && MainWindow.Settings.Advanced != null && !MainWindow.Settings.Advanced.IsLogEnabled) return;
|
if (MainWindow.Settings != null && MainWindow.Settings.Advanced != null && !MainWindow.Settings.Advanced.IsLogEnabled) return;
|
||||||
|
|
||||||
string strLogType = logType.ToString();
|
string strLogType = logType.ToString();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string file;
|
string file;
|
||||||
|
|
||||||
// 检查是否启用了日期保存功能
|
// 检查是否启用了日期保存功能
|
||||||
if (MainWindow.Settings != null && MainWindow.Settings.Advanced != null && MainWindow.Settings.Advanced.IsSaveLogByDate)
|
if (MainWindow.Settings != null && MainWindow.Settings.Advanced != null && MainWindow.Settings.Advanced.IsSaveLogByDate)
|
||||||
{
|
{
|
||||||
@@ -48,10 +48,10 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(logsPath);
|
Directory.CreateDirectory(logsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查Logs文件夹大小,如果超过5MB则清空
|
// 检查Logs文件夹大小,如果超过5MB则清空
|
||||||
CheckAndCleanLogsFolder(logsPath);
|
CheckAndCleanLogsFolder(logsPath);
|
||||||
|
|
||||||
// 使用软件启动时间作为日志文件名
|
// 使用软件启动时间作为日志文件名
|
||||||
file = Path.Combine(logsPath, $"Log_{AppStartTime}.txt");
|
file = Path.Combine(logsPath, $"Log_{AppStartTime}.txt");
|
||||||
}
|
}
|
||||||
@@ -59,12 +59,12 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
file = App.RootPath + LogFile;
|
file = App.RootPath + LogFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(App.RootPath))
|
if (!Directory.Exists(App.RootPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(App.RootPath);
|
Directory.CreateDirectory(App.RootPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
var threadId = Thread.CurrentThread.ManagedThreadId;
|
var threadId = Thread.CurrentThread.ManagedThreadId;
|
||||||
var callingMethod = new StackTrace(2, true).GetFrame(0);
|
var callingMethod = new StackTrace(2, true).GetFrame(0);
|
||||||
string callerInfo = "<unknown>";
|
string callerInfo = "<unknown>";
|
||||||
@@ -92,16 +92,16 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
long totalSize = 0;
|
long totalSize = 0;
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(logsPath);
|
DirectoryInfo dirInfo = new DirectoryInfo(logsPath);
|
||||||
|
|
||||||
// 如果目录不存在,直接返回
|
// 如果目录不存在,直接返回
|
||||||
if (!dirInfo.Exists) return;
|
if (!dirInfo.Exists) return;
|
||||||
|
|
||||||
// 计算文件夹大小
|
// 计算文件夹大小
|
||||||
foreach (FileInfo file in dirInfo.GetFiles())
|
foreach (FileInfo file in dirInfo.GetFiles())
|
||||||
{
|
{
|
||||||
totalSize += file.Length;
|
totalSize += file.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果超过5MB,清空文件夹
|
// 如果超过5MB,清空文件夹
|
||||||
if (totalSize > MaxLogsFolderSizeBytes)
|
if (totalSize > MaxLogsFolderSizeBytes)
|
||||||
{
|
{
|
||||||
@@ -113,7 +113,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录清理操作
|
// 记录清理操作
|
||||||
string cleanupMessage = $"Logs folder exceeded size limit ({totalSize / 1024.0 / 1024.0:F2} MB > {MaxLogsFolderSizeBytes / 1024.0 / 1024.0:F2} MB). Folder cleaned.";
|
string cleanupMessage = $"Logs folder exceeded size limit ({totalSize / 1024.0 / 1024.0:F2} MB > {MaxLogsFolderSizeBytes / 1024.0 / 1024.0:F2} MB). Folder cleaned.";
|
||||||
using (StreamWriter sw = new StreamWriter(Path.Combine(logsPath, $"Log_{AppStartTime}.txt"), true))
|
using (StreamWriter sw = new StreamWriter(Path.Combine(logsPath, $"Log_{AppStartTime}.txt"), true))
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Ink;
|
using System.Windows.Ink;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -8,31 +9,57 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
public class VisualCanvas : FrameworkElement
|
public class VisualCanvas : FrameworkElement
|
||||||
{
|
{
|
||||||
|
private readonly List<DrawingVisual> _visuals = new List<DrawingVisual>();
|
||||||
|
|
||||||
protected override Visual GetVisualChild(int index)
|
protected override Visual GetVisualChild(int index)
|
||||||
{
|
{
|
||||||
return Visual;
|
if (index < 0 || index >= _visuals.Count)
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(index));
|
||||||
|
return _visuals[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override int VisualChildrenCount => 1;
|
protected override int VisualChildrenCount => _visuals.Count;
|
||||||
|
|
||||||
public VisualCanvas(DrawingVisual visual)
|
public VisualCanvas()
|
||||||
{
|
{
|
||||||
Visual = visual;
|
CacheMode = new BitmapCache();
|
||||||
|
|
||||||
|
RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.HighQuality);
|
||||||
|
RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
|
||||||
|
RenderOptions.SetCachingHint(this, CachingHint.Cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddVisual(DrawingVisual visual)
|
||||||
|
{
|
||||||
|
if (visual == null) return;
|
||||||
|
_visuals.Add(visual);
|
||||||
AddVisualChild(visual);
|
AddVisualChild(visual);
|
||||||
}
|
}
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
foreach (var visual in _visuals)
|
||||||
|
{
|
||||||
|
RemoveVisualChild(visual);
|
||||||
|
}
|
||||||
|
_visuals.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public DrawingVisual Visual { get; }
|
public IReadOnlyList<DrawingVisual> Visuals => _visuals;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用于显示笔迹的类
|
/// 用于显示笔迹的类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StrokeVisual : DrawingVisual
|
public class StrokeVisual
|
||||||
{
|
{
|
||||||
|
private int _lastDrawnPointCount = 0;
|
||||||
|
private const int INCREMENTAL_DRAW_THRESHOLD = 2;
|
||||||
|
private VisualCanvas _visualCanvas;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建显示笔迹的类
|
/// 创建显示笔迹的类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StrokeVisual() : this(new DrawingAttributes()
|
public StrokeVisual() : this(new DrawingAttributes
|
||||||
{
|
{
|
||||||
Color = Colors.Red,
|
Color = Colors.Red,
|
||||||
//FitToCurve = true,
|
//FitToCurve = true,
|
||||||
@@ -43,7 +70,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建显示笔迹的类
|
/// 创建显示笔迹的类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="drawingAttributes"></param>
|
/// <param name="drawingAttributes"></param>
|
||||||
public StrokeVisual(DrawingAttributes drawingAttributes)
|
public StrokeVisual(DrawingAttributes drawingAttributes)
|
||||||
@@ -52,12 +79,20 @@ namespace Ink_Canvas.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置或获取显示的笔迹
|
/// 设置或获取显示的笔迹
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Stroke Stroke { set; get; }
|
public Stroke Stroke { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在笔迹中添加点
|
/// 设置关联的VisualCanvas
|
||||||
|
/// </summary>
|
||||||
|
public void SetVisualCanvas(VisualCanvas visualCanvas)
|
||||||
|
{
|
||||||
|
_visualCanvas = visualCanvas;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在笔迹中添加点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="point"></param>
|
/// <param name="point"></param>
|
||||||
public void Add(StylusPoint point)
|
public void Add(StylusPoint point)
|
||||||
@@ -74,18 +109,102 @@ namespace Ink_Canvas.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重新画出笔迹
|
/// 绘制点段到新的DrawingVisual
|
||||||
|
/// </summary>
|
||||||
|
private void DrawSegmentToNewVisual(int startIndex, int endIndex)
|
||||||
|
{
|
||||||
|
if (Stroke == null || Stroke.StylusPoints.Count == 0 || _visualCanvas == null) return;
|
||||||
|
if (startIndex >= endIndex || startIndex < 0 || endIndex > Stroke.StylusPoints.Count) return;
|
||||||
|
|
||||||
|
var points = Stroke.StylusPoints;
|
||||||
|
var drawingAttributes = Stroke.DrawingAttributes;
|
||||||
|
|
||||||
|
// 创建新的DrawingVisual用于绘制这个点段
|
||||||
|
var segmentVisual = new DrawingVisual();
|
||||||
|
|
||||||
|
RenderOptions.SetBitmapScalingMode(segmentVisual, BitmapScalingMode.HighQuality);
|
||||||
|
RenderOptions.SetEdgeMode(segmentVisual, EdgeMode.Aliased);
|
||||||
|
RenderOptions.SetCachingHint(segmentVisual, CachingHint.Cache);
|
||||||
|
|
||||||
|
using (var dc = segmentVisual.RenderOpen())
|
||||||
|
{
|
||||||
|
var pen = new Pen(new SolidColorBrush(drawingAttributes.Color), drawingAttributes.Width);
|
||||||
|
pen.StartLineCap = PenLineCap.Round;
|
||||||
|
pen.EndLineCap = PenLineCap.Round;
|
||||||
|
pen.LineJoin = PenLineJoin.Round;
|
||||||
|
|
||||||
|
// 绘制指定范围内的点段
|
||||||
|
if (endIndex - startIndex >= 2)
|
||||||
|
{
|
||||||
|
// 多个点,绘制线段
|
||||||
|
for (int i = startIndex; i < endIndex - 1 && i < points.Count - 1; i++)
|
||||||
|
{
|
||||||
|
var startPoint = new Point(points[i].X, points[i].Y);
|
||||||
|
var endPoint = new Point(points[i + 1].X, points[i + 1].Y);
|
||||||
|
dc.DrawLine(pen, startPoint, endPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (endIndex - startIndex == 1 && startIndex < points.Count)
|
||||||
|
{
|
||||||
|
// 只有一个点,绘制圆点
|
||||||
|
var brush = new SolidColorBrush(drawingAttributes.Color);
|
||||||
|
var point = points[startIndex];
|
||||||
|
dc.DrawEllipse(brush, null, new Point(point.X, point.Y),
|
||||||
|
drawingAttributes.Width / 2, drawingAttributes.Height / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将新的DrawingVisual添加到VisualCanvas中
|
||||||
|
_visualCanvas.AddVisual(segmentVisual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重新画出笔迹
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Redraw()
|
public void Redraw()
|
||||||
{
|
{
|
||||||
try
|
if (Stroke == null || _visualCanvas == null) return;
|
||||||
|
|
||||||
|
var currentPointCount = Stroke.StylusPoints.Count;
|
||||||
|
if (currentPointCount == 0) return;
|
||||||
|
|
||||||
|
// 计算新增的点数
|
||||||
|
int newPointCount = currentPointCount - _lastDrawnPointCount;
|
||||||
|
|
||||||
|
// 如果新增点数达到阈值,才进行增量绘制
|
||||||
|
if (newPointCount >= INCREMENTAL_DRAW_THRESHOLD || _lastDrawnPointCount == 0)
|
||||||
{
|
{
|
||||||
using (var dc = RenderOpen())
|
try
|
||||||
{
|
{
|
||||||
Stroke.Draw(dc);
|
if (_lastDrawnPointCount == 0)
|
||||||
|
{
|
||||||
|
// 首次绘制:绘制所有点
|
||||||
|
DrawSegmentToNewVisual(0, currentPointCount);
|
||||||
|
_lastDrawnPointCount = currentPointCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 从上次绘制的最后一个点开始
|
||||||
|
int startIndex = Math.Max(0, _lastDrawnPointCount - 1);
|
||||||
|
DrawSegmentToNewVisual(startIndex, currentPointCount);
|
||||||
|
_lastDrawnPointCount = currentPointCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
catch { }
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 强制重绘
|
||||||
|
/// </summary>
|
||||||
|
public void ForceRedraw()
|
||||||
|
{
|
||||||
|
if (_visualCanvas != null)
|
||||||
|
{
|
||||||
|
_visualCanvas.Clear();
|
||||||
|
}
|
||||||
|
_lastDrawnPointCount = 0;
|
||||||
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly DrawingAttributes _drawingAttributes;
|
private readonly DrawingAttributes _drawingAttributes;
|
||||||
|
|||||||
@@ -0,0 +1,672 @@
|
|||||||
|
using Microsoft.Office.Interop.PowerPoint;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Ink;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PPT墨迹管理器 - 负责PPT中墨迹的保存、加载和同步
|
||||||
|
/// </summary>
|
||||||
|
public class PPTInkManager : IDisposable
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
public bool IsAutoSaveEnabled { get; set; } = true;
|
||||||
|
public string AutoSaveLocation { get; set; } = "";
|
||||||
|
public StrokeCollection CurrentStrokes { get; private set; } = new StrokeCollection();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
private MemoryStream[] _memoryStreams;
|
||||||
|
private int _maxSlides = 100;
|
||||||
|
private string _currentPresentationId = "";
|
||||||
|
private readonly object _lockObject = new object();
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
// 墨迹锁定机制,防止翻页时的墨迹冲突
|
||||||
|
private DateTime _inkLockUntil = DateTime.MinValue;
|
||||||
|
private int _lockedSlideIndex = -1;
|
||||||
|
private const int InkLockMilliseconds = 500;
|
||||||
|
|
||||||
|
// 添加快速切换保护机制
|
||||||
|
private DateTime _lastSwitchTime = DateTime.MinValue;
|
||||||
|
private int _lastSwitchSlideIndex = -1;
|
||||||
|
private const int MinSwitchIntervalMs = 100; // 最小切换间隔100毫秒
|
||||||
|
|
||||||
|
// 内存管理相关字段
|
||||||
|
private long _totalMemoryUsage = 0;
|
||||||
|
private const long MaxMemoryUsageBytes = 100 * 1024 * 1024; // 100MB限制
|
||||||
|
private DateTime _lastMemoryCleanup = DateTime.MinValue;
|
||||||
|
private const int MemoryCleanupIntervalMinutes = 5; // 5分钟清理一次
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public PPTInkManager()
|
||||||
|
{
|
||||||
|
InitializeMemoryStreams();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeMemoryStreams()
|
||||||
|
{
|
||||||
|
_memoryStreams = new MemoryStream[_maxSlides + 2];
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化新的演示文稿
|
||||||
|
/// </summary>
|
||||||
|
public void InitializePresentation(Presentation presentation)
|
||||||
|
{
|
||||||
|
if (presentation == null) return;
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 完全清理之前的墨迹状态
|
||||||
|
ClearAllStrokes();
|
||||||
|
|
||||||
|
// 重置墨迹锁定状态
|
||||||
|
_inkLockUntil = DateTime.MinValue;
|
||||||
|
_lockedSlideIndex = -1;
|
||||||
|
|
||||||
|
// 生成演示文稿唯一标识符
|
||||||
|
_currentPresentationId = GeneratePresentationId(presentation);
|
||||||
|
|
||||||
|
// 重新初始化内存流数组
|
||||||
|
int slideCount = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
slideCount = presentation.Slides.Count;
|
||||||
|
}
|
||||||
|
catch (COMException comEx)
|
||||||
|
{
|
||||||
|
var hr = (uint)comEx.HResult;
|
||||||
|
if (hr == 0x80048010)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
_memoryStreams = new MemoryStream[slideCount + 2];
|
||||||
|
|
||||||
|
// 如果启用自动保存,尝试加载已保存的墨迹
|
||||||
|
if (IsAutoSaveEnabled && !string.IsNullOrEmpty(AutoSaveLocation))
|
||||||
|
{
|
||||||
|
LoadSavedStrokes();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"初始化演示文稿墨迹管理失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存当前页面的墨迹
|
||||||
|
/// </summary>
|
||||||
|
public void SaveCurrentSlideStrokes(int slideIndex, StrokeCollection strokes)
|
||||||
|
{
|
||||||
|
if (slideIndex <= 0 || strokes == null) return;
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查墨迹锁定
|
||||||
|
if (!CanWriteInk(slideIndex))
|
||||||
|
{
|
||||||
|
if (DateTime.Now < _inkLockUntil)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slideIndex < _memoryStreams.Length)
|
||||||
|
{
|
||||||
|
// 先释放旧的内存流,防止内存泄漏
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_memoryStreams[slideIndex]?.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"释放旧内存流失败: {ex}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新的内存流
|
||||||
|
var ms = new MemoryStream();
|
||||||
|
strokes.Save(ms);
|
||||||
|
ms.Position = 0;
|
||||||
|
_memoryStreams[slideIndex] = ms;
|
||||||
|
|
||||||
|
if (ms.Length > 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查内存使用情况
|
||||||
|
CheckAndPerformMemoryCleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存第{slideIndex}页墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 强制保存指定页面的墨迹
|
||||||
|
/// </summary>
|
||||||
|
public void ForceSaveSlideStrokes(int slideIndex, StrokeCollection strokes)
|
||||||
|
{
|
||||||
|
if (slideIndex <= 0 || strokes == null) return;
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (slideIndex < _memoryStreams.Length)
|
||||||
|
{
|
||||||
|
// 先释放旧的内存流,防止内存泄漏
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_memoryStreams[slideIndex]?.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"释放旧内存流失败: {ex}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新的内存流
|
||||||
|
var ms = new MemoryStream();
|
||||||
|
strokes.Save(ms);
|
||||||
|
ms.Position = 0;
|
||||||
|
_memoryStreams[slideIndex] = ms;
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile($"已强制保存第{slideIndex}页墨迹,大小: {ms.Length} bytes", LogHelper.LogType.Trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"强制保存第{slideIndex}页墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载指定页面的墨迹
|
||||||
|
/// </summary>
|
||||||
|
public StrokeCollection LoadSlideStrokes(int slideIndex)
|
||||||
|
{
|
||||||
|
if (slideIndex <= 0) return new StrokeCollection();
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (slideIndex < _memoryStreams.Length && _memoryStreams[slideIndex] != null && _memoryStreams[slideIndex].Length > 0)
|
||||||
|
{
|
||||||
|
_memoryStreams[slideIndex].Position = 0;
|
||||||
|
var strokes = new StrokeCollection(_memoryStreams[slideIndex]);
|
||||||
|
return strokes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"加载第{slideIndex}页墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new StrokeCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 切换到指定页面并加载墨迹
|
||||||
|
/// </summary>
|
||||||
|
public StrokeCollection SwitchToSlide(int slideIndex, StrokeCollection currentStrokes = null)
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查快速切换保护
|
||||||
|
var now = DateTime.Now;
|
||||||
|
if (now - _lastSwitchTime < TimeSpan.FromMilliseconds(MinSwitchIntervalMs) &&
|
||||||
|
_lastSwitchSlideIndex == slideIndex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"快速切换保护:忽略重复的页面切换请求 {slideIndex}", LogHelper.LogType.Warning);
|
||||||
|
return LoadSlideStrokes(slideIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 设置墨迹锁定
|
||||||
|
LockInkForSlide(slideIndex);
|
||||||
|
|
||||||
|
// 加载新页面的墨迹
|
||||||
|
var newStrokes = LoadSlideStrokes(slideIndex);
|
||||||
|
|
||||||
|
// 更新切换记录
|
||||||
|
_lastSwitchTime = now;
|
||||||
|
_lastSwitchSlideIndex = slideIndex;
|
||||||
|
|
||||||
|
if (newStrokes.Count > 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return newStrokes;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"切换到第{slideIndex}页失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
return new StrokeCollection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存所有墨迹到文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="presentation">演示文稿对象</param>
|
||||||
|
/// <param name="currentSlideIndex">当前播放的页码,如果提供则使用此值保存位置,否则使用_lockedSlideIndex</param>
|
||||||
|
public void SaveAllStrokesToFile(Presentation presentation, int currentSlideIndex = -1)
|
||||||
|
{
|
||||||
|
if (!IsAutoSaveEnabled || string.IsNullOrEmpty(AutoSaveLocation) || presentation == null) return;
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var folderPath = GetPresentationFolderPath();
|
||||||
|
if (!Directory.Exists(folderPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(folderPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存位置信息
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 优先使用传入的当前页码,否则使用锁定的页码
|
||||||
|
int positionToSave = currentSlideIndex > 0 ? currentSlideIndex : _lockedSlideIndex;
|
||||||
|
// 如果都没有有效值,尝试使用最后切换的页码
|
||||||
|
if (positionToSave <= 0 && _lastSwitchSlideIndex > 0)
|
||||||
|
{
|
||||||
|
positionToSave = _lastSwitchSlideIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (positionToSave > 0)
|
||||||
|
{
|
||||||
|
File.WriteAllText(Path.Combine(folderPath, "Position"), positionToSave.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存位置信息失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存所有页面的墨迹
|
||||||
|
int savedCount = 0;
|
||||||
|
int slideCount = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
slideCount = presentation.Slides.Count;
|
||||||
|
}
|
||||||
|
catch (COMException comEx)
|
||||||
|
{
|
||||||
|
var hr = (uint)comEx.HResult;
|
||||||
|
if (hr == 0x80048010)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= slideCount && i < _memoryStreams.Length; i++)
|
||||||
|
{
|
||||||
|
if (_memoryStreams[i] != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_memoryStreams[i].Length > 8)
|
||||||
|
{
|
||||||
|
var srcBuf = new byte[_memoryStreams[i].Length];
|
||||||
|
_memoryStreams[i].Position = 0;
|
||||||
|
var byteLength = _memoryStreams[i].Read(srcBuf, 0, srcBuf.Length);
|
||||||
|
|
||||||
|
var filePath = Path.Combine(folderPath, i.ToString("0000") + ".icstk");
|
||||||
|
File.WriteAllBytes(filePath, srcBuf);
|
||||||
|
savedCount++;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 删除空的墨迹文件
|
||||||
|
var filePath = Path.Combine(folderPath, i.ToString("0000") + ".icstk");
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
File.Delete(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存第{i}页墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存墨迹到文件失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从文件加载已保存的墨迹
|
||||||
|
/// </summary>
|
||||||
|
public void LoadSavedStrokes()
|
||||||
|
{
|
||||||
|
if (!IsAutoSaveEnabled || string.IsNullOrEmpty(AutoSaveLocation)) return;
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var folderPath = GetPresentationFolderPath();
|
||||||
|
if (!Directory.Exists(folderPath)) return;
|
||||||
|
|
||||||
|
var files = new DirectoryInfo(folderPath).GetFiles("*.icstk");
|
||||||
|
int loadedCount = 0;
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (int.TryParse(Path.GetFileNameWithoutExtension(file.Name), out int slideIndex))
|
||||||
|
{
|
||||||
|
if (slideIndex > 0 && slideIndex < _memoryStreams.Length)
|
||||||
|
{
|
||||||
|
var fileBytes = File.ReadAllBytes(file.FullName);
|
||||||
|
_memoryStreams[slideIndex] = new MemoryStream(fileBytes);
|
||||||
|
_memoryStreams[slideIndex].Position = 0;
|
||||||
|
loadedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"加载墨迹文件{file.Name}失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"从文件加载墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除所有墨迹
|
||||||
|
/// </summary>
|
||||||
|
public void ClearAllStrokes()
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 安全释放所有内存流
|
||||||
|
if (_memoryStreams != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _memoryStreams.Length; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_memoryStreams[i]?.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"释放内存流{i}失败: {ex}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_memoryStreams[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新初始化数组
|
||||||
|
_memoryStreams = new MemoryStream[_maxSlides + 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentStrokes?.Clear();
|
||||||
|
LogHelper.WriteLogToFile("已清除所有墨迹", LogHelper.LogType.Trace);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清除墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 翻页后锁定墨迹写入
|
||||||
|
/// </summary>
|
||||||
|
public void LockInkForSlide(int slideIndex)
|
||||||
|
{
|
||||||
|
_inkLockUntil = DateTime.Now.AddMilliseconds(InkLockMilliseconds);
|
||||||
|
_lockedSlideIndex = slideIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否可以写入墨迹
|
||||||
|
/// </summary>
|
||||||
|
public bool CanWriteInk(int currentSlideIndex)
|
||||||
|
{
|
||||||
|
// 如果锁定时间已过,允许写入
|
||||||
|
if (DateTime.Now >= _inkLockUntil)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果当前页面与锁定页面相同,允许写入(用户在当前页面绘制)
|
||||||
|
if (currentSlideIndex == _lockedSlideIndex)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果当前页面不是锁定页面,但锁定时间很短(小于50ms),允许写入
|
||||||
|
// 这样可以确保旧页面的墨迹能够及时保存
|
||||||
|
if (DateTime.Now - (_inkLockUntil.AddMilliseconds(-InkLockMilliseconds)) < TimeSpan.FromMilliseconds(50))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有在快速切换且页面不同时才锁定
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重置墨迹锁定状态
|
||||||
|
/// </summary>
|
||||||
|
public void ResetLockState()
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
_inkLockUntil = DateTime.MinValue;
|
||||||
|
_lockedSlideIndex = -1;
|
||||||
|
_lastSwitchTime = DateTime.MinValue;
|
||||||
|
_lastSwitchSlideIndex = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查并执行内存清理
|
||||||
|
/// </summary>
|
||||||
|
private void CheckAndPerformMemoryCleanup()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var now = DateTime.Now;
|
||||||
|
|
||||||
|
// 检查是否需要执行内存清理
|
||||||
|
if (now - _lastMemoryCleanup < TimeSpan.FromMinutes(MemoryCleanupIntervalMinutes))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算当前内存使用量
|
||||||
|
long currentMemoryUsage = 0;
|
||||||
|
if (_memoryStreams != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _memoryStreams.Length; i++)
|
||||||
|
{
|
||||||
|
if (_memoryStreams[i] != null)
|
||||||
|
{
|
||||||
|
currentMemoryUsage += _memoryStreams[i].Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_totalMemoryUsage = currentMemoryUsage;
|
||||||
|
|
||||||
|
// 如果内存使用量超过限制,执行清理
|
||||||
|
if (currentMemoryUsage > MaxMemoryUsageBytes)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"内存使用量超限 ({currentMemoryUsage / 1024 / 1024}MB),开始清理", LogHelper.LogType.Warning);
|
||||||
|
|
||||||
|
// 清理非当前页面的墨迹
|
||||||
|
CleanupInactiveSlideStrokes();
|
||||||
|
|
||||||
|
_lastMemoryCleanup = now;
|
||||||
|
LogHelper.WriteLogToFile($"内存清理完成,当前使用量: {_totalMemoryUsage / 1024 / 1024}MB", LogHelper.LogType.Trace);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_lastMemoryCleanup = now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"内存清理检查失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理非活跃页面的墨迹
|
||||||
|
/// </summary>
|
||||||
|
private void CleanupInactiveSlideStrokes()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_memoryStreams == null) return;
|
||||||
|
|
||||||
|
int cleanedCount = 0;
|
||||||
|
long freedMemory = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < _memoryStreams.Length; i++)
|
||||||
|
{
|
||||||
|
// 保留当前锁定页面和最近访问的页面
|
||||||
|
if (i == _lockedSlideIndex || i == _lastSwitchSlideIndex)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_memoryStreams[i] != null)
|
||||||
|
{
|
||||||
|
long memorySize = _memoryStreams[i].Length;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_memoryStreams[i].Dispose();
|
||||||
|
freedMemory += memorySize;
|
||||||
|
cleanedCount++;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理页面{i}墨迹失败: {ex}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_memoryStreams[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cleanedCount > 0)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"已清理{cleanedCount}个页面的墨迹,释放内存: {freedMemory / 1024}KB", LogHelper.LogType.Trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理非活跃页面墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
private string GeneratePresentationId(Presentation presentation)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var presentationPath = presentation.FullName;
|
||||||
|
var fileHash = GetFileHash(presentationPath);
|
||||||
|
return $"{presentation.Name}_{presentation.Slides.Count}_{fileHash}";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"生成演示文稿ID失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
return $"unknown_{DateTime.Now.Ticks}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetFileHash(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(filePath)) return "unknown";
|
||||||
|
|
||||||
|
using (var md5 = MD5.Create())
|
||||||
|
{
|
||||||
|
byte[] hashBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(filePath));
|
||||||
|
return BitConverter.ToString(hashBytes).Replace("-", "").Substring(0, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"计算文件哈希值失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetPresentationFolderPath()
|
||||||
|
{
|
||||||
|
return Path.Combine(AutoSaveLocation, "Auto Saved - Presentations", _currentPresentationId);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Dispose
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (!_disposed)
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
ClearAllStrokes();
|
||||||
|
}
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,460 @@
|
|||||||
|
using Microsoft.Office.Interop.PowerPoint;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.InteropServices.ComTypes;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
public static class PPTROTConnectionHelper
|
||||||
|
{
|
||||||
|
#region Win32 API Declarations
|
||||||
|
[DllImport("ole32.dll")]
|
||||||
|
private static extern int GetRunningObjectTable(int reserved, out IRunningObjectTable prot);
|
||||||
|
|
||||||
|
[DllImport("ole32.dll")]
|
||||||
|
private static extern int CreateBindCtx(int reserved, out IBindCtx ppbc);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern IntPtr GetForegroundWindow();
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
private static extern bool IsWindowVisible(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct RECT
|
||||||
|
{
|
||||||
|
public int Left;
|
||||||
|
public int Top;
|
||||||
|
public int Right;
|
||||||
|
public int Bottom;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constants
|
||||||
|
private static readonly Guid PowerPointApplicationGuid = new Guid("91493441-5A91-11CF-8700-00AA0060263B");
|
||||||
|
|
||||||
|
private static readonly string[] PptLikeExtensions = new[]
|
||||||
|
{
|
||||||
|
".pptx", ".pptm", ".ppt",
|
||||||
|
".ppsx", ".ppsm", ".pps",
|
||||||
|
".potx", ".potm", ".pot",
|
||||||
|
".dps", ".dpt"
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
public static Microsoft.Office.Interop.PowerPoint.Application TryConnectViaROT(bool isSupportWPS = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object bestApp = GetAnyActivePowerPoint(null, out int bestPriority, out _, isSupportWPS);
|
||||||
|
|
||||||
|
if (bestApp != null && bestPriority > 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Microsoft.Office.Interop.PowerPoint.Application pptApp = bestApp as Microsoft.Office.Interop.PowerPoint.Application;
|
||||||
|
|
||||||
|
if (pptApp != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var nameObj = pptApp.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, pptApp, null);
|
||||||
|
SafeReleaseComObject(nameObj);
|
||||||
|
return pptApp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"ROT 连接验证失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
SafeReleaseComObject(bestApp);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SafeReleaseComObject(bestApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"ROT 连接验证失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
SafeReleaseComObject(bestApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bestApp != null)
|
||||||
|
{
|
||||||
|
SafeReleaseComObject(bestApp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"ROT 连接过程发生异常: {ex}", LogHelper.LogType.Error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
private static object GetAnyActivePowerPoint(object targetApp, out int bestPriority, out int targetPriority, bool isSupportWPS)
|
||||||
|
{
|
||||||
|
IRunningObjectTable rot = null;
|
||||||
|
IEnumMoniker enumMoniker = null;
|
||||||
|
|
||||||
|
object bestApp = null;
|
||||||
|
bestPriority = 0;
|
||||||
|
targetPriority = 0;
|
||||||
|
int highestPriority = 0;
|
||||||
|
|
||||||
|
List<object> foundAppObjects = new List<object>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int hr = GetRunningObjectTable(0, out rot);
|
||||||
|
if (hr != 0 || rot == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("无法获取 Running Object Table", LogHelper.LogType.Warning);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
rot.EnumRunning(out enumMoniker);
|
||||||
|
if (enumMoniker == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("无法枚举 ROT 中的对象", LogHelper.LogType.Warning);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMoniker[] moniker = new IMoniker[1];
|
||||||
|
IntPtr fetched = IntPtr.Zero;
|
||||||
|
|
||||||
|
while (enumMoniker.Next(1, moniker, fetched) == 0)
|
||||||
|
{
|
||||||
|
IBindCtx bindCtx = null;
|
||||||
|
object comObject = null;
|
||||||
|
dynamic candidateApp = null;
|
||||||
|
string displayName = "Unknown";
|
||||||
|
dynamic activePres = null;
|
||||||
|
dynamic ssWindow = null;
|
||||||
|
bool keepAlive = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CreateBindCtx(0, out bindCtx);
|
||||||
|
moniker[0].GetDisplayName(bindCtx, null, out displayName);
|
||||||
|
|
||||||
|
if (LooksLikePresentationFile(displayName) || displayName == "!{91493441-5A91-11CF-8700-00AA0060263B}")
|
||||||
|
{
|
||||||
|
rot.GetObject(moniker[0], out comObject);
|
||||||
|
if (comObject != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object appObj = comObject.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, comObject, null);
|
||||||
|
candidateApp = appObj;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
candidateApp = comObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool isDuplicate = false;
|
||||||
|
if (candidateApp != null)
|
||||||
|
{
|
||||||
|
foreach (var processedApp in foundAppObjects)
|
||||||
|
{
|
||||||
|
if (AreComObjectsEqual((object)candidateApp, processedApp))
|
||||||
|
{
|
||||||
|
isDuplicate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isDuplicate)
|
||||||
|
{
|
||||||
|
foundAppObjects.Add(candidateApp);
|
||||||
|
keepAlive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (candidateApp != null && !isDuplicate)
|
||||||
|
{
|
||||||
|
int currentPriority = 0;
|
||||||
|
bool isTarget = false;
|
||||||
|
|
||||||
|
if (targetApp != null && AreComObjectsEqual((object)candidateApp, targetApp))
|
||||||
|
{
|
||||||
|
isTarget = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
activePres = candidateApp.ActivePresentation;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
if (activePres != null)
|
||||||
|
{
|
||||||
|
currentPriority = 1;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ssWindow = activePres.SlideShowWindow;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
if (ssWindow != null)
|
||||||
|
{
|
||||||
|
currentPriority = 2;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool isActive = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object val = ssWindow.Active;
|
||||||
|
if (val is int && (int)val == -1) isActive = true;
|
||||||
|
else if (val is bool && (bool)val == true) isActive = true;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
if (isActive)
|
||||||
|
{
|
||||||
|
currentPriority = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsSlideShowWindowActive(ssWindow, isSupportWPS))
|
||||||
|
{
|
||||||
|
currentPriority = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"计算优先级时出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTarget)
|
||||||
|
{
|
||||||
|
targetPriority = currentPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPriority > 0)
|
||||||
|
{
|
||||||
|
if (currentPriority > highestPriority)
|
||||||
|
{
|
||||||
|
highestPriority = currentPriority;
|
||||||
|
SafeReleaseComObject(bestApp);
|
||||||
|
bestApp = candidateApp;
|
||||||
|
candidateApp = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"ROT 枚举循环中出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
SafeReleaseComObject(ssWindow);
|
||||||
|
SafeReleaseComObject(activePres);
|
||||||
|
|
||||||
|
if (!keepAlive)
|
||||||
|
{
|
||||||
|
SafeReleaseComObject(candidateApp);
|
||||||
|
}
|
||||||
|
|
||||||
|
CleanUpLoopObjects(bindCtx, moniker[0], comObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bestPriority = highestPriority;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"ROT 扫描关键错误: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (foundAppObjects != null)
|
||||||
|
{
|
||||||
|
foreach (var cachedApp in foundAppObjects)
|
||||||
|
{
|
||||||
|
if (bestApp != null && ReferenceEquals(cachedApp, bestApp))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SafeReleaseComObject(cachedApp);
|
||||||
|
}
|
||||||
|
foundAppObjects.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enumMoniker != null) Marshal.ReleaseComObject(enumMoniker);
|
||||||
|
if (rot != null) Marshal.ReleaseComObject(rot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bestApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool AreComObjectsEqual(object o1, object o2)
|
||||||
|
{
|
||||||
|
if (o1 == null || o2 == null) return false;
|
||||||
|
if (ReferenceEquals(o1, o2)) return true;
|
||||||
|
|
||||||
|
IntPtr pUnk1 = IntPtr.Zero;
|
||||||
|
IntPtr pUnk2 = IntPtr.Zero;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pUnk1 = Marshal.GetIUnknownForObject(o1);
|
||||||
|
pUnk2 = Marshal.GetIUnknownForObject(o2);
|
||||||
|
return pUnk1 == pUnk2;
|
||||||
|
}
|
||||||
|
catch { return false; }
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (pUnk1 != IntPtr.Zero) Marshal.Release(pUnk1);
|
||||||
|
if (pUnk2 != IntPtr.Zero) Marshal.Release(pUnk2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool LooksLikePresentationFile(string displayName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(displayName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string lower = displayName.ToLowerInvariant();
|
||||||
|
foreach (var ext in PptLikeExtensions)
|
||||||
|
{
|
||||||
|
if (lower.Contains(ext))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsSlideShowWindowActive(object sswObj, bool isSupportWPS)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IntPtr foregroundHwnd = GetForegroundWindow();
|
||||||
|
if (foregroundHwnd == IntPtr.Zero) return false;
|
||||||
|
|
||||||
|
uint fgPid;
|
||||||
|
GetWindowThreadProcessId(foregroundHwnd, out fgPid);
|
||||||
|
|
||||||
|
IntPtr sswHwnd = IntPtr.Zero;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sswHwnd = GetPptHwndFromSlideShowWindow(sswObj);
|
||||||
|
}
|
||||||
|
catch { return false; }
|
||||||
|
|
||||||
|
if (sswHwnd == IntPtr.Zero) return false;
|
||||||
|
|
||||||
|
uint sswPid;
|
||||||
|
GetWindowThreadProcessId(sswHwnd, out sswPid);
|
||||||
|
|
||||||
|
if (fgPid == sswPid) return true;
|
||||||
|
if (isSupportWPS)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (Process fgProc = Process.GetProcessById((int)fgPid))
|
||||||
|
using (Process appProc = Process.GetProcessById((int)sswPid))
|
||||||
|
{
|
||||||
|
string fgName = fgProc.ProcessName.ToLower();
|
||||||
|
string appName = appProc.ProcessName.ToLower();
|
||||||
|
|
||||||
|
if (fgName.StartsWith("wps") && appName.StartsWith("wpp"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IntPtr GetPptHwndFromSlideShowWindow(object pptSlideShowWindowObj)
|
||||||
|
{
|
||||||
|
if (pptSlideShowWindowObj == null) return IntPtr.Zero;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dynamic ssw = pptSlideShowWindowObj;
|
||||||
|
object hwndObj = ssw.HWND;
|
||||||
|
|
||||||
|
if (hwndObj is int)
|
||||||
|
{
|
||||||
|
return new IntPtr((int)hwndObj);
|
||||||
|
}
|
||||||
|
else if (hwndObj is IntPtr)
|
||||||
|
{
|
||||||
|
return (IntPtr)hwndObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IntPtr.Zero;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SafeReleaseComObject(object comObj)
|
||||||
|
{
|
||||||
|
if (comObj == null) return;
|
||||||
|
|
||||||
|
if (Marshal.IsComObject(comObj))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Marshal.ReleaseComObject(comObj);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CleanUpLoopObjects(IBindCtx bindCtx, IMoniker moniker, object comObject)
|
||||||
|
{
|
||||||
|
if (comObject != null && Marshal.IsComObject(comObject))
|
||||||
|
Marshal.ReleaseComObject(comObject);
|
||||||
|
if (moniker != null)
|
||||||
|
Marshal.ReleaseComObject(moniker);
|
||||||
|
if (bindCtx != null)
|
||||||
|
Marshal.ReleaseComObject(bindCtx);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,526 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PPT UI管理器 - 统一管理PPT相关的UI更新和样式设置
|
||||||
|
/// </summary>
|
||||||
|
public class PPTUIManager
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
public bool ShowPPTButton { get; set; } = true;
|
||||||
|
public int PPTButtonsDisplayOption { get; set; } = 2222;
|
||||||
|
public int PPTSButtonsOption { get; set; } = 221;
|
||||||
|
public int PPTBButtonsOption { get; set; } = 121;
|
||||||
|
public int PPTLSButtonPosition { get; set; } = 0;
|
||||||
|
public int PPTRSButtonPosition { get; set; } = 0;
|
||||||
|
public int PPTLBButtonPosition { get; set; } = 0;
|
||||||
|
public int PPTRBButtonPosition { get; set; } = 0;
|
||||||
|
public bool EnablePPTButtonPageClickable { get; set; } = true;
|
||||||
|
public bool EnablePPTButtonLongPressPageTurn { get; set; } = true;
|
||||||
|
public double PPTLSButtonOpacity { get; set; } = 0.5;
|
||||||
|
public double PPTRSButtonOpacity { get; set; } = 0.5;
|
||||||
|
public double PPTLBButtonOpacity { get; set; } = 0.5;
|
||||||
|
public double PPTRBButtonOpacity { get; set; } = 0.5;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Fields
|
||||||
|
private readonly MainWindow _mainWindow;
|
||||||
|
private readonly Dispatcher _dispatcher;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public PPTUIManager(MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
_mainWindow = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow));
|
||||||
|
_dispatcher = _mainWindow.Dispatcher;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
/// <summary>
|
||||||
|
/// 更新PPT连接状态UI
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateConnectionStatus(bool isConnected)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (isConnected)
|
||||||
|
{
|
||||||
|
_mainWindow.StackPanelPPTControls.Visibility = Visibility.Visible;
|
||||||
|
_mainWindow.BtnPPTSlideShow.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_mainWindow.StackPanelPPTControls.Visibility = Visibility.Collapsed;
|
||||||
|
_mainWindow.BtnPPTSlideShow.Visibility = Visibility.Collapsed;
|
||||||
|
_mainWindow.BtnPPTSlideShowEnd.Visibility = Visibility.Collapsed;
|
||||||
|
HideAllNavigationPanels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新PPT连接状态UI失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新幻灯片放映状态UI
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateSlideShowStatus(bool isInSlideShow, int currentSlide = 0, int totalSlides = 0)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (isInSlideShow)
|
||||||
|
{
|
||||||
|
_mainWindow.BtnPPTSlideShow.Visibility = Visibility.Collapsed;
|
||||||
|
_mainWindow.BtnPPTSlideShowEnd.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
|
// 只有在页数有效时才更新页码显示
|
||||||
|
if (currentSlide > 0 && totalSlides > 0)
|
||||||
|
{
|
||||||
|
_mainWindow.PPTBtnPageNow.Text = currentSlide.ToString();
|
||||||
|
_mainWindow.PPTBtnPageTotal.Text = $"/ {totalSlides}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 页数无效时清空页码显示
|
||||||
|
_mainWindow.PPTBtnPageNow.Text = "?";
|
||||||
|
_mainWindow.PPTBtnPageTotal.Text = "/ ?";
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateNavigationPanelsVisibility();
|
||||||
|
UpdateNavigationButtonStyles();
|
||||||
|
_mainWindow.UpdatePPTTimeCapsuleVisibility();
|
||||||
|
_mainWindow.UpdatePPTQuickPanelVisibility();
|
||||||
|
if (MainWindow.Settings.Advanced.IsEnableAvoidFullScreenHelper)
|
||||||
|
{
|
||||||
|
// 设置为画板模式,允许全屏操作
|
||||||
|
AvoidFullScreenHelper.SetBoardMode(true);
|
||||||
|
_dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle, 0, 0,
|
||||||
|
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
|
||||||
|
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
|
||||||
|
}), DispatcherPriority.ApplicationIdle);
|
||||||
|
|
||||||
|
_mainWindow.isFullScreenApplied = true; // 标记已应用全屏处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_mainWindow.BtnPPTSlideShow.Visibility = Visibility.Visible;
|
||||||
|
_mainWindow.BtnPPTSlideShowEnd.Visibility = Visibility.Collapsed;
|
||||||
|
HideAllNavigationPanels();
|
||||||
|
_mainWindow.UpdatePPTTimeCapsuleVisibility();
|
||||||
|
_mainWindow.UpdatePPTQuickPanelVisibility();
|
||||||
|
if (MainWindow.Settings.Advanced.IsEnableAvoidFullScreenHelper)
|
||||||
|
{
|
||||||
|
// 恢复为非画板模式,重新启用全屏限制
|
||||||
|
AvoidFullScreenHelper.SetBoardMode(false);
|
||||||
|
|
||||||
|
_dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
// 退出PPT放映模式,恢复到工作区域大小
|
||||||
|
var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
|
||||||
|
MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle,
|
||||||
|
workingArea.X, workingArea.Y,
|
||||||
|
workingArea.Width, workingArea.Height, true);
|
||||||
|
}), DispatcherPriority.ApplicationIdle);
|
||||||
|
|
||||||
|
_mainWindow.isFullScreenApplied = false; // 标记全屏处理已还原
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新幻灯片放映状态UI失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新当前页码显示
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateCurrentSlideNumber(int currentSlide, int totalSlides)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 只有在页数有效时才更新页码显示
|
||||||
|
if (currentSlide > 0 && totalSlides > 0)
|
||||||
|
{
|
||||||
|
_mainWindow.PPTBtnPageNow.Text = currentSlide.ToString();
|
||||||
|
_mainWindow.PPTBtnPageTotal.Text = $"/ {totalSlides}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 页数无效时清空页码显示
|
||||||
|
_mainWindow.PPTBtnPageNow.Text = "?";
|
||||||
|
_mainWindow.PPTBtnPageTotal.Text = "/ ?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新页码显示失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理PPT放映状态变化
|
||||||
|
/// </summary>
|
||||||
|
public void OnSlideShowStateChanged(bool isInSlideShow)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!isInSlideShow)
|
||||||
|
{
|
||||||
|
// 如果不在放映模式,隐藏所有导航面板
|
||||||
|
HideAllNavigationPanels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"处理PPT放映状态变化失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新导航面板显示状态
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateNavigationPanelsVisibility()
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查是否应该显示PPT按钮
|
||||||
|
// 不仅要检查按钮设置,还要确保确实在PPT放映模式下且页数有效
|
||||||
|
bool isInSlideShow = _mainWindow.PPTManager?.IsInSlideShow == true;
|
||||||
|
int slidesCount = _mainWindow.PPTManager?.SlidesCount ?? 0;
|
||||||
|
bool hasValidPageCount = slidesCount > 0;
|
||||||
|
|
||||||
|
bool shouldShowButtons = ShowPPTButton &&
|
||||||
|
_mainWindow.BtnPPTSlideShowEnd.Visibility == Visibility.Visible &&
|
||||||
|
isInSlideShow &&
|
||||||
|
hasValidPageCount &&
|
||||||
|
!MainWindow.Settings.Automation.IsAutoFoldInPPTSlideShow;
|
||||||
|
|
||||||
|
if (!shouldShowButtons)
|
||||||
|
{
|
||||||
|
HideAllNavigationPanels();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置侧边按钮位置
|
||||||
|
_mainWindow.LeftSidePanelForPPTNavigation.Margin = new Thickness(0, 0, 0, PPTLSButtonPosition * 2);
|
||||||
|
_mainWindow.RightSidePanelForPPTNavigation.Margin = new Thickness(0, 0, 0, PPTRSButtonPosition * 2);
|
||||||
|
|
||||||
|
// 设置底部按钮水平位置
|
||||||
|
_mainWindow.LeftBottomPanelForPPTNavigation.Margin = new Thickness(6 + PPTLBButtonPosition, 0, 0, 6);
|
||||||
|
_mainWindow.RightBottomPanelForPPTNavigation.Margin = new Thickness(0, 0, 6 + PPTRBButtonPosition, 6);
|
||||||
|
|
||||||
|
// 根据显示选项设置面板可见性
|
||||||
|
var displayOption = PPTButtonsDisplayOption.ToString();
|
||||||
|
if (displayOption.Length >= 4)
|
||||||
|
{
|
||||||
|
var options = displayOption.ToCharArray();
|
||||||
|
|
||||||
|
// 左下角面板
|
||||||
|
if (options[0] == '2')
|
||||||
|
AnimationsHelper.ShowWithFadeIn(_mainWindow.LeftBottomPanelForPPTNavigation);
|
||||||
|
else
|
||||||
|
_mainWindow.LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
// 右下角面板
|
||||||
|
if (options[1] == '2')
|
||||||
|
AnimationsHelper.ShowWithFadeIn(_mainWindow.RightBottomPanelForPPTNavigation);
|
||||||
|
else
|
||||||
|
_mainWindow.RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
// 左侧面板
|
||||||
|
if (options[2] == '2')
|
||||||
|
AnimationsHelper.ShowWithFadeIn(_mainWindow.LeftSidePanelForPPTNavigation);
|
||||||
|
else
|
||||||
|
_mainWindow.LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
// 右侧面板
|
||||||
|
if (options[3] == '2')
|
||||||
|
AnimationsHelper.ShowWithFadeIn(_mainWindow.RightSidePanelForPPTNavigation);
|
||||||
|
else
|
||||||
|
_mainWindow.RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新导航面板显示状态失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新导航按钮样式
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateNavigationButtonStyles()
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UpdateSideButtonStyles();
|
||||||
|
UpdateBottomButtonStyles();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新导航按钮样式失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏所有导航面板
|
||||||
|
/// </summary>
|
||||||
|
public void HideAllNavigationPanels()
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mainWindow.LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
_mainWindow.RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
_mainWindow.LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
_mainWindow.RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"隐藏导航面板失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示/隐藏侧边栏退出按钮
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateSidebarExitButtons(bool show)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var visibility = show ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
|
if (_mainWindow.BtnExitPptFromSidebarLeft != null)
|
||||||
|
_mainWindow.BtnExitPptFromSidebarLeft.Visibility = visibility;
|
||||||
|
|
||||||
|
if (_mainWindow.BtnExitPptFromSidebarRight != null)
|
||||||
|
_mainWindow.BtnExitPptFromSidebarRight.Visibility = visibility;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新侧边栏退出按钮失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置浮动栏透明度
|
||||||
|
/// </summary>
|
||||||
|
public void SetFloatingBarOpacity(double opacity)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mainWindow.ViewboxFloatingBar.Opacity = opacity;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"设置浮动栏透明度失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置主面板边距
|
||||||
|
/// </summary>
|
||||||
|
public void SetMainPanelMargin(Thickness margin)
|
||||||
|
{
|
||||||
|
_dispatcher.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mainWindow.ViewBoxStackPanelMain.Margin = margin;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"设置主面板边距失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
private void UpdateSideButtonStyles()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sideOption = PPTSButtonsOption.ToString();
|
||||||
|
if (sideOption.Length < 3) return;
|
||||||
|
|
||||||
|
var options = sideOption.ToCharArray();
|
||||||
|
|
||||||
|
// 页码按钮显示
|
||||||
|
var pageButtonVisibility = options[0] == '2' ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
_mainWindow.PPTLSPageButton.Visibility = pageButtonVisibility;
|
||||||
|
_mainWindow.PPTRSPageButton.Visibility = pageButtonVisibility;
|
||||||
|
|
||||||
|
// 透明度设置 - 直接使用用户设置的透明度值
|
||||||
|
_mainWindow.PPTBtnLSBorder.Opacity = PPTLSButtonOpacity;
|
||||||
|
_mainWindow.PPTBtnRSBorder.Opacity = PPTRSButtonOpacity;
|
||||||
|
|
||||||
|
// 颜色主题
|
||||||
|
bool isDarkTheme = options[2] == '2';
|
||||||
|
ApplyButtonTheme(_mainWindow.PPTBtnLSBorder, _mainWindow.PPTBtnRSBorder, isDarkTheme, true);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新侧边按钮样式失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateBottomButtonStyles()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var bottomOption = PPTBButtonsOption.ToString();
|
||||||
|
if (bottomOption.Length < 3) return;
|
||||||
|
|
||||||
|
var options = bottomOption.ToCharArray();
|
||||||
|
|
||||||
|
// 页码按钮显示
|
||||||
|
var pageButtonVisibility = options[0] == '2' ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
_mainWindow.PPTLBPageButton.Visibility = pageButtonVisibility;
|
||||||
|
_mainWindow.PPTRBPageButton.Visibility = pageButtonVisibility;
|
||||||
|
|
||||||
|
// 透明度设置 - 直接使用用户设置的透明度值
|
||||||
|
_mainWindow.PPTBtnLBBorder.Opacity = PPTLBButtonOpacity;
|
||||||
|
_mainWindow.PPTBtnRBBorder.Opacity = PPTRBButtonOpacity;
|
||||||
|
|
||||||
|
// 颜色主题
|
||||||
|
bool isDarkTheme = options[2] == '2';
|
||||||
|
ApplyButtonTheme(_mainWindow.PPTBtnLBBorder, _mainWindow.PPTBtnRBBorder, isDarkTheme, false);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"更新底部按钮样式失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyButtonTheme(Border leftBorder, Border rightBorder, bool isDarkTheme, bool isSideButton)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Color backgroundColor, borderColor, foregroundColor, feedbackColor;
|
||||||
|
|
||||||
|
if (isDarkTheme)
|
||||||
|
{
|
||||||
|
backgroundColor = Color.FromRgb(39, 39, 42);
|
||||||
|
borderColor = Color.FromRgb(82, 82, 91);
|
||||||
|
foregroundColor = Colors.White;
|
||||||
|
feedbackColor = Colors.White;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
backgroundColor = Color.FromRgb(244, 244, 245);
|
||||||
|
borderColor = Color.FromRgb(161, 161, 170);
|
||||||
|
foregroundColor = Color.FromRgb(39, 39, 42);
|
||||||
|
feedbackColor = Color.FromRgb(24, 24, 27);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 应用背景和边框颜色
|
||||||
|
var backgroundBrush = new SolidColorBrush(backgroundColor);
|
||||||
|
var borderBrush = new SolidColorBrush(borderColor);
|
||||||
|
|
||||||
|
leftBorder.Background = backgroundBrush;
|
||||||
|
leftBorder.BorderBrush = borderBrush;
|
||||||
|
rightBorder.Background = backgroundBrush;
|
||||||
|
rightBorder.BorderBrush = borderBrush;
|
||||||
|
|
||||||
|
// 应用图标和文字颜色
|
||||||
|
var foregroundBrush = new SolidColorBrush(foregroundColor);
|
||||||
|
var feedbackBrush = new SolidColorBrush(feedbackColor);
|
||||||
|
|
||||||
|
if (isSideButton)
|
||||||
|
{
|
||||||
|
ApplySideButtonColors(foregroundBrush, feedbackBrush);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyBottomButtonColors(foregroundBrush, feedbackBrush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"应用按钮主题失败: {ex}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplySideButtonColors(SolidColorBrush foregroundBrush, SolidColorBrush feedbackBrush)
|
||||||
|
{
|
||||||
|
// 图标颜色
|
||||||
|
_mainWindow.PPTLSPreviousButtonGeometry.Brush = foregroundBrush;
|
||||||
|
_mainWindow.PPTRSPreviousButtonGeometry.Brush = foregroundBrush;
|
||||||
|
_mainWindow.PPTLSNextButtonGeometry.Brush = foregroundBrush;
|
||||||
|
_mainWindow.PPTRSNextButtonGeometry.Brush = foregroundBrush;
|
||||||
|
|
||||||
|
// 反馈背景颜色
|
||||||
|
_mainWindow.PPTLSPreviousButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTRSPreviousButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTLSPageButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTRSPageButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTLSNextButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTRSNextButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
|
||||||
|
// 文字颜色
|
||||||
|
TextBlock.SetForeground(_mainWindow.PPTLSPageButton, foregroundBrush);
|
||||||
|
TextBlock.SetForeground(_mainWindow.PPTRSPageButton, foregroundBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyBottomButtonColors(SolidColorBrush foregroundBrush, SolidColorBrush feedbackBrush)
|
||||||
|
{
|
||||||
|
// 图标颜色
|
||||||
|
_mainWindow.PPTLBPreviousButtonGeometry.Brush = foregroundBrush;
|
||||||
|
_mainWindow.PPTRBPreviousButtonGeometry.Brush = foregroundBrush;
|
||||||
|
_mainWindow.PPTLBNextButtonGeometry.Brush = foregroundBrush;
|
||||||
|
_mainWindow.PPTRBNextButtonGeometry.Brush = foregroundBrush;
|
||||||
|
|
||||||
|
// 反馈背景颜色
|
||||||
|
_mainWindow.PPTLBPreviousButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTRBPreviousButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTLBPageButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTRBPageButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTLBNextButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
_mainWindow.PPTRBNextButtonFeedbackBorder.Background = feedbackBrush;
|
||||||
|
|
||||||
|
// 文字颜色
|
||||||
|
TextBlock.SetForeground(_mainWindow.PPTLBPageButton, foregroundBrush);
|
||||||
|
TextBlock.SetForeground(_mainWindow.PPTRBPageButton, foregroundBrush);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using iNKORE.UI.WPF.Modern.Controls;
|
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||||
{
|
{
|
||||||
@@ -16,17 +16,17 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
/// 父插件
|
/// 父插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly SuperLauncherPlugin _plugin;
|
private readonly SuperLauncherPlugin _plugin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实际按钮控件
|
/// 实际按钮控件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly SimpleStackPanel _panel;
|
private readonly SimpleStackPanel _panel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取按钮UI元素
|
/// 获取按钮UI元素
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UIElement Element => _panel;
|
public UIElement Element => _panel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -36,8 +36,8 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
LogHelper.WriteLogToFile("开始创建启动台按钮", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("开始创建启动台按钮");
|
||||||
|
|
||||||
// 创建SimpleStackPanel
|
// 创建SimpleStackPanel
|
||||||
_panel = new SimpleStackPanel
|
_panel = new SimpleStackPanel
|
||||||
{
|
{
|
||||||
@@ -48,13 +48,13 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
Margin = new Thickness(0, -2, 0, 0),
|
Margin = new Thickness(0, -2, 0, 0),
|
||||||
Background = Brushes.Transparent
|
Background = Brushes.Transparent
|
||||||
};
|
};
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("创建SimpleStackPanel完成", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("创建SimpleStackPanel完成");
|
||||||
|
|
||||||
// 添加图标
|
// 添加图标
|
||||||
var image = CreateIconImage();
|
var image = CreateIconImage();
|
||||||
_panel.Children.Add(image);
|
_panel.Children.Add(image);
|
||||||
|
|
||||||
// 添加文本
|
// 添加文本
|
||||||
TextBlock textBlock = new TextBlock
|
TextBlock textBlock = new TextBlock
|
||||||
{
|
{
|
||||||
@@ -65,19 +65,19 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
TextAlignment = TextAlignment.Center
|
TextAlignment = TextAlignment.Center
|
||||||
};
|
};
|
||||||
_panel.Children.Add(textBlock);
|
_panel.Children.Add(textBlock);
|
||||||
|
|
||||||
// 设置鼠标事件
|
// 设置鼠标事件
|
||||||
_panel.MouseDown += Panel_MouseDown;
|
_panel.MouseDown += Panel_MouseDown;
|
||||||
_panel.MouseUp += Panel_MouseUp;
|
_panel.MouseUp += Panel_MouseUp;
|
||||||
_panel.MouseLeave += Panel_MouseLeave;
|
_panel.MouseLeave += Panel_MouseLeave;
|
||||||
|
|
||||||
// 右键菜单支持
|
// 右键菜单支持
|
||||||
_panel.ContextMenu = CreateContextMenu();
|
_panel.ContextMenu = CreateContextMenu();
|
||||||
|
|
||||||
// 设置工具提示
|
// 设置工具提示
|
||||||
_panel.ToolTip = "启动台";
|
_panel.ToolTip = "启动台";
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("启动台按钮创建完成", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("启动台按钮创建完成");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建右键菜单
|
/// 创建右键菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -95,32 +95,31 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 创建菜单
|
// 创建菜单
|
||||||
ContextMenu menu = new ContextMenu();
|
ContextMenu menu = new ContextMenu();
|
||||||
|
|
||||||
// 创建位置切换菜单项
|
// 创建位置切换菜单项
|
||||||
MenuItem positionMenuItem = new MenuItem();
|
MenuItem positionMenuItem = new MenuItem();
|
||||||
positionMenuItem.Header = _plugin.Config.ButtonPosition == LauncherButtonPosition.Left ?
|
positionMenuItem.Header = _plugin.Config.ButtonPosition == LauncherButtonPosition.Left ?
|
||||||
"移至右侧" : "移至左侧";
|
"移至右侧" : "移至左侧";
|
||||||
positionMenuItem.Click += (s, e) =>
|
positionMenuItem.Click += (s, e) =>
|
||||||
{
|
{
|
||||||
// 切换位置
|
// 切换位置
|
||||||
_plugin.Config.ButtonPosition = _plugin.Config.ButtonPosition == LauncherButtonPosition.Left ?
|
_plugin.Config.ButtonPosition = _plugin.Config.ButtonPosition == LauncherButtonPosition.Left ?
|
||||||
LauncherButtonPosition.Right : LauncherButtonPosition.Left;
|
LauncherButtonPosition.Right : LauncherButtonPosition.Left;
|
||||||
|
|
||||||
// 更新按钮位置
|
// 更新按钮位置
|
||||||
_plugin.UpdateButtonPosition();
|
_plugin.UpdateButtonPosition();
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
_plugin.SaveConfig();
|
_plugin.SaveConfig();
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"通过右键菜单切换启动台按钮位置为: {_plugin.Config.ButtonPosition}",
|
LogHelper.WriteLogToFile($"通过右键菜单切换启动台按钮位置为: {_plugin.Config.ButtonPosition}");
|
||||||
LogHelper.LogType.Info);
|
|
||||||
};
|
};
|
||||||
menu.Items.Add(positionMenuItem);
|
menu.Items.Add(positionMenuItem);
|
||||||
|
|
||||||
// 添加设置菜单项
|
// 添加设置菜单项
|
||||||
MenuItem settingsMenuItem = new MenuItem();
|
MenuItem settingsMenuItem = new MenuItem();
|
||||||
settingsMenuItem.Header = "打开设置";
|
settingsMenuItem.Header = "打开设置";
|
||||||
settingsMenuItem.Click += (s, e) =>
|
settingsMenuItem.Click += (s, e) =>
|
||||||
{
|
{
|
||||||
// 打开插件设置窗口
|
// 打开插件设置窗口
|
||||||
var mainWindow = Application.Current.MainWindow;
|
var mainWindow = Application.Current.MainWindow;
|
||||||
@@ -133,7 +132,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
if (method != null)
|
if (method != null)
|
||||||
{
|
{
|
||||||
method.Invoke(mainWindow, null);
|
method.Invoke(mainWindow, null);
|
||||||
LogHelper.WriteLogToFile("已打开插件设置窗口", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("已打开插件设置窗口");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -143,7 +142,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
menu.Items.Add(settingsMenuItem);
|
menu.Items.Add(settingsMenuItem);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -152,7 +151,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取实际的UI元素
|
/// 获取实际的UI元素
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -161,7 +160,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
return _panel;
|
return _panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建图标图像
|
/// 创建图标图像
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -175,40 +174,40 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
Height = 17,
|
Height = 17,
|
||||||
Margin = new Thickness(0, 3, 0, 0)
|
Margin = new Thickness(0, 3, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
// 设置位图缩放模式
|
// 设置位图缩放模式
|
||||||
RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.HighQuality);
|
RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.HighQuality);
|
||||||
|
|
||||||
// 创建绘图图像
|
// 创建绘图图像
|
||||||
DrawingImage drawingImage = new DrawingImage();
|
DrawingImage drawingImage = new DrawingImage();
|
||||||
DrawingGroup drawingGroup = new DrawingGroup();
|
DrawingGroup drawingGroup = new DrawingGroup();
|
||||||
drawingGroup.ClipGeometry = Geometry.Parse("M0,0 V24 H24 V0 H0 Z");
|
drawingGroup.ClipGeometry = Geometry.Parse("M0,0 V24 H24 V0 H0 Z");
|
||||||
|
|
||||||
// 使用提供的应用网格图标
|
// 使用提供的应用网格图标
|
||||||
GeometryDrawing geometryDrawing = new GeometryDrawing
|
GeometryDrawing geometryDrawing = new GeometryDrawing
|
||||||
{
|
{
|
||||||
Brush = new SolidColorBrush(Color.FromRgb(0x1B, 0x1B, 0x1B)),
|
Brush = new SolidColorBrush(Color.FromRgb(0x1B, 0x1B, 0x1B)),
|
||||||
Geometry = Geometry.Parse("F0 M24,24z M0,0z M4.41721,4.29873C4.35178,4.29873,4.29873,4.35178,4.29873,4.41721L4.29873,9.15646C4.29873,9.22189,4.35178,9.27494,4.41721,9.27494L9.15646,9.27494C9.22189,9.27494,9.27494,9.22189,9.27494,9.15646L9.27494,4.41721C9.27494,4.35178,9.22189,4.29873,9.15646,4.29873L4.41721,4.29873z M2.64,4.41721C2.64,3.43569,3.43569,2.64,4.41721,2.64L9.15646,2.64C10.138,2.64,10.9337,3.43569,10.9337,4.41721L10.9337,9.15646C10.9337,10.138,10.138,10.9337,9.15646,10.9337L4.41721,10.9337C3.43569,10.9337,2.64,10.138,2.64,9.15646L2.64,4.41721z M14.8435,4.29873C14.7781,4.29873,14.7251,4.35178,14.7251,4.41721L14.7251,9.15646C14.7251,9.22189,14.7781,9.27494,14.8435,9.27494L19.5828,9.27494C19.6482,9.27494,19.7013,9.22189,19.7013,9.15646L19.7013,4.41721C19.7013,4.35178,19.6482,4.29873,19.5828,4.29873L14.8435,4.29873z M13.0663,4.41721C13.0663,3.43569,13.862,2.64,14.8435,2.64L19.5828,2.64C20.5643,2.64,21.36,3.43569,21.36,4.41721L21.36,9.15646C21.36,10.138,20.5643,10.9337,19.5828,10.9337L14.8435,10.9337C13.862,10.9337,13.0663,10.138,13.0663,9.15646L13.0663,4.41721z M14.8435,14.7251C14.7781,14.7251,14.7251,14.7781,14.7251,14.8435L14.7251,19.5828C14.7251,19.6482,14.7781,19.7013,14.8435,19.7013L19.5828,19.7013C19.6482,19.7013,19.7013,19.6482,19.7013,19.5828L19.7013,14.8435C19.7013,14.7781,19.6482,14.7251,19.5828,14.7251L14.8435,14.7251z M13.0663,14.8435C13.0663,13.862,13.862,13.0663,14.8435,13.0663L19.5828,13.0663C20.5643,13.0663,21.36,13.862,21.36,14.8435L21.36,19.5828C21.36,20.5643,20.5643,21.36,19.5828,21.36L14.8435,21.36C13.862,21.36,13.0663,20.5643,13.0663,19.5828L13.0663,14.8435z M4.41721,14.7251C4.35178,14.7251,4.29873,14.7781,4.29873,14.8435L4.29873,19.5828C4.29873,19.6482,4.35178,19.7013,4.41721,19.7013L9.15646,19.7013C9.22189,19.7013,9.27494,19.6482,9.27494,19.5828L9.27494,14.8435C9.27494,14.7781,9.22189,14.7251,9.15646,14.7251L4.41721,14.7251z M2.64,14.8435C2.64,13.862,3.43569,13.0663,4.41721,13.0663L9.15646,13.0663C10.138,13.0663,10.9337,13.862,10.9337,14.8435L10.9337,19.5828C10.9337,20.5643,10.138,21.36,9.15646,21.36L4.41721,21.36C3.43569,21.36,2.64,20.5643,2.64,19.5828L2.64,14.8435z")
|
Geometry = Geometry.Parse("F0 M24,24z M0,0z M4.41721,4.29873C4.35178,4.29873,4.29873,4.35178,4.29873,4.41721L4.29873,9.15646C4.29873,9.22189,4.35178,9.27494,4.41721,9.27494L9.15646,9.27494C9.22189,9.27494,9.27494,9.22189,9.27494,9.15646L9.27494,4.41721C9.27494,4.35178,9.22189,4.29873,9.15646,4.29873L4.41721,4.29873z M2.64,4.41721C2.64,3.43569,3.43569,2.64,4.41721,2.64L9.15646,2.64C10.138,2.64,10.9337,3.43569,10.9337,4.41721L10.9337,9.15646C10.9337,10.138,10.138,10.9337,9.15646,10.9337L4.41721,10.9337C3.43569,10.9337,2.64,10.138,2.64,9.15646L2.64,4.41721z M14.8435,4.29873C14.7781,4.29873,14.7251,4.35178,14.7251,4.41721L14.7251,9.15646C14.7251,9.22189,14.7781,9.27494,14.8435,9.27494L19.5828,9.27494C19.6482,9.27494,19.7013,9.22189,19.7013,9.15646L19.7013,4.41721C19.7013,4.35178,19.6482,4.29873,19.5828,4.29873L14.8435,4.29873z M13.0663,4.41721C13.0663,3.43569,13.862,2.64,14.8435,2.64L19.5828,2.64C20.5643,2.64,21.36,3.43569,21.36,4.41721L21.36,9.15646C21.36,10.138,20.5643,10.9337,19.5828,10.9337L14.8435,10.9337C13.862,10.9337,13.0663,10.138,13.0663,9.15646L13.0663,4.41721z M14.8435,14.7251C14.7781,14.7251,14.7251,14.7781,14.7251,14.8435L14.7251,19.5828C14.7251,19.6482,14.7781,19.7013,14.8435,19.7013L19.5828,19.7013C19.6482,19.7013,19.7013,19.6482,19.7013,19.5828L19.7013,14.8435C19.7013,14.7781,19.6482,14.7251,19.5828,14.7251L14.8435,14.7251z M13.0663,14.8435C13.0663,13.862,13.862,13.0663,14.8435,13.0663L19.5828,13.0663C20.5643,13.0663,21.36,13.862,21.36,14.8435L21.36,19.5828C21.36,20.5643,20.5643,21.36,19.5828,21.36L14.8435,21.36C13.862,21.36,13.0663,20.5643,13.0663,19.5828L13.0663,14.8435z M4.41721,14.7251C4.35178,14.7251,4.29873,14.7781,4.29873,14.8435L4.29873,19.5828C4.29873,19.6482,4.35178,19.7013,4.41721,19.7013L9.15646,19.7013C9.22189,19.7013,9.27494,19.6482,9.27494,19.5828L9.27494,14.8435C9.27494,14.7781,9.22189,14.7251,9.15646,14.7251L4.41721,14.7251z M2.64,14.8435C2.64,13.862,3.43569,13.0663,4.41721,13.0663L9.15646,13.0663C10.138,13.0663,10.9337,13.862,10.9337,14.8435L10.9337,19.5828C10.9337,20.5643,10.138,21.36,9.15646,21.36L4.41721,21.36C3.43569,21.36,2.64,20.5643,2.64,19.5828L2.64,14.8435z")
|
||||||
};
|
};
|
||||||
|
|
||||||
drawingGroup.Children.Add(geometryDrawing);
|
drawingGroup.Children.Add(geometryDrawing);
|
||||||
|
|
||||||
// 设置图像源
|
// 设置图像源
|
||||||
drawingImage.Drawing = drawingGroup;
|
drawingImage.Drawing = drawingGroup;
|
||||||
image.Source = drawingImage;
|
image.Source = drawingImage;
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"创建图标图像时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"创建图标图像时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
|
|
||||||
// 返回一个空图像
|
// 返回一个空图像
|
||||||
return new Image();
|
return new Image();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 鼠标按下事件
|
/// 鼠标按下事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -218,14 +217,14 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 提供反馈
|
// 提供反馈
|
||||||
_panel.Background = new SolidColorBrush(Color.FromArgb(40, 0, 0, 0));
|
_panel.Background = new SolidColorBrush(Color.FromArgb(40, 0, 0, 0));
|
||||||
LogHelper.WriteLogToFile("启动台按钮鼠标按下", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("启动台按钮鼠标按下");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"启动台按钮鼠标按下事件出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"启动台按钮鼠标按下事件出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 鼠标抬起事件
|
/// 鼠标抬起事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -238,14 +237,14 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 恢复背景
|
// 恢复背景
|
||||||
_panel.Background = Brushes.Transparent;
|
_panel.Background = Brushes.Transparent;
|
||||||
LogHelper.WriteLogToFile("启动台按钮鼠标抬起,准备显示启动台窗口", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("启动台按钮鼠标抬起,准备显示启动台窗口");
|
||||||
|
|
||||||
// 获取按钮在屏幕上的位置
|
// 获取按钮在屏幕上的位置
|
||||||
Point buttonPosition = _panel.PointToScreen(new Point(_panel.ActualWidth / 2, 0));
|
Point buttonPosition = _panel.PointToScreen(new Point(_panel.ActualWidth / 2, 0));
|
||||||
|
|
||||||
// 显示启动台窗口
|
// 显示启动台窗口
|
||||||
_plugin.ShowLauncherWindow(buttonPosition);
|
_plugin.ShowLauncherWindow(buttonPosition);
|
||||||
}
|
}
|
||||||
@@ -255,7 +254,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 鼠标离开事件
|
/// 鼠标离开事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -272,4 +271,4 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||||
{
|
{
|
||||||
@@ -19,13 +22,13 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
/// 左侧
|
/// 左侧
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Left,
|
Left,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 右侧
|
/// 右侧
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Right
|
Right
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台配置
|
/// 启动台配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -35,13 +38,13 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
/// 启动台按钮位置
|
/// 启动台按钮位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LauncherButtonPosition ButtonPosition { get; set; } = LauncherButtonPosition.Right;
|
public LauncherButtonPosition ButtonPosition { get; set; } = LauncherButtonPosition.Right;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台应用程序列表
|
/// 启动台应用程序列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<LauncherItem> Items { get; set; } = new List<LauncherItem>();
|
public List<LauncherItem> Items { get; set; } = new List<LauncherItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台应用项
|
/// 启动台应用项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -51,37 +54,37 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
/// 应用程序名称
|
/// 应用程序名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用程序路径
|
/// 应用程序路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否可见
|
/// 是否可见
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsVisible { get; set; } = true;
|
public bool IsVisible { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在启动台中的位置(0-39)
|
/// 在启动台中的位置(0-39)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Position { get; set; } = -1;
|
public int Position { get; set; } = -1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否已固定位置
|
/// 是否已固定位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPositionFixed { get; set; } = false;
|
public bool IsPositionFixed { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图标缓存
|
/// 图标缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[JsonIgnore]
|
||||||
private ImageSource _iconCache;
|
private ImageSource _iconCache;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取应用程序图标
|
/// 获取应用程序图标
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[JsonIgnore]
|
||||||
public ImageSource Icon
|
public ImageSource Icon
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -90,7 +93,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(Path))
|
if (File.Exists(Path))
|
||||||
@@ -103,7 +106,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
icon.Handle,
|
icon.Handle,
|
||||||
Int32Rect.Empty,
|
Int32Rect.Empty,
|
||||||
BitmapSizeOptions.FromEmptyOptions());
|
BitmapSizeOptions.FromEmptyOptions());
|
||||||
|
|
||||||
icon.Dispose();
|
icon.Dispose();
|
||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
@@ -123,7 +126,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
string[] parts = iconPath.Split(',');
|
string[] parts = iconPath.Split(',');
|
||||||
string iconFile = parts[0].Trim('"');
|
string iconFile = parts[0].Trim('"');
|
||||||
int iconIndex = parts.Length > 1 ? Convert.ToInt32(parts[1]) : 0;
|
int iconIndex = parts.Length > 1 ? Convert.ToInt32(parts[1]) : 0;
|
||||||
|
|
||||||
if (File.Exists(iconFile))
|
if (File.Exists(iconFile))
|
||||||
{
|
{
|
||||||
Icon icon = IconExtractor.Extract(iconFile, iconIndex, true);
|
Icon icon = IconExtractor.Extract(iconFile, iconIndex, true);
|
||||||
@@ -133,7 +136,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
icon.Handle,
|
icon.Handle,
|
||||||
Int32Rect.Empty,
|
Int32Rect.Empty,
|
||||||
BitmapSizeOptions.FromEmptyOptions());
|
BitmapSizeOptions.FromEmptyOptions());
|
||||||
|
|
||||||
icon.Dispose();
|
icon.Dispose();
|
||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
@@ -147,12 +150,12 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"获取应用图标时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"获取应用图标时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回默认图标
|
// 返回默认图标
|
||||||
return GetDefaultIcon();
|
return GetDefaultIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取默认图标
|
/// 获取默认图标
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -176,7 +179,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
icon.Handle,
|
icon.Handle,
|
||||||
Int32Rect.Empty,
|
Int32Rect.Empty,
|
||||||
BitmapSizeOptions.FromEmptyOptions());
|
BitmapSizeOptions.FromEmptyOptions());
|
||||||
|
|
||||||
icon.Dispose();
|
icon.Dispose();
|
||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
@@ -187,7 +190,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.WriteLogToFile($"获取资源管理器图标时出错: {ex.Message}", LogHelper.LogType.Warning);
|
LogHelper.WriteLogToFile($"获取资源管理器图标时出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
// 如果获取Windows图标失败,回退到默认图标
|
// 如果获取Windows图标失败,回退到默认图标
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回退到备用图标
|
// 回退到备用图标
|
||||||
string explorerIconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-Fluent", "ic_fluent_folder_24_regular.png");
|
string explorerIconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-Fluent", "ic_fluent_folder_24_regular.png");
|
||||||
if (File.Exists(explorerIconPath))
|
if (File.Exists(explorerIconPath))
|
||||||
@@ -198,7 +201,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回一个简单的默认图标
|
// 返回一个简单的默认图标
|
||||||
string iconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-png", "icc.png");
|
string iconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-png", "icc.png");
|
||||||
if (File.Exists(iconPath))
|
if (File.Exists(iconPath))
|
||||||
@@ -208,7 +211,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
_iconCache = image;
|
_iconCache = image;
|
||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果还是没有找到,尝试使用应用程序图标
|
// 如果还是没有找到,尝试使用应用程序图标
|
||||||
string appIconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-Fluent", "ic_fluent_apps_24_regular.png");
|
string appIconPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "Icons-Fluent", "ic_fluent_apps_24_regular.png");
|
||||||
if (File.Exists(appIconPath))
|
if (File.Exists(appIconPath))
|
||||||
@@ -219,14 +222,14 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
return _iconCache;
|
return _iconCache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"获取默认图标时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"获取默认图标时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动应用程序
|
/// 启动应用程序
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -239,30 +242,30 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.WriteLogToFile("无法启动应用程序:路径为空", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile("无法启动应用程序:路径为空", LogHelper.LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查文件是否存在
|
// 检查文件是否存在
|
||||||
if (!System.IO.File.Exists(Path) && !Path.Contains(":\\"))
|
if (!File.Exists(Path) && !Path.Contains(":\\"))
|
||||||
{
|
{
|
||||||
// 可能是系统命令,如explorer.exe
|
// 可能是系统命令,如explorer.exe
|
||||||
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = Path,
|
FileName = Path,
|
||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
};
|
};
|
||||||
System.Diagnostics.Process.Start(psi);
|
Process.Start(psi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 使用Process.Start启动应用程序
|
// 使用Process.Start启动应用程序
|
||||||
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = Path,
|
FileName = Path,
|
||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
};
|
};
|
||||||
System.Diagnostics.Process.Start(psi);
|
Process.Start(psi);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"已启动应用程序: {Path}", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"已启动应用程序: {Path}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -271,7 +274,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图标提取工具类
|
/// 图标提取工具类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -291,7 +294,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
IntPtr large;
|
IntPtr large;
|
||||||
IntPtr small;
|
IntPtr small;
|
||||||
ExtractIconEx(file, index, out large, out small, 1);
|
ExtractIconEx(file, index, out large, out small, 1);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Icon.FromHandle(largeIcon ? large : small);
|
return Icon.FromHandle(largeIcon ? large : small);
|
||||||
@@ -304,7 +307,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
if (large != IntPtr.Zero)
|
if (large != IntPtr.Zero)
|
||||||
DestroyIcon(large);
|
DestroyIcon(large);
|
||||||
|
|
||||||
if (small != IntPtr.Zero)
|
if (small != IntPtr.Zero)
|
||||||
DestroyIcon(small);
|
DestroyIcon(small);
|
||||||
}
|
}
|
||||||
@@ -314,16 +317,16 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Runtime.InteropServices.DllImport("Shell32.dll", EntryPoint = "ExtractIconEx")]
|
[DllImport("Shell32.dll", EntryPoint = "ExtractIconEx")]
|
||||||
private static extern int ExtractIconEx(
|
private static extern int ExtractIconEx(
|
||||||
[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPStr)] string lpszFile,
|
[MarshalAs(UnmanagedType.LPStr)] string lpszFile,
|
||||||
int nIconIndex,
|
int nIconIndex,
|
||||||
out IntPtr phiconLarge,
|
out IntPtr phiconLarge,
|
||||||
out IntPtr phiconSmall,
|
out IntPtr phiconSmall,
|
||||||
int nIcons);
|
int nIcons);
|
||||||
|
|
||||||
[System.Runtime.InteropServices.DllImport("User32.dll")]
|
[DllImport("User32.dll")]
|
||||||
private static extern int DestroyIcon(IntPtr hIcon);
|
private static extern int DestroyIcon(IntPtr hIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,60 @@
|
|||||||
<UserControl x:Class="Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher.LauncherSettingsControl"
|
<UserControl x:Class="Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher.LauncherSettingsControl"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher"
|
xmlns:local="clr-namespace:Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="500" d:DesignWidth="600">
|
d:DesignHeight="500" d:DesignWidth="600">
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<!-- 自定义按钮样式 -->
|
||||||
|
<Style x:Key="DefaultButtonStyle" TargetType="Button">
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="4"
|
||||||
|
Padding="{TemplateBinding Padding}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
TextElement.Foreground="{TemplateBinding Foreground}"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Opacity" Value="0.8"/>
|
||||||
|
<Setter Property="Effect">
|
||||||
|
<Setter.Value>
|
||||||
|
<DropShadowEffect Color="Black" Direction="270" ShadowDepth="2" Opacity="0.3" BlurRadius="4"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Opacity" Value="0.6"/>
|
||||||
|
<Setter Property="RenderTransform">
|
||||||
|
<Setter.Value>
|
||||||
|
<ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter TargetName="border" Property="Opacity" Value="0.4"/>
|
||||||
|
<Setter Property="Cursor" Value="Arrow"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Grid Margin="10">
|
<Grid Margin="10">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@@ -16,12 +64,12 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- 标题 -->
|
<!-- 标题 -->
|
||||||
<TextBlock Grid.Row="0" Text="超级启动台设置" FontSize="16" FontWeight="Bold" Margin="0,0,0,15"/>
|
<TextBlock Grid.Row="0" Text="超级启动台设置" FontSize="16" FontWeight="Bold" Margin="0,0,0,15" Foreground="Black"/>
|
||||||
|
|
||||||
<!-- 基本设置 -->
|
<!-- 基本设置 -->
|
||||||
<StackPanel Grid.Row="1" Margin="0,0,0,15">
|
<StackPanel Grid.Row="1" Margin="0,0,0,15">
|
||||||
<TextBlock Text="基本设置" FontSize="14" FontWeight="SemiBold" Margin="0,0,0,10"/>
|
<TextBlock Text="基本设置" FontSize="14" FontWeight="SemiBold" Margin="0,0,0,10" Foreground="Black"/>
|
||||||
|
|
||||||
<Grid Margin="10,0,0,0">
|
<Grid Margin="10,0,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="120"/>
|
<ColumnDefinition Width="120"/>
|
||||||
@@ -30,12 +78,12 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- 按钮位置 -->
|
<!-- 按钮位置 -->
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="按钮位置:" VerticalAlignment="Center"/>
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="按钮位置:" VerticalAlignment="Center" Foreground="Black"/>
|
||||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Margin="0,5">
|
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Margin="0,5">
|
||||||
<RadioButton x:Name="RbtnLeft" Content="浮动栏左侧" Margin="0,0,20,0" Checked="RbtnPosition_Checked"/>
|
<RadioButton x:Name="RbtnLeft" Content="浮动栏左侧" Margin="0,0,20,0" Checked="RbtnPosition_Checked" Foreground="Black"/>
|
||||||
<RadioButton x:Name="RbtnRight" Content="浮动栏右侧" IsChecked="True" Checked="RbtnPosition_Checked"/>
|
<RadioButton x:Name="RbtnRight" Content="浮动栏右侧" IsChecked="True" Checked="RbtnPosition_Checked" Foreground="Black"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -47,7 +95,7 @@
|
|||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<TextBlock Grid.Row="0" Text="应用管理" FontSize="14" FontWeight="SemiBold" Margin="0,0,0,10"/>
|
<TextBlock Grid.Row="0" Text="应用管理" FontSize="14" FontWeight="SemiBold" Margin="0,0,0,10" Foreground="Black"/>
|
||||||
|
|
||||||
<Border Grid.Row="1" BorderThickness="1" BorderBrush="#CCCCCC" CornerRadius="5">
|
<Border Grid.Row="1" BorderThickness="1" BorderBrush="#CCCCCC" CornerRadius="5">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -71,9 +119,15 @@
|
|||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
||||||
<Button x:Name="BtnAdd" Content="添加" Padding="10,5" Margin="0,5,5,5" Click="BtnAdd_Click"/>
|
<Button x:Name="BtnAdd" Content="添加" Padding="10,5" Margin="0,5,5,5" Click="BtnAdd_Click"
|
||||||
<Button x:Name="BtnEdit" Content="编辑" Padding="10,5" Margin="5" Click="BtnEdit_Click"/>
|
Background="#FF007ACC" Foreground="White" BorderBrush="#FF005A9B" BorderThickness="1"
|
||||||
<Button x:Name="BtnDelete" Content="删除" Padding="10,5" Margin="5" Click="BtnDelete_Click"/>
|
Style="{StaticResource DefaultButtonStyle}"/>
|
||||||
|
<Button x:Name="BtnEdit" Content="编辑" Padding="10,5" Margin="5" Click="BtnEdit_Click"
|
||||||
|
Background="#FF6C757D" Foreground="White" BorderBrush="#FF5A6268" BorderThickness="1"
|
||||||
|
Style="{StaticResource DefaultButtonStyle}"/>
|
||||||
|
<Button x:Name="BtnDelete" Content="删除" Padding="10,5" Margin="5" Click="BtnDelete_Click"
|
||||||
|
Background="#FFDC3545" Foreground="White" BorderBrush="#FFBD2130" BorderThickness="1"
|
||||||
|
Style="{StaticResource DefaultButtonStyle}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -81,7 +135,9 @@
|
|||||||
|
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部按钮 -->
|
||||||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0">
|
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0">
|
||||||
<Button x:Name="BtnSave" Content="保存设置" Padding="15,5" Click="BtnSave_Click"/>
|
<Button x:Name="BtnSave" Content="保存设置" Padding="15,5" Click="BtnSave_Click"
|
||||||
|
Background="#FF28A745" Foreground="White" BorderBrush="#FF1E7E34" BorderThickness="1"
|
||||||
|
Style="{StaticResource DefaultButtonStyle}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
|
using Ink_Canvas.Windows;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Ink_Canvas.Windows;
|
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||||
{
|
{
|
||||||
@@ -16,7 +17,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
/// 父插件
|
/// 父插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly SuperLauncherPlugin _plugin;
|
private readonly SuperLauncherPlugin _plugin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -24,20 +25,20 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
public LauncherSettingsControl(SuperLauncherPlugin plugin)
|
public LauncherSettingsControl(SuperLauncherPlugin plugin)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
|
|
||||||
// 设置按钮位置
|
// 设置按钮位置
|
||||||
RbtnLeft.IsChecked = _plugin.Config.ButtonPosition == LauncherButtonPosition.Left;
|
RbtnLeft.IsChecked = _plugin.Config.ButtonPosition == LauncherButtonPosition.Left;
|
||||||
RbtnRight.IsChecked = _plugin.Config.ButtonPosition == LauncherButtonPosition.Right;
|
RbtnRight.IsChecked = _plugin.Config.ButtonPosition == LauncherButtonPosition.Right;
|
||||||
|
|
||||||
// 绑定应用列表
|
// 绑定应用列表
|
||||||
DgApps.ItemsSource = _plugin.LauncherItems;
|
DgApps.ItemsSource = _plugin.LauncherItems;
|
||||||
|
|
||||||
// 初始化按钮状态
|
// 初始化按钮状态
|
||||||
UpdateButtonStates();
|
UpdateButtonStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新按钮状态
|
/// 更新按钮状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -47,16 +48,16 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
BtnEdit.IsEnabled = hasSelection;
|
BtnEdit.IsEnabled = hasSelection;
|
||||||
BtnDelete.IsEnabled = hasSelection;
|
BtnDelete.IsEnabled = hasSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 位置单选按钮选择事件
|
/// 位置单选按钮选择事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void RbtnPosition_Checked(object sender, RoutedEventArgs e)
|
private void RbtnPosition_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!IsLoaded) return;
|
if (!IsLoaded) return;
|
||||||
|
|
||||||
LauncherButtonPosition oldPosition = _plugin.Config.ButtonPosition;
|
LauncherButtonPosition oldPosition = _plugin.Config.ButtonPosition;
|
||||||
|
|
||||||
if (sender == RbtnLeft)
|
if (sender == RbtnLeft)
|
||||||
{
|
{
|
||||||
_plugin.Config.ButtonPosition = LauncherButtonPosition.Left;
|
_plugin.Config.ButtonPosition = LauncherButtonPosition.Left;
|
||||||
@@ -65,7 +66,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
_plugin.Config.ButtonPosition = LauncherButtonPosition.Right;
|
_plugin.Config.ButtonPosition = LauncherButtonPosition.Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果位置发生变化,更新按钮位置
|
// 如果位置发生变化,更新按钮位置
|
||||||
if (oldPosition != _plugin.Config.ButtonPosition)
|
if (oldPosition != _plugin.Config.ButtonPosition)
|
||||||
{
|
{
|
||||||
@@ -73,11 +74,11 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 更新按钮位置
|
// 更新按钮位置
|
||||||
_plugin.UpdateButtonPosition();
|
_plugin.UpdateButtonPosition();
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
_plugin.SaveConfig();
|
_plugin.SaveConfig();
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"启动台按钮位置已更改为: {_plugin.Config.ButtonPosition}", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"启动台按钮位置已更改为: {_plugin.Config.ButtonPosition}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -86,7 +87,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加按钮点击事件
|
/// 添加按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -102,7 +103,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
IsVisible = true,
|
IsVisible = true,
|
||||||
Position = -1 // 让插件管理器分配位置
|
Position = -1 // 让插件管理器分配位置
|
||||||
};
|
};
|
||||||
|
|
||||||
// 直接显示编辑对话框
|
// 直接显示编辑对话框
|
||||||
EditLauncherItem(item, true);
|
EditLauncherItem(item, true);
|
||||||
}
|
}
|
||||||
@@ -112,7 +113,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
MessageBox.Show($"添加启动项时出错: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"添加启动项时出错: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑应用按钮点击事件
|
/// 编辑应用按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -123,7 +124,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
EditLauncherItem(item, false);
|
EditLauncherItem(item, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除应用按钮点击事件
|
/// 删除应用按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -133,22 +134,22 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 确认删除
|
// 确认删除
|
||||||
MessageBoxResult result = MessageBox.Show(
|
MessageBoxResult result = MessageBox.Show(
|
||||||
$"确定要删除 {item.Name} 吗?",
|
$"确定要删除 {item.Name} 吗?",
|
||||||
"删除确认",
|
"删除确认",
|
||||||
MessageBoxButton.YesNo,
|
MessageBoxButton.YesNo,
|
||||||
MessageBoxImage.Question);
|
MessageBoxImage.Question);
|
||||||
|
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
// 从集合中移除
|
// 从集合中移除
|
||||||
_plugin.LauncherItems.Remove(item);
|
_plugin.LauncherItems.Remove(item);
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
_plugin.SaveConfig();
|
_plugin.SaveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存设置按钮点击事件
|
/// 保存设置按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -158,7 +159,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 保存配置
|
// 保存配置
|
||||||
_plugin.SaveConfig();
|
_plugin.SaveConfig();
|
||||||
|
|
||||||
// 如果插件已启用,重新加载启动台按钮
|
// 如果插件已启用,重新加载启动台按钮
|
||||||
if (_plugin.IsEnabled)
|
if (_plugin.IsEnabled)
|
||||||
{
|
{
|
||||||
@@ -169,7 +170,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 如果插件未启用,则启用它
|
// 如果插件未启用,则启用它
|
||||||
_plugin.Enable();
|
_plugin.Enable();
|
||||||
|
|
||||||
// 通知PluginSettingsWindow刷新插件列表
|
// 通知PluginSettingsWindow刷新插件列表
|
||||||
var window = Window.GetWindow(this);
|
var window = Window.GetWindow(this);
|
||||||
if (window is PluginSettingsWindow pluginSettingsWindow)
|
if (window is PluginSettingsWindow pluginSettingsWindow)
|
||||||
@@ -178,7 +179,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
pluginSettingsWindow.RefreshPluginList();
|
pluginSettingsWindow.RefreshPluginList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show("设置已保存并应用!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("设置已保存并应用!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -187,7 +188,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
MessageBox.Show($"保存设置时出错: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"保存设置时出错: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用项选择变更事件
|
/// 应用项选择变更事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -195,7 +196,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
UpdateButtonStates();
|
UpdateButtonStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑启动项
|
/// 编辑启动项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -212,63 +213,63 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen,
|
WindowStartupLocation = WindowStartupLocation.CenterScreen,
|
||||||
ResizeMode = ResizeMode.NoResize
|
ResizeMode = ResizeMode.NoResize
|
||||||
};
|
};
|
||||||
|
|
||||||
// 创建编辑表单
|
// 创建编辑表单
|
||||||
Grid grid = new Grid
|
Grid grid = new Grid
|
||||||
{
|
{
|
||||||
Margin = new Thickness(20)
|
Margin = new Thickness(20)
|
||||||
};
|
};
|
||||||
|
|
||||||
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||||
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||||
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
|
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
|
||||||
|
|
||||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(80) });
|
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(80) });
|
||||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
||||||
|
|
||||||
// 名称输入框
|
// 名称输入框
|
||||||
TextBlock nameLabel = new TextBlock
|
TextBlock nameLabel = new TextBlock
|
||||||
{
|
{
|
||||||
Text = "名称:",
|
Text = "名称:",
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
VerticalAlignment = VerticalAlignment.Center
|
||||||
};
|
};
|
||||||
TextBox nameTextBox = new TextBox
|
TextBox nameTextBox = new TextBox
|
||||||
{
|
{
|
||||||
Text = item.Name,
|
Text = item.Name,
|
||||||
Margin = new Thickness(0, 5, 0, 5)
|
Margin = new Thickness(0, 5, 0, 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
Grid.SetRow(nameLabel, 0);
|
Grid.SetRow(nameLabel, 0);
|
||||||
Grid.SetColumn(nameLabel, 0);
|
Grid.SetColumn(nameLabel, 0);
|
||||||
Grid.SetRow(nameTextBox, 0);
|
Grid.SetRow(nameTextBox, 0);
|
||||||
Grid.SetColumn(nameTextBox, 1);
|
Grid.SetColumn(nameTextBox, 1);
|
||||||
|
|
||||||
grid.Children.Add(nameLabel);
|
grid.Children.Add(nameLabel);
|
||||||
grid.Children.Add(nameTextBox);
|
grid.Children.Add(nameTextBox);
|
||||||
|
|
||||||
// 路径输入框
|
// 路径输入框
|
||||||
TextBlock pathLabel = new TextBlock
|
TextBlock pathLabel = new TextBlock
|
||||||
{
|
{
|
||||||
Text = "路径:",
|
Text = "路径:",
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
VerticalAlignment = VerticalAlignment.Center
|
||||||
};
|
};
|
||||||
Grid pathGrid = new Grid();
|
Grid pathGrid = new Grid();
|
||||||
pathGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
pathGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
||||||
pathGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength() });
|
pathGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength() });
|
||||||
|
|
||||||
TextBox pathTextBox = new TextBox
|
TextBox pathTextBox = new TextBox
|
||||||
{
|
{
|
||||||
Text = item.Path,
|
Text = item.Path,
|
||||||
Margin = new Thickness(0, 5, 5, 5)
|
Margin = new Thickness(0, 5, 5, 5)
|
||||||
};
|
};
|
||||||
Button browseButton = new Button
|
Button browseButton = new Button
|
||||||
{
|
{
|
||||||
Content = "浏览",
|
Content = "浏览",
|
||||||
Padding = new Thickness(5, 0, 5, 0),
|
Padding = new Thickness(5, 0, 5, 0),
|
||||||
Margin = new Thickness(0, 5, 0, 5)
|
Margin = new Thickness(0, 5, 0, 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
browseButton.Click += (s, e) =>
|
browseButton.Click += (s, e) =>
|
||||||
{
|
{
|
||||||
OpenFileDialog dialog = new OpenFileDialog
|
OpenFileDialog dialog = new OpenFileDialog
|
||||||
{
|
{
|
||||||
@@ -277,15 +278,15 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
Multiselect = false,
|
Multiselect = false,
|
||||||
FileName = pathTextBox.Text
|
FileName = pathTextBox.Text
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dialog.ShowDialog() == true)
|
if (dialog.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
pathTextBox.Text = dialog.FileName;
|
pathTextBox.Text = dialog.FileName;
|
||||||
|
|
||||||
// 如果选择的是.exe文件,自动获取文件名填入名称字段
|
// 如果选择的是.exe文件,自动获取文件名填入名称字段
|
||||||
if (System.IO.Path.GetExtension(dialog.FileName).ToLower() == ".exe")
|
if (Path.GetExtension(dialog.FileName).ToLower() == ".exe")
|
||||||
{
|
{
|
||||||
string fileName = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName);
|
string fileName = Path.GetFileNameWithoutExtension(dialog.FileName);
|
||||||
// 只有在名称字段为空或者是新建项目时才自动填入
|
// 只有在名称字段为空或者是新建项目时才自动填入
|
||||||
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || isNew)
|
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || isNew)
|
||||||
{
|
{
|
||||||
@@ -294,20 +295,20 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Grid.SetColumn(pathTextBox, 0);
|
Grid.SetColumn(pathTextBox, 0);
|
||||||
Grid.SetColumn(browseButton, 1);
|
Grid.SetColumn(browseButton, 1);
|
||||||
pathGrid.Children.Add(pathTextBox);
|
pathGrid.Children.Add(pathTextBox);
|
||||||
pathGrid.Children.Add(browseButton);
|
pathGrid.Children.Add(browseButton);
|
||||||
|
|
||||||
Grid.SetRow(pathLabel, 1);
|
Grid.SetRow(pathLabel, 1);
|
||||||
Grid.SetColumn(pathLabel, 0);
|
Grid.SetColumn(pathLabel, 0);
|
||||||
Grid.SetRow(pathGrid, 1);
|
Grid.SetRow(pathGrid, 1);
|
||||||
Grid.SetColumn(pathGrid, 1);
|
Grid.SetColumn(pathGrid, 1);
|
||||||
|
|
||||||
grid.Children.Add(pathLabel);
|
grid.Children.Add(pathLabel);
|
||||||
grid.Children.Add(pathGrid);
|
grid.Children.Add(pathGrid);
|
||||||
|
|
||||||
// 确认和取消按钮
|
// 确认和取消按钮
|
||||||
StackPanel buttonPanel = new StackPanel
|
StackPanel buttonPanel = new StackPanel
|
||||||
{
|
{
|
||||||
@@ -315,7 +316,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
HorizontalAlignment = HorizontalAlignment.Right,
|
HorizontalAlignment = HorizontalAlignment.Right,
|
||||||
Margin = new Thickness(0, 10, 0, 0)
|
Margin = new Thickness(0, 10, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
Button okButton = new Button
|
Button okButton = new Button
|
||||||
{
|
{
|
||||||
Content = "确定",
|
Content = "确定",
|
||||||
@@ -323,15 +324,15 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
Margin = new Thickness(0, 0, 10, 0),
|
Margin = new Thickness(0, 0, 10, 0),
|
||||||
IsDefault = true
|
IsDefault = true
|
||||||
};
|
};
|
||||||
|
|
||||||
Button cancelButton = new Button
|
Button cancelButton = new Button
|
||||||
{
|
{
|
||||||
Content = "取消",
|
Content = "取消",
|
||||||
Padding = new Thickness(15, 5, 15, 5),
|
Padding = new Thickness(15, 5, 15, 5),
|
||||||
IsCancel = true
|
IsCancel = true
|
||||||
};
|
};
|
||||||
|
|
||||||
okButton.Click += (s, e) =>
|
okButton.Click += (s, e) =>
|
||||||
{
|
{
|
||||||
// 验证输入
|
// 验证输入
|
||||||
if (string.IsNullOrWhiteSpace(nameTextBox.Text))
|
if (string.IsNullOrWhiteSpace(nameTextBox.Text))
|
||||||
@@ -339,17 +340,17 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
MessageBox.Show("请输入应用名称!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("请输入应用名称!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(pathTextBox.Text))
|
if (string.IsNullOrWhiteSpace(pathTextBox.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("请输入应用路径!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("请输入应用路径!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新项目
|
// 更新项目
|
||||||
item.Name = nameTextBox.Text;
|
item.Name = nameTextBox.Text;
|
||||||
item.Path = pathTextBox.Text;
|
item.Path = pathTextBox.Text;
|
||||||
|
|
||||||
// 如果是新建,添加到集合
|
// 如果是新建,添加到集合
|
||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
@@ -362,34 +363,34 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
view.Refresh();
|
view.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
_plugin.SaveConfig();
|
_plugin.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
editWindow.DialogResult = true;
|
editWindow.DialogResult = true;
|
||||||
editWindow.Close();
|
editWindow.Close();
|
||||||
};
|
};
|
||||||
|
|
||||||
cancelButton.Click += (s, e) =>
|
cancelButton.Click += (s, e) =>
|
||||||
{
|
{
|
||||||
editWindow.DialogResult = false;
|
editWindow.DialogResult = false;
|
||||||
editWindow.Close();
|
editWindow.Close();
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonPanel.Children.Add(okButton);
|
buttonPanel.Children.Add(okButton);
|
||||||
buttonPanel.Children.Add(cancelButton);
|
buttonPanel.Children.Add(cancelButton);
|
||||||
|
|
||||||
Grid.SetRow(buttonPanel, 2);
|
Grid.SetRow(buttonPanel, 2);
|
||||||
Grid.SetColumnSpan(buttonPanel, 2);
|
Grid.SetColumnSpan(buttonPanel, 2);
|
||||||
|
|
||||||
grid.Children.Add(buttonPanel);
|
grid.Children.Add(buttonPanel);
|
||||||
|
|
||||||
// 设置窗口内容
|
// 设置窗口内容
|
||||||
editWindow.Content = grid;
|
editWindow.Content = grid;
|
||||||
|
|
||||||
// 显示窗口
|
// 显示窗口
|
||||||
editWindow.ShowDialog();
|
editWindow.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||||
{
|
{
|
||||||
@@ -17,52 +23,52 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
/// 父插件
|
/// 父插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly SuperLauncherPlugin _plugin;
|
private readonly SuperLauncherPlugin _plugin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否处于固定模式
|
/// 是否处于固定模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _isFixMode = false;
|
private bool _isFixMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用项按钮列表
|
/// 应用项按钮列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<Button, LauncherItem> _appButtons = new Dictionary<Button, LauncherItem>();
|
private readonly Dictionary<Button, LauncherItem> _appButtons = new Dictionary<Button, LauncherItem>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拖拽中的按钮
|
/// 拖拽中的按钮
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Button _draggingButton;
|
private Button _draggingButton;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拖拽开始位置
|
/// 拖拽开始位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Point _dragStartPoint;
|
private Point _dragStartPoint;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LauncherWindow(SuperLauncherPlugin plugin)
|
public LauncherWindow(SuperLauncherPlugin plugin)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
|
|
||||||
// 加载应用项
|
// 加载应用项
|
||||||
LoadLauncherItems();
|
LoadLauncherItems();
|
||||||
|
|
||||||
// 添加鼠标按下事件(用于拖动窗口)
|
// 添加鼠标按下事件(用于拖动窗口)
|
||||||
this.MouseDown += (s, e) =>
|
MouseDown += (s, e) =>
|
||||||
{
|
{
|
||||||
if (e.ChangedButton == MouseButton.Left && e.ButtonState == MouseButtonState.Pressed)
|
if (e.ChangedButton == MouseButton.Left && e.ButtonState == MouseButtonState.Pressed)
|
||||||
{
|
{
|
||||||
this.DragMove();
|
DragMove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 根据应用数量调整窗口大小
|
// 根据应用数量调整窗口大小
|
||||||
AdjustWindowSize();
|
AdjustWindowSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载启动台应用项
|
/// 加载启动台应用项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -71,13 +77,13 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
// 清空现有应用项
|
// 清空现有应用项
|
||||||
AppPanel.Children.Clear();
|
AppPanel.Children.Clear();
|
||||||
_appButtons.Clear();
|
_appButtons.Clear();
|
||||||
|
|
||||||
// 获取显示的应用项
|
// 获取显示的应用项
|
||||||
var visibleItems = _plugin.LauncherItems
|
var visibleItems = _plugin.LauncherItems
|
||||||
.Where(item => item.IsVisible)
|
.Where(item => item.IsVisible)
|
||||||
.OrderBy(item => item.Position)
|
.OrderBy(item => item.Position)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var item in visibleItems)
|
foreach (var item in visibleItems)
|
||||||
{
|
{
|
||||||
// 创建应用按钮
|
// 创建应用按钮
|
||||||
@@ -87,23 +93,23 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
DataContext = item,
|
DataContext = item,
|
||||||
Tag = item.Position
|
Tag = item.Position
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加点击事件
|
// 添加点击事件
|
||||||
appButton.Click += AppButton_Click;
|
appButton.Click += AppButton_Click;
|
||||||
|
|
||||||
// 在固定模式下,添加拖拽事件
|
// 在固定模式下,添加拖拽事件
|
||||||
appButton.PreviewMouseDown += AppButton_PreviewMouseDown;
|
appButton.PreviewMouseDown += AppButton_PreviewMouseDown;
|
||||||
appButton.PreviewMouseMove += AppButton_PreviewMouseMove;
|
appButton.PreviewMouseMove += AppButton_PreviewMouseMove;
|
||||||
appButton.PreviewMouseUp += AppButton_PreviewMouseUp;
|
appButton.PreviewMouseUp += AppButton_PreviewMouseUp;
|
||||||
|
|
||||||
// 记录按钮和项目的对应关系
|
// 记录按钮和项目的对应关系
|
||||||
_appButtons.Add(appButton, item);
|
_appButtons.Add(appButton, item);
|
||||||
|
|
||||||
// 添加到面板
|
// 添加到面板
|
||||||
AppPanel.Children.Add(appButton);
|
AppPanel.Children.Add(appButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据应用数量调整窗口大小
|
/// 根据应用数量调整窗口大小
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -113,14 +119,14 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 每行最多显示4个应用
|
// 每行最多显示4个应用
|
||||||
const int appsPerRow = 4;
|
const int appsPerRow = 4;
|
||||||
|
|
||||||
// 计算行数
|
// 计算行数
|
||||||
int visibleCount = _appButtons.Count;
|
int visibleCount = _appButtons.Count;
|
||||||
int rowCount = (int)Math.Ceiling(visibleCount / (double)appsPerRow);
|
int rowCount = (int)Math.Ceiling(visibleCount / (double)appsPerRow);
|
||||||
|
|
||||||
// 设置窗口宽度(每个应用90像素宽 = 80 + 5*2)
|
// 设置窗口宽度(每个应用90像素宽 = 80 + 5*2)
|
||||||
Width = Math.Min(appsPerRow * 90 + 40, 400); // 最大宽度400
|
Width = Math.Min(appsPerRow * 90 + 40, 400); // 最大宽度400
|
||||||
|
|
||||||
// 设置窗口高度(每个应用90像素高 = 80 + 5*2)
|
// 设置窗口高度(每个应用90像素高 = 80 + 5*2)
|
||||||
Height = Math.Min(rowCount * 90 + 60, 600); // 最大高度600,标题栏40 + 边距20
|
Height = Math.Min(rowCount * 90 + 60, 600); // 最大高度600,标题栏40 + 边距20
|
||||||
}
|
}
|
||||||
@@ -129,7 +135,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.WriteLogToFile($"调整启动台窗口大小时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"调整启动台窗口大小时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用按钮点击事件
|
/// 应用按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -138,44 +144,44 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_isFixMode) return; // 在固定模式下,不响应点击事件
|
if (_isFixMode) return; // 在固定模式下,不响应点击事件
|
||||||
|
|
||||||
if (sender is Button button && _appButtons.TryGetValue(button, out LauncherItem item))
|
if (sender is Button button && _appButtons.TryGetValue(button, out LauncherItem item))
|
||||||
{
|
{
|
||||||
// 获取应用路径和名称,用于后续启动
|
// 获取应用路径和名称,用于后续启动
|
||||||
string appPath = item.Path;
|
string appPath = item.Path;
|
||||||
string appName = item.Name;
|
string appName = item.Name;
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"点击启动应用: {appName}, 路径: {appPath}", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"点击启动应用: {appName}, 路径: {appPath}");
|
||||||
|
|
||||||
// 首先标记窗口正在关闭
|
// 首先标记窗口正在关闭
|
||||||
IsClosing = true;
|
IsClosing = true;
|
||||||
|
|
||||||
// 创建一个应用启动任务
|
// 创建一个应用启动任务
|
||||||
var launchTask = new System.Threading.Tasks.Task(() =>
|
var launchTask = new Task(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 等待一段时间,确保窗口关闭流程已经开始
|
// 等待一段时间,确保窗口关闭流程已经开始
|
||||||
System.Threading.Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
|
|
||||||
// 使用UI线程启动应用
|
// 使用UI线程启动应用
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 检查应用路径是否存在
|
// 检查应用路径是否存在
|
||||||
if (System.IO.File.Exists(appPath) || !appPath.Contains(":\\"))
|
if (File.Exists(appPath) || !appPath.Contains(":\\"))
|
||||||
{
|
{
|
||||||
// 创建进程启动信息
|
// 创建进程启动信息
|
||||||
var psi = new System.Diagnostics.ProcessStartInfo
|
var psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = appPath,
|
FileName = appPath,
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 启动应用程序
|
// 启动应用程序
|
||||||
var process = System.Diagnostics.Process.Start(psi);
|
var process = Process.Start(psi);
|
||||||
LogHelper.WriteLogToFile($"应用程序 {appName} 已启动", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"应用程序 {appName} 已启动");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -195,17 +201,17 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.WriteLogToFile($"应用启动任务出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"应用启动任务出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 关闭窗口
|
// 关闭窗口
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Dispatcher.BeginInvoke(new Action(() =>
|
Dispatcher.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
try { Close(); } catch { }
|
try { Close(); } catch { }
|
||||||
|
|
||||||
// 启动应用程序任务
|
// 启动应用程序任务
|
||||||
launchTask.Start();
|
launchTask.Start();
|
||||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
}), DispatcherPriority.Background);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -221,86 +227,86 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
try { IsClosing = true; Close(); } catch { }
|
try { IsClosing = true; Close(); } catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 固定模式拖拽事件
|
#region 固定模式拖拽事件
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用按钮鼠标按下事件
|
/// 应用按钮鼠标按下事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AppButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
private void AppButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_isFixMode) return;
|
if (!_isFixMode) return;
|
||||||
|
|
||||||
if (e.ChangedButton == MouseButton.Left && sender is Button button)
|
if (e.ChangedButton == MouseButton.Left && sender is Button button)
|
||||||
{
|
{
|
||||||
_draggingButton = button;
|
_draggingButton = button;
|
||||||
_dragStartPoint = e.GetPosition(AppPanel);
|
_dragStartPoint = e.GetPosition(AppPanel);
|
||||||
button.CaptureMouse();
|
button.CaptureMouse();
|
||||||
button.Opacity = 0.7;
|
button.Opacity = 0.7;
|
||||||
|
|
||||||
// 阻止事件冒泡,以避免触发按钮点击
|
// 阻止事件冒泡,以避免触发按钮点击
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用按钮鼠标移动事件
|
/// 应用按钮鼠标移动事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AppButton_PreviewMouseMove(object sender, MouseEventArgs e)
|
private void AppButton_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_isFixMode || _draggingButton == null) return;
|
if (!_isFixMode || _draggingButton == null) return;
|
||||||
|
|
||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
{
|
{
|
||||||
Point currentPosition = e.GetPosition(AppPanel);
|
Point currentPosition = e.GetPosition(AppPanel);
|
||||||
|
|
||||||
// 移动按钮
|
// 移动按钮
|
||||||
System.Windows.Controls.Canvas.SetLeft(_draggingButton, currentPosition.X - _draggingButton.ActualWidth / 2);
|
System.Windows.Controls.Canvas.SetLeft(_draggingButton, currentPosition.X - _draggingButton.ActualWidth / 2);
|
||||||
System.Windows.Controls.Canvas.SetTop(_draggingButton, currentPosition.Y - _draggingButton.ActualHeight / 2);
|
System.Windows.Controls.Canvas.SetTop(_draggingButton, currentPosition.Y - _draggingButton.ActualHeight / 2);
|
||||||
|
|
||||||
// 将按钮移到最上层
|
// 将按钮移到最上层
|
||||||
Panel.SetZIndex(_draggingButton, 100);
|
Panel.SetZIndex(_draggingButton, 100);
|
||||||
|
|
||||||
// 阻止事件冒泡
|
// 阻止事件冒泡
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用按钮鼠标释放事件
|
/// 应用按钮鼠标释放事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AppButton_PreviewMouseUp(object sender, MouseButtonEventArgs e)
|
private void AppButton_PreviewMouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_isFixMode || _draggingButton == null) return;
|
if (!_isFixMode || _draggingButton == null) return;
|
||||||
|
|
||||||
// 释放鼠标捕获
|
// 释放鼠标捕获
|
||||||
_draggingButton.ReleaseMouseCapture();
|
_draggingButton.ReleaseMouseCapture();
|
||||||
|
|
||||||
// 计算新位置
|
// 计算新位置
|
||||||
Point releasePoint = e.GetPosition(AppPanel);
|
Point releasePoint = e.GetPosition(AppPanel);
|
||||||
int newPosition = CalculateGridPosition(releasePoint);
|
int newPosition = CalculateGridPosition(releasePoint);
|
||||||
|
|
||||||
// 获取当前项目
|
// 获取当前项目
|
||||||
LauncherItem currentItem = _appButtons[_draggingButton];
|
LauncherItem currentItem = _appButtons[_draggingButton];
|
||||||
|
|
||||||
// 重新排序
|
// 重新排序
|
||||||
ReorderItems(currentItem, newPosition);
|
ReorderItems(currentItem, newPosition);
|
||||||
|
|
||||||
// 重新加载应用项
|
// 重新加载应用项
|
||||||
LoadLauncherItems();
|
LoadLauncherItems();
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
_plugin.SaveConfig();
|
_plugin.SaveConfig();
|
||||||
|
|
||||||
// 清除拖拽状态
|
// 清除拖拽状态
|
||||||
_draggingButton.Opacity = 1;
|
_draggingButton.Opacity = 1;
|
||||||
Panel.SetZIndex(_draggingButton, 0);
|
Panel.SetZIndex(_draggingButton, 0);
|
||||||
_draggingButton = null;
|
_draggingButton = null;
|
||||||
|
|
||||||
// 阻止事件冒泡
|
// 阻止事件冒泡
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 计算网格位置
|
/// 计算网格位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -310,18 +316,18 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
int columnCount = 4; // 每行最多4个应用
|
int columnCount = 4; // 每行最多4个应用
|
||||||
int columnWidth = 90; // 应用宽度(包括边距)
|
int columnWidth = 90; // 应用宽度(包括边距)
|
||||||
int rowHeight = 90; // 应用高度(包括边距)
|
int rowHeight = 90; // 应用高度(包括边距)
|
||||||
|
|
||||||
int column = (int)(point.X / columnWidth);
|
int column = (int)(point.X / columnWidth);
|
||||||
int row = (int)(point.Y / rowHeight);
|
int row = (int)(point.Y / rowHeight);
|
||||||
|
|
||||||
// 确保在有效范围内
|
// 确保在有效范围内
|
||||||
column = Math.Max(0, Math.Min(column, columnCount - 1));
|
column = Math.Max(0, Math.Min(column, columnCount - 1));
|
||||||
row = Math.Max(0, row);
|
row = Math.Max(0, row);
|
||||||
|
|
||||||
// 计算位置索引
|
// 计算位置索引
|
||||||
return row * columnCount + column;
|
return row * columnCount + column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重新排序应用项
|
/// 重新排序应用项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -331,22 +337,22 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 设置项目为固定位置
|
// 设置项目为固定位置
|
||||||
item.IsPositionFixed = true;
|
item.IsPositionFixed = true;
|
||||||
|
|
||||||
// 如果位置相同,无需调整
|
// 如果位置相同,无需调整
|
||||||
if (item.Position == newPosition)
|
if (item.Position == newPosition)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取所有可见项目
|
// 获取所有可见项目
|
||||||
var visibleItems = _plugin.LauncherItems
|
var visibleItems = _plugin.LauncherItems
|
||||||
.Where(i => i.IsVisible)
|
.Where(i => i.IsVisible)
|
||||||
.OrderBy(i => i.Position)
|
.OrderBy(i => i.Position)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 移除当前项目
|
// 移除当前项目
|
||||||
visibleItems.Remove(item);
|
visibleItems.Remove(item);
|
||||||
|
|
||||||
// 查找插入位置
|
// 查找插入位置
|
||||||
int insertIndex = 0;
|
int insertIndex = 0;
|
||||||
for (int i = 0; i < visibleItems.Count; i++)
|
for (int i = 0; i < visibleItems.Count; i++)
|
||||||
@@ -358,10 +364,10 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
insertIndex = i + 1;
|
insertIndex = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 插入项目
|
// 插入项目
|
||||||
visibleItems.Insert(insertIndex, item);
|
visibleItems.Insert(insertIndex, item);
|
||||||
|
|
||||||
// 重新分配位置
|
// 重新分配位置
|
||||||
for (int i = 0; i < visibleItems.Count; i++)
|
for (int i = 0; i < visibleItems.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -373,11 +379,11 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.WriteLogToFile($"重新排序应用项时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"重新排序应用项时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 窗口事件处理
|
#region 窗口事件处理
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 窗口失去焦点事件
|
/// 窗口失去焦点事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -390,7 +396,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 标记为正在关闭
|
// 标记为正在关闭
|
||||||
IsClosing = true;
|
IsClosing = true;
|
||||||
|
|
||||||
// 使用Dispatcher.BeginInvoke而不是直接调用Close,避免冲突
|
// 使用Dispatcher.BeginInvoke而不是直接调用Close,避免冲突
|
||||||
Dispatcher.BeginInvoke(new Action(() =>
|
Dispatcher.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
@@ -398,15 +404,15 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 再次检查窗口状态
|
// 再次检查窗口状态
|
||||||
if (IsLoaded && !IsClosing)
|
if (IsLoaded && !IsClosing)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"延迟关闭窗口时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"延迟关闭窗口时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
}), DispatcherPriority.Background);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -414,21 +420,21 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
LogHelper.WriteLogToFile($"窗口失去焦点关闭时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"窗口失去焦点关闭时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 窗口是否正在关闭
|
/// 窗口是否正在关闭
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool IsClosing { get; set; } = false;
|
private bool IsClosing { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重写OnClosing方法,标记窗口正在关闭
|
/// 重写OnClosing方法,标记窗口正在关闭
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
{
|
{
|
||||||
IsClosing = true;
|
IsClosing = true;
|
||||||
base.OnClosing(e);
|
base.OnClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关闭按钮点击事件
|
/// 关闭按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -436,7 +442,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 固定模式按钮点击事件
|
/// 固定模式按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -444,17 +450,17 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
{
|
{
|
||||||
// 切换固定模式
|
// 切换固定模式
|
||||||
_isFixMode = !_isFixMode;
|
_isFixMode = !_isFixMode;
|
||||||
|
|
||||||
// 更新固定模式按钮图标颜色
|
// 更新固定模式按钮图标颜色
|
||||||
FixModeIcon.Fill = _isFixMode ? Brushes.Yellow : Brushes.White;
|
FixModeIcon.Fill = _isFixMode ? Brushes.Yellow : Brushes.White;
|
||||||
|
|
||||||
// 显示提示
|
// 显示提示
|
||||||
if (_isFixMode)
|
if (_isFixMode)
|
||||||
{
|
{
|
||||||
MessageBox.Show("已进入固定模式,您可以拖动应用图标调整位置。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("已进入固定模式,您可以拖动应用图标调整位置。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,72 +16,72 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
public class SuperLauncherPlugin : PluginBase
|
public class SuperLauncherPlugin : PluginBase
|
||||||
{
|
{
|
||||||
#region 插件基本信息
|
#region 插件基本信息
|
||||||
|
|
||||||
public override string Name => "超级启动台";
|
public override string Name => "超级启动台";
|
||||||
|
|
||||||
public override string Description => "在浮动栏添加一个启动台按钮,可快速启动常用应用程序。";
|
public override string Description => "在浮动栏添加一个启动台按钮,可快速启动常用应用程序。";
|
||||||
|
|
||||||
public override Version Version => new Version(1, 0, 1);
|
public override Version Version => new Version(1, 0, 1);
|
||||||
|
|
||||||
public override string Author => "ICC CE 团队";
|
public override string Author => "ICC CE 团队";
|
||||||
|
|
||||||
public override bool IsBuiltIn => true;
|
public override bool IsBuiltIn => true;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 插件属性和字段
|
#region 插件属性和字段
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台配置
|
/// 启动台配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LauncherConfig Config { get; private set; }
|
public LauncherConfig Config { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台应用程序列表
|
/// 启动台应用程序列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableCollection<LauncherItem> LauncherItems { get; private set; }
|
public ObservableCollection<LauncherItem> LauncherItems { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台按钮
|
/// 启动台按钮
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private LauncherButton _launcherButton;
|
private LauncherButton _launcherButton;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动台窗口
|
/// 启动台窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private LauncherWindow _launcherWindow;
|
private LauncherWindow _launcherWindow;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置文件路径
|
/// 配置文件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly string _configPath = Path.Combine(App.RootPath, "PluginConfigs", "SuperLauncher.json");
|
private readonly string _configPath = Path.Combine(App.RootPath, "PluginConfigs", "SuperLauncher.json");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标记是否已添加到浮动栏
|
/// 标记是否已添加到浮动栏
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _isAddedToFloatingBar = false;
|
private bool _isAddedToFloatingBar;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 插件生命周期
|
#region 插件生命周期
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
// 创建配置目录
|
// 创建配置目录
|
||||||
string configDir = Path.Combine(App.RootPath, "PluginConfigs");
|
string configDir = Path.Combine(App.RootPath, "PluginConfigs");
|
||||||
if (!Directory.Exists(configDir))
|
if (!Directory.Exists(configDir))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(configDir);
|
Directory.CreateDirectory(configDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载配置
|
// 加载配置
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("超级启动台插件已初始化", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("超级启动台插件已初始化");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -89,30 +89,30 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsEnabled) return; // 防止重复启用
|
if (IsEnabled) return; // 防止重复启用
|
||||||
|
|
||||||
// 创建启动台按钮
|
// 创建启动台按钮
|
||||||
if (_launcherButton == null)
|
if (_launcherButton == null)
|
||||||
{
|
{
|
||||||
_launcherButton = new LauncherButton(this);
|
_launcherButton = new LauncherButton(this);
|
||||||
LogHelper.WriteLogToFile("超级启动台按钮已创建", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("超级启动台按钮已创建");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加启动台按钮到浮动栏
|
// 添加启动台按钮到浮动栏
|
||||||
AddLauncherButtonToFloatingBar();
|
AddLauncherButtonToFloatingBar();
|
||||||
|
|
||||||
// 设置启用状态
|
// 设置启用状态
|
||||||
base.Enable();
|
base.Enable();
|
||||||
|
|
||||||
// 保存插件配置
|
// 保存插件配置
|
||||||
SavePluginSettings();
|
SavePluginSettings();
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("超级启动台插件已启用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("超级启动台插件已启用");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -120,30 +120,30 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!IsEnabled) return; // 防止重复禁用
|
if (!IsEnabled) return; // 防止重复禁用
|
||||||
|
|
||||||
// 从浮动栏移除启动台按钮
|
// 从浮动栏移除启动台按钮
|
||||||
RemoveLauncherButtonFromFloatingBar();
|
RemoveLauncherButtonFromFloatingBar();
|
||||||
|
|
||||||
// 如果启动台窗口打开,则关闭
|
// 如果启动台窗口打开,则关闭
|
||||||
if (_launcherWindow != null && _launcherWindow.IsVisible)
|
if (_launcherWindow != null && _launcherWindow.IsVisible)
|
||||||
{
|
{
|
||||||
_launcherWindow.Close();
|
_launcherWindow.Close();
|
||||||
_launcherWindow = null;
|
_launcherWindow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置禁用状态
|
// 设置禁用状态
|
||||||
base.Disable();
|
base.Disable();
|
||||||
|
|
||||||
// 保存插件配置
|
// 保存插件配置
|
||||||
SavePluginSettings();
|
SavePluginSettings();
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("超级启动台插件已禁用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("超级启动台插件已禁用");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -151,30 +151,30 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UserControl GetSettingsView()
|
public override UserControl GetSettingsView()
|
||||||
{
|
{
|
||||||
return new LauncherSettingsControl(this);
|
return new LauncherSettingsControl(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Cleanup()
|
public override void Cleanup()
|
||||||
{
|
{
|
||||||
// 保存配置
|
// 保存配置
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
|
||||||
// 从浮动栏移除启动台按钮
|
// 从浮动栏移除启动台按钮
|
||||||
RemoveLauncherButtonFromFloatingBar();
|
RemoveLauncherButtonFromFloatingBar();
|
||||||
|
|
||||||
// 如果启动台窗口打开,则关闭
|
// 如果启动台窗口打开,则关闭
|
||||||
if (_launcherWindow != null && _launcherWindow.IsVisible)
|
if (_launcherWindow != null && _launcherWindow.IsVisible)
|
||||||
{
|
{
|
||||||
_launcherWindow.Close();
|
_launcherWindow.Close();
|
||||||
_launcherWindow = null;
|
_launcherWindow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Cleanup();
|
base.Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存插件设置
|
/// 保存插件设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -187,24 +187,24 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新其他设置,但不更改插件启用状态
|
// 更新其他设置,但不更改插件启用状态
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"超级启动台插件设置已保存", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("超级启动台插件设置已保存");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"保存超级启动台插件设置时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"保存超级启动台插件设置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 配置管理
|
#region 配置管理
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载配置
|
/// 加载配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -217,7 +217,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
string json = File.ReadAllText(_configPath);
|
string json = File.ReadAllText(_configPath);
|
||||||
Config = JsonConvert.DeserializeObject<LauncherConfig>(json) ?? CreateDefaultConfig();
|
Config = JsonConvert.DeserializeObject<LauncherConfig>(json) ?? CreateDefaultConfig();
|
||||||
LauncherItems = new ObservableCollection<LauncherItem>(Config.Items ?? new List<LauncherItem>());
|
LauncherItems = new ObservableCollection<LauncherItem>(Config.Items ?? new List<LauncherItem>());
|
||||||
|
|
||||||
// 注意:不再根据配置更改插件启用状态
|
// 注意:不再根据配置更改插件启用状态
|
||||||
// 插件状态由PluginManager统一管理
|
// 插件状态由PluginManager统一管理
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LauncherItems = new ObservableCollection<LauncherItem>(Config.Items);
|
LauncherItems = new ObservableCollection<LauncherItem>(Config.Items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存配置
|
/// 保存配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -245,19 +245,19 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
{
|
{
|
||||||
// 同步LauncherItems到Config
|
// 同步LauncherItems到Config
|
||||||
Config.Items = new List<LauncherItem>(LauncherItems);
|
Config.Items = new List<LauncherItem>(LauncherItems);
|
||||||
|
|
||||||
// 序列化并保存配置
|
// 序列化并保存配置
|
||||||
string json = JsonConvert.SerializeObject(Config, Formatting.Indented);
|
string json = JsonConvert.SerializeObject(Config, Formatting.Indented);
|
||||||
File.WriteAllText(_configPath, json);
|
File.WriteAllText(_configPath, json);
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("超级启动台配置已保存", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("超级启动台配置已保存");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"保存超级启动台配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"保存超级启动台配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建默认配置
|
/// 创建默认配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -278,14 +278,14 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 启动台按钮管理
|
#region 启动台按钮管理
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 将启动台按钮添加到浮动栏
|
/// 将启动台按钮添加到浮动栏
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -299,7 +299,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
RemoveLauncherButtonFromFloatingBar();
|
RemoveLauncherButtonFromFloatingBar();
|
||||||
_isAddedToFloatingBar = false;
|
_isAddedToFloatingBar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取主窗口实例
|
// 获取主窗口实例
|
||||||
var mainWindow = Application.Current.MainWindow;
|
var mainWindow = Application.Current.MainWindow;
|
||||||
if (mainWindow == null)
|
if (mainWindow == null)
|
||||||
@@ -307,11 +307,11 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.WriteLogToFile("未找到主窗口实例,无法添加启动台按钮", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile("未找到主窗口实例,无法添加启动台按钮", LogHelper.LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建启动台按钮
|
// 创建启动台按钮
|
||||||
_launcherButton = new LauncherButton(this);
|
_launcherButton = new LauncherButton(this);
|
||||||
var buttonElement = _launcherButton.Element;
|
var buttonElement = _launcherButton.Element;
|
||||||
|
|
||||||
// 查找浮动栏
|
// 查找浮动栏
|
||||||
var floatingBar = mainWindow.FindName("StackPanelFloatingBar") as Panel;
|
var floatingBar = mainWindow.FindName("StackPanelFloatingBar") as Panel;
|
||||||
if (floatingBar == null)
|
if (floatingBar == null)
|
||||||
@@ -321,25 +321,25 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
FindStackPanelFloatingBar(mainWindow, ref floatingBarPanelFromTree);
|
FindStackPanelFloatingBar(mainWindow, ref floatingBarPanelFromTree);
|
||||||
floatingBar = floatingBarPanelFromTree;
|
floatingBar = floatingBarPanelFromTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floatingBar == null)
|
if (floatingBar == null)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile("未找到浮动栏,无法添加启动台按钮", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile("未找到浮动栏,无法添加启动台按钮", LogHelper.LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加启动台按钮到浮动栏
|
// 添加启动台按钮到浮动栏
|
||||||
if (Config.ButtonPosition == LauncherButtonPosition.Left)
|
if (Config.ButtonPosition == LauncherButtonPosition.Left)
|
||||||
{
|
{
|
||||||
floatingBar.Children.Insert(0, buttonElement);
|
floatingBar.Children.Insert(0, buttonElement);
|
||||||
LogHelper.WriteLogToFile("启动台按钮已添加到浮动栏左侧", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("启动台按钮已添加到浮动栏左侧");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
floatingBar.Children.Add(buttonElement);
|
floatingBar.Children.Add(buttonElement);
|
||||||
LogHelper.WriteLogToFile("启动台按钮已添加到浮动栏右侧", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("启动台按钮已添加到浮动栏右侧");
|
||||||
}
|
}
|
||||||
|
|
||||||
_isAddedToFloatingBar = true;
|
_isAddedToFloatingBar = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -348,14 +348,14 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 递归查找StackPanelFloatingBar
|
/// 递归查找StackPanelFloatingBar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void FindStackPanelFloatingBar(DependencyObject parent, ref Panel result)
|
private void FindStackPanelFloatingBar(DependencyObject parent, ref Panel result)
|
||||||
{
|
{
|
||||||
if (parent == null || result != null) return;
|
if (parent == null || result != null) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 检查当前对象是否为我们要找的面板
|
// 检查当前对象是否为我们要找的面板
|
||||||
@@ -364,10 +364,10 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
result = panel;
|
result = panel;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取子元素数量
|
// 获取子元素数量
|
||||||
int childCount = VisualTreeHelper.GetChildrenCount(parent);
|
int childCount = VisualTreeHelper.GetChildrenCount(parent);
|
||||||
|
|
||||||
// 遍历所有子元素
|
// 遍历所有子元素
|
||||||
for (int i = 0; i < childCount; i++)
|
for (int i = 0; i < childCount; i++)
|
||||||
{
|
{
|
||||||
@@ -380,7 +380,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.WriteLogToFile($"查找StackPanelFloatingBar时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"查找StackPanelFloatingBar时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从浮动栏移除启动台按钮
|
/// 从浮动栏移除启动台按钮
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -392,7 +392,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取主窗口实例
|
// 获取主窗口实例
|
||||||
var mainWindow = Application.Current.MainWindow;
|
var mainWindow = Application.Current.MainWindow;
|
||||||
if (mainWindow == null)
|
if (mainWindow == null)
|
||||||
@@ -400,10 +400,10 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.WriteLogToFile("未找到主窗口实例,无法移除启动台按钮", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile("未找到主窗口实例,无法移除启动台按钮", LogHelper.LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取按钮元素
|
// 获取按钮元素
|
||||||
var buttonElement = _launcherButton.Element;
|
var buttonElement = _launcherButton.Element;
|
||||||
|
|
||||||
// 查找浮动栏
|
// 查找浮动栏
|
||||||
var floatingBar = mainWindow.FindName("StackPanelFloatingBar") as Panel;
|
var floatingBar = mainWindow.FindName("StackPanelFloatingBar") as Panel;
|
||||||
if (floatingBar == null)
|
if (floatingBar == null)
|
||||||
@@ -413,20 +413,20 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
FindStackPanelFloatingBar(mainWindow, ref floatingBarPanelFromTree);
|
FindStackPanelFloatingBar(mainWindow, ref floatingBarPanelFromTree);
|
||||||
floatingBar = floatingBarPanelFromTree;
|
floatingBar = floatingBarPanelFromTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floatingBar == null)
|
if (floatingBar == null)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile("未找到浮动栏,无法移除启动台按钮", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile("未找到浮动栏,无法移除启动台按钮", LogHelper.LogType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从浮动栏移除启动台按钮
|
// 从浮动栏移除启动台按钮
|
||||||
if (floatingBar.Children.Contains(buttonElement))
|
if (floatingBar.Children.Contains(buttonElement))
|
||||||
{
|
{
|
||||||
floatingBar.Children.Remove(buttonElement);
|
floatingBar.Children.Remove(buttonElement);
|
||||||
LogHelper.WriteLogToFile("启动台按钮已从浮动栏移除", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile("启动台按钮已从浮动栏移除");
|
||||||
}
|
}
|
||||||
|
|
||||||
_isAddedToFloatingBar = false;
|
_isAddedToFloatingBar = false;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -435,7 +435,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新启动台按钮位置
|
/// 更新启动台按钮位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -448,7 +448,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
{
|
{
|
||||||
RemoveLauncherButtonFromFloatingBar();
|
RemoveLauncherButtonFromFloatingBar();
|
||||||
AddLauncherButtonToFloatingBar();
|
AddLauncherButtonToFloatingBar();
|
||||||
LogHelper.WriteLogToFile($"启动台按钮位置已更新为: {Config.ButtonPosition}", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"启动台按钮位置已更新为: {Config.ButtonPosition}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -457,11 +457,11 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.NewLog(ex);
|
LogHelper.NewLog(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 启动台功能
|
#region 启动台功能
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示启动台窗口
|
/// 显示启动台窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -477,13 +477,13 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
_launcherWindow = null;
|
_launcherWindow = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建新的启动台窗口
|
// 创建新的启动台窗口
|
||||||
_launcherWindow = new LauncherWindow(this);
|
_launcherWindow = new LauncherWindow(this);
|
||||||
|
|
||||||
// 计算窗口位置,使其位于按钮上方
|
// 计算窗口位置,使其位于按钮上方
|
||||||
PositionLauncherWindow(_launcherWindow, buttonPosition);
|
PositionLauncherWindow(_launcherWindow, buttonPosition);
|
||||||
|
|
||||||
// 显示窗口
|
// 显示窗口
|
||||||
_launcherWindow.Show();
|
_launcherWindow.Show();
|
||||||
}
|
}
|
||||||
@@ -492,7 +492,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
LogHelper.WriteLogToFile($"显示启动台窗口时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"显示启动台窗口时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置启动台窗口位置
|
/// 设置启动台窗口位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -504,18 +504,18 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
if (window.ActualWidth == 0 || window.ActualHeight == 0)
|
if (window.ActualWidth == 0 || window.ActualHeight == 0)
|
||||||
{
|
{
|
||||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
|
||||||
// 设置窗口加载完成后的位置
|
// 设置窗口加载完成后的位置
|
||||||
window.Loaded += (s, e) =>
|
window.Loaded += (s, e) =>
|
||||||
{
|
{
|
||||||
// 窗口位于按钮上方居中
|
// 窗口位于按钮上方居中
|
||||||
double left = buttonPosition.X - (window.ActualWidth / 2);
|
double left = buttonPosition.X - (window.ActualWidth / 2);
|
||||||
double top = buttonPosition.Y - window.ActualHeight - 10; // 在按钮上方留出一些间距
|
double top = buttonPosition.Y - window.ActualHeight - 10; // 在按钮上方留出一些间距
|
||||||
|
|
||||||
// 确保窗口在屏幕内
|
// 确保窗口在屏幕内
|
||||||
left = Math.Max(0, Math.Min(left, SystemParameters.WorkArea.Width - window.ActualWidth));
|
left = Math.Max(0, Math.Min(left, SystemParameters.WorkArea.Width - window.ActualWidth));
|
||||||
top = Math.Max(0, Math.Min(top, SystemParameters.WorkArea.Height - window.ActualHeight));
|
top = Math.Max(0, Math.Min(top, SystemParameters.WorkArea.Height - window.ActualHeight));
|
||||||
|
|
||||||
window.Left = left;
|
window.Left = left;
|
||||||
window.Top = top;
|
window.Top = top;
|
||||||
};
|
};
|
||||||
@@ -525,16 +525,16 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
// 窗口位于按钮上方居中
|
// 窗口位于按钮上方居中
|
||||||
double left = buttonPosition.X - (window.ActualWidth / 2);
|
double left = buttonPosition.X - (window.ActualWidth / 2);
|
||||||
double top = buttonPosition.Y - window.ActualHeight - 10; // 在按钮上方留出一些间距
|
double top = buttonPosition.Y - window.ActualHeight - 10; // 在按钮上方留出一些间距
|
||||||
|
|
||||||
// 确保窗口在屏幕内
|
// 确保窗口在屏幕内
|
||||||
left = Math.Max(0, Math.Min(left, SystemParameters.WorkArea.Width - window.ActualWidth));
|
left = Math.Max(0, Math.Min(left, SystemParameters.WorkArea.Width - window.ActualWidth));
|
||||||
top = Math.Max(0, Math.Min(top, SystemParameters.WorkArea.Height - window.ActualHeight));
|
top = Math.Max(0, Math.Min(top, SystemParameters.WorkArea.Height - window.ActualHeight));
|
||||||
|
|
||||||
window.Left = left;
|
window.Left = left;
|
||||||
window.Top = top;
|
window.Top = top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加应用到启动台
|
/// 添加应用到启动台
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -547,18 +547,18 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
MessageBox.Show("启动台项目数量已达上限(40个)!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("启动台项目数量已达上限(40个)!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 寻找合适的位置
|
// 寻找合适的位置
|
||||||
if (item.Position < 0)
|
if (item.Position < 0)
|
||||||
{
|
{
|
||||||
item.Position = FindNextAvailablePosition();
|
item.Position = FindNextAvailablePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加项目并保存配置
|
// 添加项目并保存配置
|
||||||
LauncherItems.Add(item);
|
LauncherItems.Add(item);
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找下一个可用位置
|
/// 查找下一个可用位置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -570,7 +570,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
{
|
{
|
||||||
usedPositions.Add(item.Position);
|
usedPositions.Add(item.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找第一个可用位置
|
// 查找第一个可用位置
|
||||||
for (int i = 0; i < 40; i++)
|
for (int i = 0; i < 40; i++)
|
||||||
{
|
{
|
||||||
@@ -579,11 +579,11 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果所有位置都已使用,则返回0
|
// 如果所有位置都已使用,则返回0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 增强的插件基类,提供对插件服务的访问和基本实现
|
||||||
|
/// </summary>
|
||||||
|
public abstract class EnhancedPluginBase : PluginBase, IEnhancedPlugin
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 插件服务实例
|
||||||
|
/// </summary>
|
||||||
|
public IPluginService PluginService { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
protected EnhancedPluginBase()
|
||||||
|
{
|
||||||
|
PluginService = PluginServiceManager.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件启动时调用,在Initialize之后
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnStartup()
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"插件 {Name} 已启动");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件关闭时调用,在Cleanup之前
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnShutdown()
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"插件 {Name} 正在关闭");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的菜单项
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>菜单项集合</returns>
|
||||||
|
public virtual MenuItem[] GetMenuItems()
|
||||||
|
{
|
||||||
|
return new MenuItem[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的工具栏按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>工具栏按钮集合</returns>
|
||||||
|
public virtual Button[] GetToolbarButtons()
|
||||||
|
{
|
||||||
|
return new Button[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的状态栏信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>状态栏信息</returns>
|
||||||
|
public virtual string GetStatusBarInfo()
|
||||||
|
{
|
||||||
|
return $"{Name} v{Version} - {(IsEnabled ? "已启用" : "已禁用")}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件配置变更时调用
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnConfigurationChanged()
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"插件 {Name} 配置已变更");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写初始化方法,调用OnStartup
|
||||||
|
/// </summary>
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
OnStartup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写清理方法,调用OnShutdown
|
||||||
|
/// </summary>
|
||||||
|
public override void Cleanup()
|
||||||
|
{
|
||||||
|
OnShutdown();
|
||||||
|
base.Cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 增强的插件基类 V2,提供对三个专门服务接口的访问
|
||||||
|
/// 插件开发者可以根据需要选择性地使用这些服务
|
||||||
|
/// </summary>
|
||||||
|
public abstract class EnhancedPluginBaseV2 : PluginBase, IEnhancedPlugin
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取服务实例
|
||||||
|
/// </summary>
|
||||||
|
public IGetService GetService { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗口服务实例
|
||||||
|
/// </summary>
|
||||||
|
public IWindowService WindowService { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作服务实例
|
||||||
|
/// </summary>
|
||||||
|
public IActionService ActionService { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件服务实例(兼容性)
|
||||||
|
/// </summary>
|
||||||
|
public IPluginService PluginService { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
protected EnhancedPluginBaseV2()
|
||||||
|
{
|
||||||
|
// 初始化所有服务实例
|
||||||
|
PluginService = PluginServiceManager.Instance;
|
||||||
|
GetService = PluginServiceManager.Instance;
|
||||||
|
WindowService = PluginServiceManager.Instance;
|
||||||
|
ActionService = PluginServiceManager.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件启动时调用,在Initialize之后
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnStartup()
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"插件 {Name} 已启动");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件关闭时调用,在Cleanup之前
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnShutdown()
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"插件 {Name} 正在关闭");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的菜单项
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>菜单项集合</returns>
|
||||||
|
public virtual MenuItem[] GetMenuItems()
|
||||||
|
{
|
||||||
|
return new MenuItem[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的工具栏按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>工具栏按钮集合</returns>
|
||||||
|
public virtual Button[] GetToolbarButtons()
|
||||||
|
{
|
||||||
|
return new Button[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的状态栏信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>状态栏信息</returns>
|
||||||
|
public virtual string GetStatusBarInfo()
|
||||||
|
{
|
||||||
|
return $"{Name} v{Version} - {(IsEnabled ? "已启用" : "已禁用")}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件配置变更时调用
|
||||||
|
/// </summary>
|
||||||
|
public virtual void OnConfigurationChanged()
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"插件 {Name} 配置已变更");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 便捷方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示通知消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">消息内容</param>
|
||||||
|
/// <param name="type">消息类型</param>
|
||||||
|
protected void ShowNotification(string message, NotificationType type = NotificationType.Info)
|
||||||
|
{
|
||||||
|
WindowService.ShowNotification(message, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示确认对话框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">消息内容</param>
|
||||||
|
/// <param name="title">标题</param>
|
||||||
|
/// <returns>用户选择结果</returns>
|
||||||
|
protected bool ShowConfirmDialog(string message, string title = "确认")
|
||||||
|
{
|
||||||
|
return WindowService.ShowConfirmDialog(message, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示输入对话框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">提示消息</param>
|
||||||
|
/// <param name="title">标题</param>
|
||||||
|
/// <param name="defaultValue">默认值</param>
|
||||||
|
/// <returns>用户输入内容</returns>
|
||||||
|
protected string ShowInputDialog(string message, string title = "输入", string defaultValue = "")
|
||||||
|
{
|
||||||
|
return WindowService.ShowInputDialog(message, title, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取系统设置
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">设置类型</typeparam>
|
||||||
|
/// <param name="key">设置键</param>
|
||||||
|
/// <param name="defaultValue">默认值</param>
|
||||||
|
/// <returns>设置值</returns>
|
||||||
|
protected T GetSetting<T>(string key, T defaultValue = default(T))
|
||||||
|
{
|
||||||
|
return GetService.GetSetting(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置系统设置
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">设置类型</typeparam>
|
||||||
|
/// <param name="key">设置键</param>
|
||||||
|
/// <param name="value">设置值</param>
|
||||||
|
protected void SetSetting<T>(string key, T value)
|
||||||
|
{
|
||||||
|
ActionService.SetSetting(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存设置
|
||||||
|
/// </summary>
|
||||||
|
protected void SaveSettings()
|
||||||
|
{
|
||||||
|
ActionService.SaveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除当前画布
|
||||||
|
/// </summary>
|
||||||
|
protected void ClearCanvas()
|
||||||
|
{
|
||||||
|
ActionService.ClearCanvas();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 撤销操作
|
||||||
|
/// </summary>
|
||||||
|
protected void Undo()
|
||||||
|
{
|
||||||
|
ActionService.Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重做操作
|
||||||
|
/// </summary>
|
||||||
|
protected void Redo()
|
||||||
|
{
|
||||||
|
ActionService.Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否可以撤销
|
||||||
|
/// </summary>
|
||||||
|
protected bool CanUndo => GetService.CanUndo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否可以重做
|
||||||
|
/// </summary>
|
||||||
|
protected bool CanRedo => GetService.CanRedo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前绘制模式
|
||||||
|
/// </summary>
|
||||||
|
protected int CurrentDrawingMode => GetService.CurrentDrawingMode;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绘制模式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mode">绘制模式</param>
|
||||||
|
protected void SetDrawingMode(int mode)
|
||||||
|
{
|
||||||
|
ActionService.SetDrawingMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册事件处理器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName">事件名称</param>
|
||||||
|
/// <param name="handler">事件处理器</param>
|
||||||
|
protected void RegisterEventHandler(string eventName, System.EventHandler handler)
|
||||||
|
{
|
||||||
|
ActionService.RegisterEventHandler(eventName, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注销事件处理器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName">事件名称</param>
|
||||||
|
/// <param name="handler">事件处理器</param>
|
||||||
|
protected void UnregisterEventHandler(string eventName, System.EventHandler handler)
|
||||||
|
{
|
||||||
|
ActionService.UnregisterEventHandler(eventName, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName">事件名称</param>
|
||||||
|
/// <param name="sender">事件发送者</param>
|
||||||
|
/// <param name="args">事件参数</param>
|
||||||
|
protected void TriggerEvent(string eventName, object sender, System.EventArgs args)
|
||||||
|
{
|
||||||
|
ActionService.TriggerEvent(eventName, sender, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 操作服务接口,统一所有执行操作相关的方法
|
||||||
|
/// </summary>
|
||||||
|
public interface IActionService
|
||||||
|
{
|
||||||
|
#region 画布操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除当前画布
|
||||||
|
/// </summary>
|
||||||
|
void ClearCanvas();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除所有画布
|
||||||
|
/// </summary>
|
||||||
|
void ClearAllCanvases();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加新页面
|
||||||
|
/// </summary>
|
||||||
|
void AddNewPage();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除当前页面
|
||||||
|
/// </summary>
|
||||||
|
void DeleteCurrentPage();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 切换到指定页面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pageIndex">页面索引</param>
|
||||||
|
void SwitchToPage(int pageIndex);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 切换到下一页
|
||||||
|
/// </summary>
|
||||||
|
void NextPage();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 切换到上一页
|
||||||
|
/// </summary>
|
||||||
|
void PreviousPage();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 绘制操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绘制模式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mode">绘制模式</param>
|
||||||
|
void SetDrawingMode(int mode);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置笔触宽度
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">宽度</param>
|
||||||
|
void SetInkWidth(double width);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置笔触颜色
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="color">颜色</param>
|
||||||
|
void SetInkColor(Color color);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置高亮笔宽度
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">宽度</param>
|
||||||
|
void SetHighlighterWidth(double width);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置橡皮擦大小
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="size">大小</param>
|
||||||
|
void SetEraserSize(int size);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置橡皮擦类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
void SetEraserType(int type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置橡皮擦形状
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shape">形状</param>
|
||||||
|
void SetEraserShape(int shape);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置笔触透明度
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="alpha">透明度</param>
|
||||||
|
void SetInkAlpha(double alpha);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置笔触样式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="style">样式</param>
|
||||||
|
void SetInkStyle(int style);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置背景颜色
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="color">颜色</param>
|
||||||
|
void SetBackgroundColor(string color);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 文件操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存画布内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径</param>
|
||||||
|
void SaveCanvas(string filePath);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载画布内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径</param>
|
||||||
|
void LoadCanvas(string filePath);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出为图片
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径</param>
|
||||||
|
/// <param name="format">图片格式</param>
|
||||||
|
void ExportAsImage(string filePath, string format);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出为PDF
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath">文件路径</param>
|
||||||
|
void ExportAsPDF(string filePath);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 撤销重做操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 撤销操作
|
||||||
|
/// </summary>
|
||||||
|
void Undo();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重做操作
|
||||||
|
/// </summary>
|
||||||
|
void Redo();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 选择操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 全选
|
||||||
|
/// </summary>
|
||||||
|
void SelectAll();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取消选择
|
||||||
|
/// </summary>
|
||||||
|
void DeselectAll();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除选中内容
|
||||||
|
/// </summary>
|
||||||
|
void DeleteSelected();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复制选中内容
|
||||||
|
/// </summary>
|
||||||
|
void CopySelected();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 剪切选中内容
|
||||||
|
/// </summary>
|
||||||
|
void CutSelected();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 粘贴内容
|
||||||
|
/// </summary>
|
||||||
|
void Paste();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 系统设置操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置系统设置
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">设置类型</typeparam>
|
||||||
|
/// <param name="key">设置键</param>
|
||||||
|
/// <param name="value">设置值</param>
|
||||||
|
void SetSetting<T>(string key, T value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存设置到文件
|
||||||
|
/// </summary>
|
||||||
|
void SaveSettings();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从文件加载设置
|
||||||
|
/// </summary>
|
||||||
|
void LoadSettings();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重置设置为默认值
|
||||||
|
/// </summary>
|
||||||
|
void ResetSettings();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 插件管理操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用插件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
void EnablePlugin(string pluginName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁用插件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
void DisablePlugin(string pluginName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 卸载插件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
void UnloadPlugin(string pluginName);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 事件系统操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册事件处理器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName">事件名称</param>
|
||||||
|
/// <param name="handler">事件处理器</param>
|
||||||
|
void RegisterEventHandler(string eventName, EventHandler handler);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注销事件处理器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName">事件名称</param>
|
||||||
|
/// <param name="handler">事件处理器</param>
|
||||||
|
void UnregisterEventHandler(string eventName, EventHandler handler);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName">事件名称</param>
|
||||||
|
/// <param name="sender">事件发送者</param>
|
||||||
|
/// <param name="args">事件参数</param>
|
||||||
|
void TriggerEvent(string eventName, object sender, EventArgs args);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 应用程序操作
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重启应用程序
|
||||||
|
/// </summary>
|
||||||
|
void RestartApplication();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 退出应用程序
|
||||||
|
/// </summary>
|
||||||
|
void ExitApplication();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查更新
|
||||||
|
/// </summary>
|
||||||
|
void CheckForUpdates();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开帮助文档
|
||||||
|
/// </summary>
|
||||||
|
void OpenHelpDocument();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开关于页面
|
||||||
|
/// </summary>
|
||||||
|
void OpenAboutPage();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
private readonly string _pluginPath;
|
private readonly string _pluginPath;
|
||||||
private readonly string _pluginName;
|
private readonly string _pluginName;
|
||||||
private readonly Version _pluginVersion;
|
private readonly Version _pluginVersion;
|
||||||
private bool _isInitialized = false;
|
private bool _isInitialized;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建 ICCPP 插件适配器
|
/// 创建 ICCPP 插件适配器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -24,11 +24,11 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
_pluginPath = pluginPath;
|
_pluginPath = pluginPath;
|
||||||
_pluginData = pluginData;
|
_pluginData = pluginData;
|
||||||
PluginPath = pluginPath;
|
PluginPath = pluginPath;
|
||||||
|
|
||||||
// 从文件名获取插件名称
|
// 从文件名获取插件名称
|
||||||
_pluginName = Path.GetFileNameWithoutExtension(pluginPath);
|
_pluginName = Path.GetFileNameWithoutExtension(pluginPath);
|
||||||
_pluginVersion = new Version(1, 0, 0); // 默认版本
|
_pluginVersion = new Version(1, 0, 0); // 默认版本
|
||||||
|
|
||||||
// 尝试从插件数据中读取更多信息
|
// 尝试从插件数据中读取更多信息
|
||||||
TryReadPluginMetadata();
|
TryReadPluginMetadata();
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
_pluginVersion = new Version(1, 0, 0);
|
_pluginVersion = new Version(1, 0, 0);
|
||||||
// 可选:初始化其他字段
|
// 可选:初始化其他字段
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 尝试从插件数据中读取元数据
|
/// 尝试从插件数据中读取元数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -52,7 +52,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
{
|
{
|
||||||
// 这里可以根据 .iccpp 文件的实际格式解析元数据
|
// 这里可以根据 .iccpp 文件的实际格式解析元数据
|
||||||
// 例如,如果文件有特定的头部结构,可以在这里解析
|
// 例如,如果文件有特定的头部结构,可以在这里解析
|
||||||
|
|
||||||
// 示例:如果前100字节包含元数据
|
// 示例:如果前100字节包含元数据
|
||||||
if (_pluginData.Length > 100)
|
if (_pluginData.Length > 100)
|
||||||
{
|
{
|
||||||
@@ -64,47 +64,47 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
LogHelper.WriteLogToFile($"解析插件 {_pluginName} 元数据时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"解析插件 {_pluginName} 元数据时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IPlugin 接口实现
|
#region IPlugin 接口实现
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件名称
|
/// 插件名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Name => _pluginName;
|
public override string Name => _pluginName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件描述
|
/// 插件描述
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Description => $"{_pluginName} (ICCPP 格式插件)";
|
public override string Description => $"{_pluginName} (ICCPP 格式插件)";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件版本
|
/// 插件版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override Version Version => _pluginVersion;
|
public override Version Version => _pluginVersion;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件作者
|
/// 插件作者
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Author => "未知";
|
public override string Author => "未知";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否为内置插件
|
/// 是否为内置插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override bool IsBuiltIn => false;
|
public override bool IsBuiltIn => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化插件
|
/// 初始化插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
if (_isInitialized) return;
|
if (_isInitialized) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 这里可以添加 .iccpp 插件的初始化逻辑
|
// 这里可以添加 .iccpp 插件的初始化逻辑
|
||||||
// 例如,根据文件格式加载特定资源
|
// 例如,根据文件格式加载特定资源
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已初始化", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已初始化");
|
||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -112,49 +112,49 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
LogHelper.WriteLogToFile($"初始化 ICCPP 插件 {Name} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"初始化 ICCPP 插件 {Name} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用插件
|
/// 启用插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
if (IsEnabled) return;
|
if (IsEnabled) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 这里可以添加 .iccpp 插件的启用逻辑
|
// 这里可以添加 .iccpp 插件的启用逻辑
|
||||||
// 例如,加载动态库、注册事件等
|
// 例如,加载动态库、注册事件等
|
||||||
|
|
||||||
base.Enable(); // 设置启用状态并触发事件
|
base.Enable(); // 设置启用状态并触发事件
|
||||||
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已启用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已启用");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"启用 ICCPP 插件 {Name} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"启用 ICCPP 插件 {Name} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 禁用插件
|
/// 禁用插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (!IsEnabled) return;
|
if (!IsEnabled) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 这里可以添加 .iccpp 插件的禁用逻辑
|
// 这里可以添加 .iccpp 插件的禁用逻辑
|
||||||
// 例如,卸载动态库、注销事件等
|
// 例如,卸载动态库、注销事件等
|
||||||
|
|
||||||
base.Disable(); // 设置禁用状态并触发事件
|
base.Disable(); // 设置禁用状态并触发事件
|
||||||
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已禁用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已禁用");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"禁用 ICCPP 插件 {Name} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"禁用 ICCPP 插件 {Name} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清理插件资源
|
/// 清理插件资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -164,15 +164,15 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
{
|
{
|
||||||
// 这里可以添加 .iccpp 插件的清理逻辑
|
// 这里可以添加 .iccpp 插件的清理逻辑
|
||||||
// 例如,释放资源等
|
// 例如,释放资源等
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已清理资源", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"ICCPP 插件 {Name} 已清理资源");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"清理 ICCPP 插件 {Name} 资源时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"清理 ICCPP 插件 {Name} 资源时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 增强的插件接口,提供对插件服务的访问
|
||||||
|
/// </summary>
|
||||||
|
public interface IEnhancedPlugin : IPlugin
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件服务实例
|
||||||
|
/// </summary>
|
||||||
|
IPluginService PluginService { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件启动时调用,在Initialize之后
|
||||||
|
/// </summary>
|
||||||
|
void OnStartup();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件关闭时调用,在Cleanup之前
|
||||||
|
/// </summary>
|
||||||
|
void OnShutdown();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的菜单项
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>菜单项集合</returns>
|
||||||
|
MenuItem[] GetMenuItems();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的工具栏按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>工具栏按钮集合</returns>
|
||||||
|
Button[] GetToolbarButtons();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的状态栏信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>状态栏信息</returns>
|
||||||
|
string GetStatusBarInfo();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 插件配置变更时调用
|
||||||
|
/// </summary>
|
||||||
|
void OnConfigurationChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取服务接口,统一所有获取类的方法
|
||||||
|
/// </summary>
|
||||||
|
public interface IGetService
|
||||||
|
{
|
||||||
|
#region 窗口和UI获取
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取主窗口引用
|
||||||
|
/// </summary>
|
||||||
|
Window MainWindow { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前画布
|
||||||
|
/// </summary>
|
||||||
|
InkCanvas CurrentCanvas { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有画布页面
|
||||||
|
/// </summary>
|
||||||
|
List<Canvas> AllCanvasPages { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前页面索引
|
||||||
|
/// </summary>
|
||||||
|
int CurrentPageIndex { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前页面数量
|
||||||
|
/// </summary>
|
||||||
|
int TotalPageCount { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取浮动工具栏
|
||||||
|
/// </summary>
|
||||||
|
FrameworkElement FloatingToolBar { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取左侧面板
|
||||||
|
/// </summary>
|
||||||
|
FrameworkElement LeftPanel { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取右侧面板
|
||||||
|
/// </summary>
|
||||||
|
FrameworkElement RightPanel { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取顶部面板
|
||||||
|
/// </summary>
|
||||||
|
FrameworkElement TopPanel { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取底部面板
|
||||||
|
/// </summary>
|
||||||
|
FrameworkElement BottomPanel { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 绘制工具状态获取
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前绘制模式
|
||||||
|
/// </summary>
|
||||||
|
int CurrentDrawingMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前笔触宽度
|
||||||
|
/// </summary>
|
||||||
|
double CurrentInkWidth { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前笔触颜色
|
||||||
|
/// </summary>
|
||||||
|
Color CurrentInkColor { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前高亮笔宽度
|
||||||
|
/// </summary>
|
||||||
|
double CurrentHighlighterWidth { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前橡皮擦大小
|
||||||
|
/// </summary>
|
||||||
|
int CurrentEraserSize { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前橡皮擦类型
|
||||||
|
/// </summary>
|
||||||
|
int CurrentEraserType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前橡皮擦形状
|
||||||
|
/// </summary>
|
||||||
|
int CurrentEraserShape { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前笔触透明度
|
||||||
|
/// </summary>
|
||||||
|
double CurrentInkAlpha { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前笔触样式
|
||||||
|
/// </summary>
|
||||||
|
int CurrentInkStyle { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前背景颜色
|
||||||
|
/// </summary>
|
||||||
|
string CurrentBackgroundColor { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 应用状态获取
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前主题模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsDarkTheme { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为白板模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsWhiteboardMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为PPT模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsPPTMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为全屏模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsFullScreenMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为画板模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsCanvasMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为选择模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsSelectionMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为擦除模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsEraserMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为形状绘制模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsShapeDrawingMode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前是否为高亮模式
|
||||||
|
/// </summary>
|
||||||
|
bool IsHighlighterMode { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 撤销重做状态获取
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取是否可以撤销
|
||||||
|
/// </summary>
|
||||||
|
bool CanUndo { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取是否可以重做
|
||||||
|
/// </summary>
|
||||||
|
bool CanRedo { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 系统设置获取
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取系统设置
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">设置类型</typeparam>
|
||||||
|
/// <param name="key">设置键</param>
|
||||||
|
/// <param name="defaultValue">默认值</param>
|
||||||
|
/// <returns>设置值</returns>
|
||||||
|
T GetSetting<T>(string key, T defaultValue = default(T));
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 插件信息获取
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有已加载的插件
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>插件列表</returns>
|
||||||
|
List<IPlugin> GetAllPlugins();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定插件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
/// <returns>插件实例</returns>
|
||||||
|
IPlugin GetPlugin(string pluginName);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,56 +12,56 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
/// 插件名称
|
/// 插件名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件描述
|
/// 插件描述
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Description { get; }
|
string Description { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件版本
|
/// 插件版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Version Version { get; }
|
Version Version { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件作者
|
/// 插件作者
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Author { get; }
|
string Author { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否为内置插件
|
/// 是否为内置插件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsBuiltIn { get; }
|
bool IsBuiltIn { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化插件
|
/// 初始化插件
|
||||||
/// 此方法在插件加载时被调用,用于执行一些初始化工作
|
/// 此方法在插件加载时被调用,用于执行一些初始化工作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用插件
|
/// 启用插件
|
||||||
/// 此方法在插件被用户或系统启用时调用,激活插件功能
|
/// 此方法在插件被用户或系统启用时调用,激活插件功能
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Enable();
|
void Enable();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 禁用插件
|
/// 禁用插件
|
||||||
/// 此方法在插件被用户或系统禁用时调用,停用插件功能
|
/// 此方法在插件被用户或系统禁用时调用,停用插件功能
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Disable();
|
void Disable();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取插件设置界面
|
/// 获取插件设置界面
|
||||||
/// 此方法返回插件的设置界面控件,用于展示在设置窗口
|
/// 此方法返回插件的设置界面控件,用于展示在设置窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>插件设置界面</returns>
|
/// <returns>插件设置界面</returns>
|
||||||
UserControl GetSettingsView();
|
UserControl GetSettingsView();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件卸载时的清理工作
|
/// 插件卸载时的清理工作
|
||||||
/// 此方法在插件被卸载前调用,用于释放资源和执行清理
|
/// 此方法在插件被卸载前调用,用于释放资源和执行清理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 插件服务接口,提供对软件内部功能的访问
|
||||||
|
/// 继承自三个专门的服务接口:获取服务、窗口服务、操作服务
|
||||||
|
/// </summary>
|
||||||
|
public interface IPluginService : IGetService, IWindowService, IActionService
|
||||||
|
{
|
||||||
|
// 这个接口现在继承自三个专门的服务接口
|
||||||
|
// 所有方法都在子接口中定义,这里不需要重复定义
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通知类型枚举
|
||||||
|
/// </summary>
|
||||||
|
public enum NotificationType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 信息
|
||||||
|
/// </summary>
|
||||||
|
Info,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成功
|
||||||
|
/// </summary>
|
||||||
|
Success,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 警告
|
||||||
|
/// </summary>
|
||||||
|
Warning,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 错误
|
||||||
|
/// </summary>
|
||||||
|
Error
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 窗口服务接口,统一所有窗口操作相关的方法
|
||||||
|
/// </summary>
|
||||||
|
public interface IWindowService
|
||||||
|
{
|
||||||
|
#region 窗口显示和隐藏
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示设置窗口
|
||||||
|
/// </summary>
|
||||||
|
void ShowSettingsWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏设置窗口
|
||||||
|
/// </summary>
|
||||||
|
void HideSettingsWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示插件设置窗口
|
||||||
|
/// </summary>
|
||||||
|
void ShowPluginSettingsWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏插件设置窗口
|
||||||
|
/// </summary>
|
||||||
|
void HidePluginSettingsWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示帮助窗口
|
||||||
|
/// </summary>
|
||||||
|
void ShowHelpWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏帮助窗口
|
||||||
|
/// </summary>
|
||||||
|
void HideHelpWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示关于窗口
|
||||||
|
/// </summary>
|
||||||
|
void ShowAboutWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 隐藏关于窗口
|
||||||
|
/// </summary>
|
||||||
|
void HideAboutWindow();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 对话框和通知
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示通知消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">消息内容</param>
|
||||||
|
/// <param name="type">消息类型</param>
|
||||||
|
void ShowNotification(string message, NotificationType type = NotificationType.Info);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示确认对话框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">消息内容</param>
|
||||||
|
/// <param name="title">标题</param>
|
||||||
|
/// <returns>用户选择结果</returns>
|
||||||
|
bool ShowConfirmDialog(string message, string title = "确认");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示输入对话框
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">提示消息</param>
|
||||||
|
/// <param name="title">标题</param>
|
||||||
|
/// <param name="defaultValue">默认值</param>
|
||||||
|
/// <returns>用户输入内容</returns>
|
||||||
|
string ShowInputDialog(string message, string title = "输入", string defaultValue = "");
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 窗口状态控制
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置窗口全屏状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isFullScreen">是否全屏</param>
|
||||||
|
void SetFullScreen(bool isFullScreen);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置窗口置顶状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isTopMost">是否置顶</param>
|
||||||
|
void SetTopMost(bool isTopMost);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置窗口可见性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isVisible">是否可见</param>
|
||||||
|
void SetWindowVisibility(bool isVisible);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最小化窗口
|
||||||
|
/// </summary>
|
||||||
|
void MinimizeWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最大化窗口
|
||||||
|
/// </summary>
|
||||||
|
void MaximizeWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 恢复窗口
|
||||||
|
/// </summary>
|
||||||
|
void RestoreWindow();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 关闭窗口
|
||||||
|
/// </summary>
|
||||||
|
void CloseWindow();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 窗口位置和大小
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置窗口位置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">X坐标</param>
|
||||||
|
/// <param name="y">Y坐标</param>
|
||||||
|
void SetWindowPosition(double x, double y);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置窗口大小
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">宽度</param>
|
||||||
|
/// <param name="height">高度</param>
|
||||||
|
void SetWindowSize(double width, double height);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取窗口位置
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>窗口位置</returns>
|
||||||
|
(double x, double y) GetWindowPosition();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取窗口大小
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>窗口大小</returns>
|
||||||
|
(double width, double height) GetWindowSize();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,12 +11,12 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件状态(私有字段)
|
/// 插件状态(私有字段)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _isEnabled = false;
|
private bool _isEnabled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件状态(公共属性)
|
/// 插件状态(公共属性)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsEnabled
|
public bool IsEnabled
|
||||||
{
|
{
|
||||||
get => _isEnabled;
|
get => _isEnabled;
|
||||||
protected set
|
protected set
|
||||||
@@ -28,12 +28,12 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件ID
|
/// 插件ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Id { get; protected set; }
|
public string Id { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插件路径
|
/// 插件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -75,13 +75,13 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
{
|
{
|
||||||
Id = GetType().FullName;
|
Id = GetType().FullName;
|
||||||
|
|
||||||
// 添加日志,记录插件名称
|
// 添加日志,记录插件名称
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string name = Name;
|
string name = Name;
|
||||||
LogHelper.WriteLogToFile($"初始化插件: ID={Id}, 名称={name ?? "未命名"}", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"初始化插件: ID={Id}, 名称={name ?? "未命名"}");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"警告: 插件 {Id} 的名称为空", LogHelper.LogType.Warning);
|
LogHelper.WriteLogToFile($"警告: 插件 {Id} 的名称为空", LogHelper.LogType.Warning);
|
||||||
@@ -91,8 +91,8 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"获取插件名称时出错: {ex.Message}", LogHelper.LogType.Error);
|
LogHelper.WriteLogToFile($"获取插件名称时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 已初始化", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 已初始化");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -103,7 +103,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
if (!IsEnabled)
|
if (!IsEnabled)
|
||||||
{
|
{
|
||||||
IsEnabled = true;
|
IsEnabled = true;
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 已启用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 已启用");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
if (IsEnabled)
|
if (IsEnabled)
|
||||||
{
|
{
|
||||||
IsEnabled = false;
|
IsEnabled = false;
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 已禁用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 已禁用");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,9 +134,9 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Cleanup()
|
public virtual void Cleanup()
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 已卸载", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 已卸载");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存插件自身的设置
|
/// 保存插件自身的设置
|
||||||
/// 注意:此方法仅用于保存插件的特定设置,不应影响插件启用/禁用状态
|
/// 注意:此方法仅用于保存插件的特定设置,不应影响插件启用/禁用状态
|
||||||
@@ -148,7 +148,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
// 子类可以重写此方法,将自身设置保存到配置文件中
|
// 子类可以重写此方法,将自身设置保存到配置文件中
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 设置已保存", LogHelper.LogType.Event);
|
LogHelper.WriteLogToFile($"插件 {Name} 设置已保存", LogHelper.LogType.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触发状态变更事件
|
/// 触发状态变更事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -158,4 +158,4 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
EnabledStateChanged?.Invoke(this, isEnabled);
|
EnabledStateChanged?.Invoke(this, isEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,273 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 插件配置管理器,允许插件管理自己的配置
|
||||||
|
/// </summary>
|
||||||
|
public class PluginConfigurationManager
|
||||||
|
{
|
||||||
|
private static readonly string PluginConfigDirectory = Path.Combine(App.RootPath, "PluginConfigs");
|
||||||
|
private static readonly Dictionary<string, Dictionary<string, object>> _pluginConfigs = new Dictionary<string, Dictionary<string, object>>();
|
||||||
|
private static readonly object _lockObject = new object();
|
||||||
|
|
||||||
|
static PluginConfigurationManager()
|
||||||
|
{
|
||||||
|
// 确保配置目录存在
|
||||||
|
if (!Directory.Exists(PluginConfigDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(PluginConfigDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件配置值
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">配置值类型</typeparam>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
/// <param name="key">配置键</param>
|
||||||
|
/// <param name="defaultValue">默认值</param>
|
||||||
|
/// <returns>配置值</returns>
|
||||||
|
public static T GetConfiguration<T>(string pluginName, string key, T defaultValue = default(T))
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_pluginConfigs.TryGetValue(pluginName, out var pluginConfig))
|
||||||
|
{
|
||||||
|
if (pluginConfig.TryGetValue(key, out var value))
|
||||||
|
{
|
||||||
|
if (value is T typedValue)
|
||||||
|
{
|
||||||
|
return typedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试类型转换
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (T)Convert.ChangeType(value, typeof(T));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"获取插件 {pluginName} 配置 {key} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置插件配置值
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">配置值类型</typeparam>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
/// <param name="key">配置键</param>
|
||||||
|
/// <param name="value">配置值</param>
|
||||||
|
public static void SetConfiguration<T>(string pluginName, string key, T value)
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_pluginConfigs.ContainsKey(pluginName))
|
||||||
|
{
|
||||||
|
_pluginConfigs[pluginName] = new Dictionary<string, object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
_pluginConfigs[pluginName][key] = value;
|
||||||
|
|
||||||
|
// 异步保存配置
|
||||||
|
Task.Run(() => SavePluginConfiguration(pluginName));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"设置插件 {pluginName} 配置 {key} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除插件配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
/// <param name="key">配置键</param>
|
||||||
|
public static void RemoveConfiguration(string pluginName, string key)
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_pluginConfigs.TryGetValue(pluginName, out var pluginConfig))
|
||||||
|
{
|
||||||
|
if (pluginConfig.Remove(key))
|
||||||
|
{
|
||||||
|
// 异步保存配置
|
||||||
|
Task.Run(() => SavePluginConfiguration(pluginName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"删除插件 {pluginName} 配置 {key} 时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插件的所有配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
/// <returns>配置字典</returns>
|
||||||
|
public static Dictionary<string, object> GetAllConfigurations(string pluginName)
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
if (_pluginConfigs.TryGetValue(pluginName, out var pluginConfig))
|
||||||
|
{
|
||||||
|
return new Dictionary<string, object>(pluginConfig);
|
||||||
|
}
|
||||||
|
return new Dictionary<string, object>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除插件的所有配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
public static void ClearAllConfigurations(string pluginName)
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_pluginConfigs.Remove(pluginName))
|
||||||
|
{
|
||||||
|
// 删除配置文件
|
||||||
|
string configFile = Path.Combine(PluginConfigDirectory, $"{pluginName}.json");
|
||||||
|
if (File.Exists(configFile))
|
||||||
|
{
|
||||||
|
File.Delete(configFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清除插件 {pluginName} 所有配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载插件配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
public static void LoadPluginConfiguration(string pluginName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string configFile = Path.Combine(PluginConfigDirectory, $"{pluginName}.json");
|
||||||
|
if (File.Exists(configFile))
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(configFile);
|
||||||
|
var config = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
|
||||||
|
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
_pluginConfigs[pluginName] = config ?? new Dictionary<string, object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile($"已加载插件 {pluginName} 的配置");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"加载插件 {pluginName} 配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存插件配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginName">插件名称</param>
|
||||||
|
private static void SavePluginConfiguration(string pluginName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Dictionary<string, object> pluginConfig;
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
if (!_pluginConfigs.TryGetValue(pluginName, out pluginConfig))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string configFile = Path.Combine(PluginConfigDirectory, $"{pluginName}.json");
|
||||||
|
string json = JsonConvert.SerializeObject(pluginConfig, Formatting.Indented);
|
||||||
|
File.WriteAllText(configFile, json);
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile($"已保存插件 {pluginName} 的配置");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存插件 {pluginName} 配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载所有插件的配置
|
||||||
|
/// </summary>
|
||||||
|
public static void LoadAllPluginConfigurations()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Directory.Exists(PluginConfigDirectory))
|
||||||
|
{
|
||||||
|
string[] configFiles = Directory.GetFiles(PluginConfigDirectory, "*.json");
|
||||||
|
foreach (string configFile in configFiles)
|
||||||
|
{
|
||||||
|
string pluginName = Path.GetFileNameWithoutExtension(configFile);
|
||||||
|
LoadPluginConfiguration(pluginName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"加载所有插件配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存所有插件的配置
|
||||||
|
/// </summary>
|
||||||
|
public static void SaveAllPluginConfigurations()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (_lockObject)
|
||||||
|
{
|
||||||
|
foreach (string pluginName in _pluginConfigs.Keys)
|
||||||
|
{
|
||||||
|
SavePluginConfiguration(pluginName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"保存所有插件配置时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,509 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers.Plugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 插件服务管理器,实现IPluginService接口,提供对软件内部功能的访问
|
||||||
|
/// </summary>
|
||||||
|
public class PluginServiceManager : IPluginService
|
||||||
|
{
|
||||||
|
private static PluginServiceManager _instance;
|
||||||
|
private MainWindow _mainWindow;
|
||||||
|
private Dictionary<string, EventHandler> _eventHandlers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单例实例
|
||||||
|
/// </summary>
|
||||||
|
public static PluginServiceManager Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = new PluginServiceManager();
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PluginServiceManager()
|
||||||
|
{
|
||||||
|
_eventHandlers = new Dictionary<string, EventHandler>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置主窗口引用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mainWindow">主窗口实例</param>
|
||||||
|
public void SetMainWindow(MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
_mainWindow = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 窗口和UI访问
|
||||||
|
|
||||||
|
public Window MainWindow => _mainWindow;
|
||||||
|
|
||||||
|
public InkCanvas CurrentCanvas => null; // 暂时返回null,避免访问权限问题
|
||||||
|
|
||||||
|
public List<Canvas> AllCanvasPages => new List<Canvas>(); // 暂时返回空列表
|
||||||
|
|
||||||
|
public int CurrentPageIndex => 0; // 暂时返回0
|
||||||
|
|
||||||
|
public int TotalPageCount => 0; // 暂时返回0
|
||||||
|
|
||||||
|
public FrameworkElement FloatingToolBar => _mainWindow?.ViewboxFloatingBar;
|
||||||
|
|
||||||
|
public FrameworkElement LeftPanel => _mainWindow?.BlackboardLeftSide;
|
||||||
|
|
||||||
|
public FrameworkElement RightPanel => _mainWindow?.BlackboardRightSide;
|
||||||
|
|
||||||
|
public FrameworkElement TopPanel => _mainWindow?.BorderTools;
|
||||||
|
|
||||||
|
public FrameworkElement BottomPanel => _mainWindow?.BorderSettings;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 绘制工具状态
|
||||||
|
|
||||||
|
public int CurrentDrawingMode => 0; // 暂时返回0
|
||||||
|
|
||||||
|
public double CurrentInkWidth => 2.5; // 暂时返回默认值
|
||||||
|
|
||||||
|
public Color CurrentInkColor => Colors.Black; // 暂时返回默认值
|
||||||
|
|
||||||
|
public double CurrentHighlighterWidth => 20.0; // 暂时返回默认值
|
||||||
|
|
||||||
|
public int CurrentEraserSize => 2; // 暂时返回默认值
|
||||||
|
|
||||||
|
public int CurrentEraserType => 0; // 暂时返回默认值
|
||||||
|
|
||||||
|
public int CurrentEraserShape => 0; // 暂时返回默认值
|
||||||
|
|
||||||
|
public double CurrentInkAlpha => 255.0; // 暂时返回默认值
|
||||||
|
|
||||||
|
public int CurrentInkStyle => 0; // 暂时返回默认值
|
||||||
|
|
||||||
|
public string CurrentBackgroundColor => "#162924"; // 暂时返回默认值
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 应用状态
|
||||||
|
|
||||||
|
public bool IsDarkTheme => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsWhiteboardMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsPPTMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsFullScreenMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsCanvasMode => true; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsSelectionMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsEraserMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsShapeDrawingMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool IsHighlighterMode => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IGetService 实现
|
||||||
|
|
||||||
|
public bool CanUndo => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public bool CanRedo => false; // 暂时返回默认值
|
||||||
|
|
||||||
|
public T GetSetting<T>(string key, T defaultValue = default(T))
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IPlugin> GetAllPlugins()
|
||||||
|
{
|
||||||
|
return new List<IPlugin>(PluginManager.Instance.Plugins);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPlugin GetPlugin(string pluginName)
|
||||||
|
{
|
||||||
|
return PluginManager.Instance.Plugins.FirstOrDefault(p => p.Name == pluginName);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IWindowService 实现
|
||||||
|
|
||||||
|
public void ShowSettingsWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideSettingsWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowPluginSettingsWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HidePluginSettingsWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowHelpWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideHelpWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowAboutWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideAboutWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowNotification(string message, NotificationType type = NotificationType.Info)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShowConfirmDialog(string message, string title = "确认")
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ShowInputDialog(string message, string title = "输入", string defaultValue = "")
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFullScreen(bool isFullScreen)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTopMost(bool isTopMost)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetWindowVisibility(bool isVisible)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MinimizeWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MaximizeWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RestoreWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseWindow()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetWindowPosition(double x, double y)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetWindowSize(double width, double height)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public (double x, double y) GetWindowPosition()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
return (0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public (double width, double height) GetWindowSize()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
return (800, 600);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IActionService 实现
|
||||||
|
|
||||||
|
public void ClearCanvas()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearAllCanvases()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddNewPage()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteCurrentPage()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SwitchToPage(int pageIndex)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NextPage()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PreviousPage()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDrawingMode(int mode)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInkWidth(double width)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInkColor(Color color)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetHighlighterWidth(double width)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEraserSize(int size)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEraserType(int type)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEraserShape(int shape)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInkAlpha(double alpha)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInkStyle(int style)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBackgroundColor(string color)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveCanvas(string filePath)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadCanvas(string filePath)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExportAsImage(string filePath, string format)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExportAsPDF(string filePath)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Redo()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SelectAll()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeselectAll()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteSelected()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopySelected()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CutSelected()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Paste()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSetting<T>(string key, T value)
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSettings()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadSettings()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetSettings()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnablePlugin(string pluginName)
|
||||||
|
{
|
||||||
|
var plugin = GetPlugin(pluginName);
|
||||||
|
if (plugin != null)
|
||||||
|
{
|
||||||
|
PluginManager.Instance.TogglePlugin(plugin, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisablePlugin(string pluginName)
|
||||||
|
{
|
||||||
|
var plugin = GetPlugin(pluginName);
|
||||||
|
if (plugin != null)
|
||||||
|
{
|
||||||
|
PluginManager.Instance.TogglePlugin(plugin, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnloadPlugin(string pluginName)
|
||||||
|
{
|
||||||
|
var plugin = GetPlugin(pluginName);
|
||||||
|
if (plugin != null)
|
||||||
|
{
|
||||||
|
PluginManager.Instance.UnloadPlugin(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterEventHandler(string eventName, EventHandler handler)
|
||||||
|
{
|
||||||
|
if (!_eventHandlers.ContainsKey(eventName))
|
||||||
|
{
|
||||||
|
_eventHandlers[eventName] = handler;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_eventHandlers[eventName] += handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnregisterEventHandler(string eventName, EventHandler handler)
|
||||||
|
{
|
||||||
|
if (_eventHandlers.ContainsKey(eventName))
|
||||||
|
{
|
||||||
|
_eventHandlers[eventName] -= handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TriggerEvent(string eventName, object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (_eventHandlers.ContainsKey(eventName))
|
||||||
|
{
|
||||||
|
_eventHandlers[eventName]?.Invoke(sender, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RestartApplication()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExitApplication()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckForUpdates()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenHelpDocument()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenAboutPage()
|
||||||
|
{
|
||||||
|
// 暂时不实现,避免访问权限问题
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,19 +49,19 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
{
|
{
|
||||||
// 先调用基类方法,这样会设置插件ID和记录日志
|
// 先调用基类方法,这样会设置插件ID和记录日志
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
// TODO: 在这里进行插件初始化工作
|
// TODO: 在这里进行插件初始化工作
|
||||||
|
|
||||||
// 示例:记录初始化信息
|
// 示例:记录初始化信息
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 开始初始化", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 开始初始化");
|
||||||
|
|
||||||
// 示例:加载配置
|
// 示例:加载配置
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
|
||||||
// 示例:注册自定义事件
|
// 示例:注册自定义事件
|
||||||
// MainWindow.Instance.SomeEvent += OnSomeEvent;
|
// MainWindow.Instance.SomeEvent += OnSomeEvent;
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 初始化完成", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 初始化完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -72,10 +72,10 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
{
|
{
|
||||||
// 先调用基类方法,这样会设置插件状态和记录日志
|
// 先调用基类方法,这样会设置插件状态和记录日志
|
||||||
base.Enable();
|
base.Enable();
|
||||||
|
|
||||||
// TODO: 在这里启用插件功能
|
// TODO: 在这里启用插件功能
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 已启用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 已启用");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -86,10 +86,10 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
{
|
{
|
||||||
// 先调用基类方法,这样会设置插件状态和记录日志
|
// 先调用基类方法,这样会设置插件状态和记录日志
|
||||||
base.Disable();
|
base.Disable();
|
||||||
|
|
||||||
// TODO: 在这里禁用插件功能
|
// TODO: 在这里禁用插件功能
|
||||||
|
|
||||||
LogHelper.WriteLogToFile($"插件 {Name} 已禁用", LogHelper.LogType.Info);
|
LogHelper.WriteLogToFile($"插件 {Name} 已禁用");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -99,13 +99,13 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
public override void Cleanup()
|
public override void Cleanup()
|
||||||
{
|
{
|
||||||
// TODO: 在这里清理插件资源
|
// TODO: 在这里清理插件资源
|
||||||
|
|
||||||
// 示例:取消注册事件
|
// 示例:取消注册事件
|
||||||
// MainWindow.Instance.SomeEvent -= OnSomeEvent;
|
// MainWindow.Instance.SomeEvent -= OnSomeEvent;
|
||||||
|
|
||||||
// 示例:保存配置
|
// 示例:保存配置
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
|
|
||||||
// 最后调用基类方法
|
// 最后调用基类方法
|
||||||
base.Cleanup();
|
base.Cleanup();
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
public void DoSomething()
|
public void DoSomething()
|
||||||
{
|
{
|
||||||
if (!IsEnabled) return;
|
if (!IsEnabled) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: 实现你的功能
|
// TODO: 实现你的功能
|
||||||
@@ -245,7 +245,7 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
Text = "设置项:",
|
Text = "设置项:",
|
||||||
Margin = new Thickness(0, 5, 0, 5)
|
Margin = new Thickness(0, 5, 0, 5)
|
||||||
});
|
});
|
||||||
|
|
||||||
panel.Children.Add(new TextBox
|
panel.Children.Add(new TextBox
|
||||||
{
|
{
|
||||||
Margin = new Thickness(0, 0, 0, 10),
|
Margin = new Thickness(0, 0, 0, 10),
|
||||||
@@ -261,16 +261,16 @@ namespace Ink_Canvas.Helpers.Plugins
|
|||||||
Margin = new Thickness(0, 10, 0, 0),
|
Margin = new Thickness(0, 10, 0, 0),
|
||||||
HorizontalAlignment = HorizontalAlignment.Left
|
HorizontalAlignment = HorizontalAlignment.Left
|
||||||
};
|
};
|
||||||
|
|
||||||
button.Click += (sender, e) =>
|
button.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
MessageBox.Show("设置已保存!", "插件模板", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("设置已保存!", "插件模板", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
};
|
};
|
||||||
|
|
||||||
panel.Children.Add(button);
|
panel.Children.Add(button);
|
||||||
|
|
||||||
// 设置控件内容
|
// 设置控件内容
|
||||||
this.Content = panel;
|
Content = panel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using Point = System.Windows.Point;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 屏幕检测帮助类 - 用于检测窗口所在的屏幕和屏幕信息
|
||||||
|
/// </summary>
|
||||||
|
public static class ScreenDetectionHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取窗口所在的屏幕
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="window">要检测的窗口</param>
|
||||||
|
/// <returns>窗口所在的屏幕,如果无法检测则返回主屏幕</returns>
|
||||||
|
public static Screen GetWindowScreen(Window window)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (window == null)
|
||||||
|
return Screen.PrimaryScreen;
|
||||||
|
|
||||||
|
// 获取窗口的句柄
|
||||||
|
var hwndSource = PresentationSource.FromVisual(window) as HwndSource;
|
||||||
|
if (hwndSource == null)
|
||||||
|
return Screen.PrimaryScreen;
|
||||||
|
|
||||||
|
// 获取窗口在屏幕上的位置
|
||||||
|
var windowRect = GetWindowScreenBounds(window);
|
||||||
|
|
||||||
|
// 查找与窗口重叠最多的屏幕
|
||||||
|
Screen targetScreen = null;
|
||||||
|
double maxIntersection = 0;
|
||||||
|
|
||||||
|
foreach (var screen in Screen.AllScreens)
|
||||||
|
{
|
||||||
|
var intersection = Rectangle.Intersect(windowRect, screen.Bounds);
|
||||||
|
if (intersection.Width * intersection.Height > maxIntersection)
|
||||||
|
{
|
||||||
|
maxIntersection = intersection.Width * intersection.Height;
|
||||||
|
targetScreen = screen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetScreen ?? Screen.PrimaryScreen;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"检测窗口屏幕时出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
return Screen.PrimaryScreen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取窗口在屏幕坐标系中的边界
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="window">要检测的窗口</param>
|
||||||
|
/// <returns>窗口的屏幕边界</returns>
|
||||||
|
private static Rectangle GetWindowScreenBounds(Window window)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取窗口左上角在屏幕上的位置
|
||||||
|
var topLeft = window.PointToScreen(new Point(0, 0));
|
||||||
|
|
||||||
|
// 获取窗口右下角在屏幕上的位置
|
||||||
|
var bottomRight = window.PointToScreen(new Point(window.ActualWidth, window.ActualHeight));
|
||||||
|
|
||||||
|
return new Rectangle(
|
||||||
|
(int)topLeft.X,
|
||||||
|
(int)topLeft.Y,
|
||||||
|
(int)(bottomRight.X - topLeft.X),
|
||||||
|
(int)(bottomRight.Y - topLeft.Y));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// 如果无法获取精确位置,返回窗口的Left和Top
|
||||||
|
return new Rectangle(
|
||||||
|
(int)window.Left,
|
||||||
|
(int)window.Top,
|
||||||
|
(int)window.Width,
|
||||||
|
(int)window.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否有多个屏幕
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>如果有多个屏幕返回true,否则返回false</returns>
|
||||||
|
public static bool HasMultipleScreens()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Screen.AllScreens.Length > 1;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取主屏幕
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>主屏幕</returns>
|
||||||
|
public static Screen GetPrimaryScreen()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Screen.PrimaryScreen;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有屏幕信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>所有屏幕的数组</returns>
|
||||||
|
public static Screen[] GetAllScreens()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Screen.AllScreens;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return new Screen[] { Screen.PrimaryScreen };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查窗口是否在主屏幕上
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="window">要检查的窗口</param>
|
||||||
|
/// <returns>如果窗口在主屏幕上返回true,否则返回false</returns>
|
||||||
|
public static bool IsWindowOnPrimaryScreen(Window window)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var windowScreen = GetWindowScreen(window);
|
||||||
|
return windowScreen == Screen.PrimaryScreen;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return true; // 出错时假设在主屏幕
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers
|
namespace Ink_Canvas.Helpers
|
||||||
@@ -27,10 +28,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
//MessageBox.Show("启动失败: " + ex.Message);
|
//MessageBox.Show("启动失败: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
//Console.WriteLine(softwareName + " 未找到可执行文件路径。");
|
||||||
{
|
|
||||||
//Console.WriteLine(softwareName + " 未找到可执行文件路径。");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FindEasiCameraExecutablePath(string softwareName)
|
private static string FindEasiCameraExecutablePath(string softwareName)
|
||||||
@@ -51,7 +49,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(installLocation))
|
if (!string.IsNullOrEmpty(installLocation))
|
||||||
{
|
{
|
||||||
executablePath = System.IO.Path.Combine(installLocation, "sweclauncher.exe");
|
executablePath = Path.Combine(installLocation, "sweclauncher.exe");
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrEmpty(uninstallString))
|
else if (!string.IsNullOrEmpty(uninstallString))
|
||||||
{
|
{
|
||||||
@@ -59,7 +57,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
if (lastSlashIndex >= 0)
|
if (lastSlashIndex >= 0)
|
||||||
{
|
{
|
||||||
string folderPath = uninstallString.Substring(0, lastSlashIndex);
|
string folderPath = uninstallString.Substring(0, lastSlashIndex);
|
||||||
executablePath = System.IO.Path.Combine(folderPath, "sweclauncher", "sweclauncher.exe");
|
executablePath = Path.Combine(folderPath, "sweclauncher", "sweclauncher.exe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Ink;
|
using System.Windows.Ink;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows; // Added for UIElement
|
|
||||||
|
// Added for UIElement
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers
|
namespace Ink_Canvas.Helpers
|
||||||
{
|
{
|
||||||
@@ -133,7 +135,7 @@ namespace Ink_Canvas.Helpers
|
|||||||
public class TimeMachineHistory
|
public class TimeMachineHistory
|
||||||
{
|
{
|
||||||
public TimeMachineHistoryType CommitType;
|
public TimeMachineHistoryType CommitType;
|
||||||
public bool StrokeHasBeenCleared = false;
|
public bool StrokeHasBeenCleared;
|
||||||
public StrokeCollection CurrentStroke;
|
public StrokeCollection CurrentStroke;
|
||||||
public StrokeCollection ReplacedStroke;
|
public StrokeCollection ReplacedStroke;
|
||||||
//这里说一下 Tuple的 Value1 是初始值 ; Value 2 是改变值
|
//这里说一下 Tuple的 Value1 是初始值 ; Value 2 是改变值
|
||||||
@@ -193,5 +195,18 @@ namespace Ink_Canvas.Helpers
|
|||||||
_currentIndex = _currentStrokeHistory.Count - 1;
|
_currentIndex = _currentStrokeHistory.Count - 1;
|
||||||
NotifyUndoRedoState();
|
NotifyUndoRedoState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CommitElementRemoveHistory(UIElement element)
|
||||||
|
{
|
||||||
|
if (_currentIndex + 1 < _currentStrokeHistory.Count)
|
||||||
|
{
|
||||||
|
_currentStrokeHistory.RemoveRange(_currentIndex + 1, (_currentStrokeHistory.Count - 1) - _currentIndex);
|
||||||
|
}
|
||||||
|
var history = new TimeMachineHistory(element, TimeMachineHistoryType.ElementInsert);
|
||||||
|
history.StrokeHasBeenCleared = true; // 标记为已清除
|
||||||
|
_currentStrokeHistory.Add(history);
|
||||||
|
_currentIndex = _currentStrokeHistory.Count - 1;
|
||||||
|
NotifyUndoRedoState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Helpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// UIAccess DLL释放器
|
||||||
|
/// </summary>
|
||||||
|
public static class UIAccessDllExtractor
|
||||||
|
{
|
||||||
|
private static readonly string[] RequiredDlls = {
|
||||||
|
"UIAccessDLL_x64.dll",
|
||||||
|
"UIAccessDLL_x86.dll"
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在应用启动时释放UIAccess相关DLL
|
||||||
|
/// </summary>
|
||||||
|
public static void ExtractUIAccessDlls()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string appDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
LogHelper.WriteLogToFile("开始检查并释放UIAccess相关DLL文件");
|
||||||
|
|
||||||
|
foreach (string dllName in RequiredDlls)
|
||||||
|
{
|
||||||
|
string targetPath = Path.Combine(appDirectory, dllName);
|
||||||
|
|
||||||
|
// 检查文件是否已存在且有效
|
||||||
|
if (File.Exists(targetPath) && IsValidDll(targetPath))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"{dllName} 已存在且有效,跳过释放");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从嵌入资源中释放DLL
|
||||||
|
if (ExtractDllFromResource(dllName, targetPath))
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"成功释放 {dllName} 到 {targetPath}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"警告:无法释放 {dllName},可能影响UIA置顶功能", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogHelper.WriteLogToFile("UIAccess DLL释放检查完成");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"释放UIAccess DLL时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从嵌入资源中提取DLL文件
|
||||||
|
/// </summary>
|
||||||
|
private static bool ExtractDllFromResource(string dllName, string targetPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
|
string resourceName = $"Ink_Canvas.{dllName}";
|
||||||
|
|
||||||
|
using (Stream resourceStream = assembly.GetManifestResourceStream(resourceName))
|
||||||
|
{
|
||||||
|
if (resourceStream == null)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"未找到嵌入资源: {resourceName}", LogHelper.LogType.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保目标目录存在
|
||||||
|
string targetDirectory = Path.GetDirectoryName(targetPath);
|
||||||
|
if (!Directory.Exists(targetDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(targetDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入文件
|
||||||
|
using (FileStream fileStream = new FileStream(targetPath, FileMode.Create, FileAccess.Write))
|
||||||
|
{
|
||||||
|
resourceStream.CopyTo(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"从资源提取 {dllName} 失败: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查DLL文件是否有效
|
||||||
|
/// </summary>
|
||||||
|
private static bool IsValidDll(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
FileInfo fileInfo = new FileInfo(filePath);
|
||||||
|
|
||||||
|
// 检查文件大小(空文件或过小的文件可能无效)
|
||||||
|
if (fileInfo.Length < 1024) // 小于1KB可能无效
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 简单检查PE头(DLL文件应该以MZ开头)
|
||||||
|
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
byte[] buffer = new byte[2];
|
||||||
|
if (fs.Read(buffer, 0, 2) == 2)
|
||||||
|
{
|
||||||
|
return buffer[0] == 0x4D && buffer[1] == 0x5A; // "MZ"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理释放的DLL文件(可选,在应用退出时调用)
|
||||||
|
/// </summary>
|
||||||
|
public static void CleanupExtractedDlls()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string appDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
|
foreach (string dllName in RequiredDlls)
|
||||||
|
{
|
||||||
|
string filePath = Path.Combine(appDirectory, dllName);
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(filePath);
|
||||||
|
LogHelper.WriteLogToFile($"已清理 {dllName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理 {dllName} 失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"清理UIAccess DLL时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Windows.Automation;
|
using System.Windows.Automation;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers {
|
namespace Ink_Canvas.Helpers
|
||||||
internal class WinTabWindowsChecker {
|
{
|
||||||
|
internal class WinTabWindowsChecker
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
public static bool IsWindowMinimized(string windowName, bool matchFullName = true) {
|
public static bool IsWindowMinimized(string windowName, bool matchFullName = true) {
|
||||||
// 获取Win+Tab预览中的窗口
|
// 获取Win+Tab预览中的窗口
|
||||||
@@ -40,28 +42,37 @@ namespace Ink_Canvas.Helpers {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static bool IsWindowExisted(string windowName, bool matchFullName = true) {
|
public static bool IsWindowExisted(string windowName, bool matchFullName = true)
|
||||||
|
{
|
||||||
// 获取Win+Tab预览中的窗口
|
// 获取Win+Tab预览中的窗口
|
||||||
AutomationElementCollection windows = AutomationElement.RootElement.FindAll(
|
AutomationElementCollection windows = AutomationElement.RootElement.FindAll(
|
||||||
TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window));
|
TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window));
|
||||||
|
|
||||||
foreach (AutomationElement window in windows) {
|
foreach (AutomationElement window in windows)
|
||||||
|
{
|
||||||
//LogHelper.WriteLogToFile("" + window.Current.Name);
|
//LogHelper.WriteLogToFile("" + window.Current.Name);
|
||||||
|
|
||||||
string windowTitle = window.Current.Name;
|
string windowTitle = window.Current.Name;
|
||||||
|
|
||||||
// 如果窗口标题包含 windowName,则进行检查
|
// 如果窗口标题包含 windowName,则进行检查
|
||||||
if (!string.IsNullOrEmpty(windowTitle) && windowTitle.Contains(windowName)) {
|
if (!string.IsNullOrEmpty(windowTitle) && windowTitle.Contains(windowName))
|
||||||
if (matchFullName) {
|
{
|
||||||
if (windowTitle.Length == windowName.Length) {
|
if (matchFullName)
|
||||||
|
{
|
||||||
|
if (windowTitle.Length == windowName.Length)
|
||||||
|
{
|
||||||
WindowPattern windowPattern = window.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
|
WindowPattern windowPattern = window.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
|
||||||
if (windowPattern != null) {
|
if (windowPattern != null)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
WindowPattern windowPattern = window.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
|
WindowPattern windowPattern = window.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
|
||||||
if (windowPattern != null) {
|
if (windowPattern != null)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user