From 8506d52ac82db54970d3d5581753adaf37c3f181 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 12 Apr 2022 00:00:57 +0800 Subject: [PATCH 01/18] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=A8=A1=E6=8B=9F=E5=99=A8=E5=88=86=E8=BE=A8?= =?UTF-8?q?=E7=8E=87=E5=90=8E=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/345 --- src/MeoAssistant/Controller.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index ffe188686b..b18de0ad56 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -139,6 +139,11 @@ bool asst::Controller::connect_adb(const std::string & address) m_emulator_info.adb.display_width = (std::max)(size_value1, size_value2); m_emulator_info.adb.display_height = (std::min)(size_value1, size_value2); + Log.info("Width:", m_emulator_info.adb.display_width, "Height:", m_emulator_info.adb.display_height); + if (m_emulator_info.adb.display_width == 0 || m_emulator_info.adb.display_height == 0) { + return false; + } + constexpr double DefaultRatio = static_cast(WindowWidthDefault) / static_cast(WindowHeightDefault); double cur_ratio = static_cast(m_emulator_info.adb.display_width) / static_cast(m_emulator_info.adb.display_height); @@ -471,7 +476,7 @@ std::optional> asst::Controller::call_command(const s read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize); }; } while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout()); - } +} else { // failed to create child process return std::nullopt; From a0b04c77a0b0029857823225c36e4dc2223c4eed Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 12 Apr 2022 00:27:04 +0800 Subject: [PATCH 02/18] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E5=85=AC=E6=8B=9B?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=90=8E=E7=9A=84=E8=AF=86=E5=88=AB=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/336 --- resource/tasks.json | 9 +++++++-- src/MeoAssistant/AutoRecruitTask.cpp | 13 +++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index 2ac57def0e..579cba8da8 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -1756,7 +1756,7 @@ ], "next": [ "RecruitLoading", - "Stop" + "SleepThenStop" ] }, "RecruitLoading": { @@ -1774,9 +1774,14 @@ ], "next": [ "RecruitLoading", - "Stop" + "SleepThenStop" ] }, + "SleepThenStop": { + "algorithm": "JustReturn", + "action": "doNothing", + "rearDelay": 2000 + }, "RecruitCheckTimeUnreduced": { "action": "Stop", "template": "RecruitTimeReduce.png", diff --git a/src/MeoAssistant/AutoRecruitTask.cpp b/src/MeoAssistant/AutoRecruitTask.cpp index 0fa9de580d..7ae550be58 100644 --- a/src/MeoAssistant/AutoRecruitTask.cpp +++ b/src/MeoAssistant/AutoRecruitTask.cpp @@ -5,6 +5,7 @@ #include "Controller.h" #include "ProcessTask.h" #include "RecruitTask.h" +#include "Logger.hpp" asst::AutoRecruitTask& asst::AutoRecruitTask::set_select_level(std::vector select_level) noexcept { @@ -56,6 +57,7 @@ bool asst::AutoRecruitTask::_run() if (!m_use_expedited) { return true; } + Log.info("ready to use expedited"); // 使用加急许可 for (; m_cur_times < m_max_times; ++m_cur_times) { if (need_exit()) { @@ -84,20 +86,25 @@ bool asst::AutoRecruitTask::analyze_start_buttons() auto image = Ctrler.get_image(); start_analyzer.set_image(image); if (!start_analyzer.analyze()) { + Log.info("There is no start button"); return false; } start_analyzer.sort_result(); m_start_buttons = start_analyzer.get_result(); + Log.info("Recruit start button size", m_start_buttons.size()); return true; } bool asst::AutoRecruitTask::recruit_index(size_t index) { + LogTraceFunction; + int delay = Resrc.cfg().get_options().task_delay; if (m_start_buttons.size() <= index) { return false; } + Log.info("recruit_index", index); Rect button = m_start_buttons.at(index).rect; Ctrler.click(button); sleep(delay); @@ -107,6 +114,8 @@ bool asst::AutoRecruitTask::recruit_index(size_t index) bool asst::AutoRecruitTask::calc_and_recruit() { + LogTraceFunction; + RecruitTask recruit_task(m_callback, m_callback_arg, m_task_chain); recruit_task.set_retry_times(m_retry_times); recruit_task.set_param(m_select_level, true); @@ -152,7 +161,7 @@ bool asst::AutoRecruitTask::calc_and_recruit() } bool asst::AutoRecruitTask::check_time_unreduced() { - ProcessTask task(*this, {"RecruitCheckTimeUnreduced"}); + ProcessTask task(*this, { "RecruitCheckTimeUnreduced" }); task.set_retry_times(1); return task.run(); } @@ -180,4 +189,4 @@ bool asst::AutoRecruitTask::refresh() { ProcessTask refresh_task(*this, { "RecruitRefresh" }); return refresh_task.run(); -} \ No newline at end of file +} From 0c50e00f65e8fd7dd9d12e4ac64438ee49fe61e6 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 12 Apr 2022 01:04:34 +0800 Subject: [PATCH 03/18] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E2=80=9C=E8=A1=8C?= =?UTF-8?q?=E5=8A=A8=E7=BB=93=E6=9D=9F=E2=80=9D=E8=AF=86=E5=88=AB=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/330 https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/203 --- resource/tasks.json | 20 +++++++++++--------- resource/template/EndOfAction.png | Bin 0 -> 2068 bytes 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 resource/template/EndOfAction.png diff --git a/resource/tasks.json b/resource/tasks.json index 579cba8da8..b68b58da21 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -552,19 +552,21 @@ ] }, "EndOfAction": { - "algorithm": "OcrDetect", - "text": [ - "行动结束" - ], + "algorithm": "MatchTemplate", + "cache": false, "roi": [ - 0, - 440, - 440, - 280 + 790, + 410, + 137, + 141 ], - "action": "doNothing", + "action": "DoNothing", "next": [ "ClickCorner" + ], + "maskRange": [ + 60, + 255 ] }, "StageDrops": { diff --git a/resource/template/EndOfAction.png b/resource/template/EndOfAction.png new file mode 100644 index 0000000000000000000000000000000000000000..e493c606d2565cd458a9e67bc5979edfcee4a5f8 GIT binary patch literal 2068 zcmZWqdpOhWAO507Y)&zo$Q)vm!`5DrQ#8jcIb9AdYjdnua|lToRzs}Rh$ZHiw^oX% zgoI{tdXqz}iQW|9b$A`ZkkdQ;{`>u|&-FadAJ2V%KKFfH_w_v2+*}^wy00ntK9iHmkC>o{WokQ{Qhv-R@bQ`7`GpS!FsIX^d-T+t9V>3{Cs%cb2c(j0qR zz1_u|c#7lE5o46l(Gz?Fp3`EcNPIt@sM$MX=uXQG4vFqrSDm)>WS-a0R*;8UT{|LsWtCTgIIL3x5Bc;u!=(OH{V7 zEHn+H83J?y=L+7cNI`i>-m(;wMxQ?lP9dkm0jy1du9!Fsk#6&dTU(?11s(dIdi33n zYbVV&BB;=f)c~sbK{O4`KtsP3@GM_YLq-}S6J0yx#X^5JB)INgDKe~QUM!H_=>w&= zpyUl*BFg3p{qD<%iA%WQCF-Kv^ja(knI3R4c_~u_11a1mXFNq=sjs|JQjj3sERB5B z@YV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r?E$-X+Qtlt)9*kd)s}@GeAd!dd2`Q2Fa!Nwz%oqleZQ@h6pG9`$KuJ)2`?RuK^ut0)o^ zJj4T#ioIx>EX7P>M@`jqP~}4N^V>CYWqyPHUpr77OzwKXwO;ALnSUBit Date: Tue, 12 Apr 2022 01:28:22 +0800 Subject: [PATCH 04/18] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8Daria2=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=AE=8C=E6=88=90=E5=90=8E=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/322 --- src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs b/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs index 30a3a194a0..c4ffdd5cc5 100644 --- a/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs +++ b/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs @@ -472,7 +472,6 @@ namespace MeoAsstGui } } - private bool DownloadFileForAria2(string url, string filePath, string fileName) { var aria2FilePath = Path.GetFullPath(Directory.GetCurrentDirectory() + "/aria2c.exe"); @@ -500,11 +499,11 @@ namespace MeoAsstGui aria2Process.Start(); aria2Process.WaitForExit(); + var exit_code = aria2Process.ExitCode; aria2Process.Close(); - return aria2Process.ExitCode == 0; + return exit_code == 0; } - private bool DownloadFileForCSharpNative(string url, string filePath, string contentType = null) { // 创建 Http 请求 From 2fd19faf5b396b8f4754cdf3017755071d18ff11 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 12 Apr 2022 22:14:14 +0800 Subject: [PATCH 05/18] =?UTF-8?q?docs.=E5=BC=BA=E8=B0=83=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98dcc72f57..4fea7053be 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ MAA 的意思是 MAA Assistant Arknights 3. 第一次运行软件,**请使用管理员权限** 打开 `MeoAsstGui.exe`。运行过一次后,后续不再需要管理员权限。 4. 开始运行后,除 `自动关机` 外,所有设置均不可再修改。 -目前仅对 `16:9` 分辨率支持较好,其他分辨率勉强可用,但可能会有奇奇怪怪的问题,正在进一步适配中_(:з」∠)_ +目前仅对 `16:9` 分辨率支持较好,最低支持 `1280 * 720`,更高不限。非 `16:9` 分辨率可能会有奇奇怪怪的问题,正在进一步适配中_(:з」∠)_ 更多使用说明请参考 [详细介绍](docs/详细介绍.md) From 5047afa0de6af7e0b11fc8e82b8757a57cf2cca8 Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 13 Apr 2022 20:16:32 +0800 Subject: [PATCH 06/18] =?UTF-8?q?chore.=E9=80=82=E9=85=8D=E5=85=B3?= =?UTF-8?q?=E5=8D=A1=E6=8E=89=E8=90=BD=E6=96=B0UI=EF=BC=8C=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E5=85=B3=E9=97=AD=E6=8E=89=E8=90=BD=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 22 +++++++++----------- resource/template/EndOfAction.png | Bin 2068 -> 0 bytes src/MeoAssistant/StageDropsTaskPlugin.cpp | 24 +++++++++++----------- src/MeoAssistant/Version.h | 2 +- 4 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 resource/template/EndOfAction.png diff --git a/resource/tasks.json b/resource/tasks.json index b68b58da21..f8ed82af3d 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -552,21 +552,19 @@ ] }, "EndOfAction": { - "algorithm": "MatchTemplate", - "cache": false, - "roi": [ - 790, - 410, - 137, - 141 + "algorithm": "OcrDetect", + "text": [ + "行动结束" ], - "action": "DoNothing", + "roi": [ + 0, + 120, + 440, + 600 + ], + "action": "doNothing", "next": [ "ClickCorner" - ], - "maskRange": [ - 60, - 255 ] }, "StageDrops": { diff --git a/resource/template/EndOfAction.png b/resource/template/EndOfAction.png deleted file mode 100644 index e493c606d2565cd458a9e67bc5979edfcee4a5f8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2068 zcmZWqdpOhWAO507Y)&zo$Q)vm!`5DrQ#8jcIb9AdYjdnua|lToRzs}Rh$ZHiw^oX% zgoI{tdXqz}iQW|9b$A`ZkkdQ;{`>u|&-FadAJ2V%KKFfH_w_v2+*}^wy00ntK9iHmkC>o{WokQ{Qhv-R@bQ`7`GpS!FsIX^d-T+t9V>3{Cs%cb2c(j0qR zz1_u|c#7lE5o46l(Gz?Fp3`EcNPIt@sM$MX=uXQG4vFqrSDm)>WS-a0R*;8UT{|LsWtCTgIIL3x5Bc;u!=(OH{V7 zEHn+H83J?y=L+7cNI`i>-m(;wMxQ?lP9dkm0jy1du9!Fsk#6&dTU(?11s(dIdi33n zYbVV&BB;=f)c~sbK{O4`KtsP3@GM_YLq-}S6J0yx#X^5JB)INgDKe~QUM!H_=>w&= zpyUl*BFg3p{qD<%iA%WQCF-Kv^ja(knI3R4c_~u_11a1mXFNq=sjs|JQjj3sERB5B z@YVEvu*%a~xz6eBUZznEj%@ibA?f67>D2MMsJ-G^eIL5Z&&w$XVc0>fYa5L} z;s`Qu#EC3%#Mia;q5Li!)VN(N?s%My`5S{zaa-{jcu z(cW5Wz+$t~NZJq2PN(+`oB7>`3AEo3%83J;J?d7KO?XPu7ma%AKCIL4?qKcuAKX_3 zOxuBW)K9*oazwGLek*JjcfxzPNU+#m5%2rtHM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E4=B8=80=E4=B8=AAG?= =?UTF-8?q?UI=E7=9A=84=E9=97=AA=E9=80=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Version.h | 2 +- src/MeoAsstGui/Helper/ViewStatusStorage.cs | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/MeoAssistant/Version.h b/src/MeoAssistant/Version.h index 46cb9577f3..007ecab490 100644 --- a/src/MeoAssistant/Version.h +++ b/src/MeoAssistant/Version.h @@ -2,5 +2,5 @@ namespace asst { - constexpr static const char* Version = "v3.1.1"; + constexpr static const char* Version = "v3.1.2"; } diff --git a/src/MeoAsstGui/Helper/ViewStatusStorage.cs b/src/MeoAsstGui/Helper/ViewStatusStorage.cs index de24464393..f6749dc442 100644 --- a/src/MeoAsstGui/Helper/ViewStatusStorage.cs +++ b/src/MeoAsstGui/Helper/ViewStatusStorage.cs @@ -42,17 +42,25 @@ namespace MeoAsstGui public static bool Load() { - try + if (File.Exists(_configFilename)) { - using (StreamReader sr = new StreamReader(_configFilename)) + try { - string jsonStr = sr.ReadToEnd(); + using (StreamReader sr = new StreamReader(_configFilename)) + { + string jsonStr = sr.ReadToEnd(); - // 文件存在但为空,会读出来一个null,感觉c#这库有bug,如果是null 就赋值一个空JObject - _viewStatus = (JObject)JsonConvert.DeserializeObject(jsonStr) ?? new JObject(); + // 文件存在但为空,会读出来一个null,感觉c#这库有bug,如果是null 就赋值一个空JObject + _viewStatus = (JObject)JsonConvert.DeserializeObject(jsonStr) ?? new JObject(); + } + } + catch (Exception) + { + _viewStatus = new JObject(); + return false; } } - catch (Exception) + else { _viewStatus = new JObject(); return false; From ec90dc359317258d698971dead493f7b1f5079ce Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 15 Apr 2022 10:20:46 +0800 Subject: [PATCH 08/18] =?UTF-8?q?chore.=E9=80=82=E9=85=8D=E6=98=8E?= =?UTF-8?q?=E6=97=A5=E6=96=B9=E8=88=9F=E6=96=B0ui=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=85=B3=E5=8D=A1=E5=AF=BC=E8=88=AA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index f8ed82af3d..3349840229 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -55,7 +55,7 @@ 850, 140, 250, - 80 + 220 ] }, "BI-8": { @@ -225,7 +225,7 @@ 850, 140, 250, - 80 + 220 ] }, "AP-5": { @@ -271,7 +271,7 @@ 850, 140, 250, - 80 + 220 ] }, "CE-5": { @@ -317,7 +317,7 @@ 850, 140, 250, - 80 + 220 ] }, "Annihilation": { From 1689a5dcf0c19871175c7cc1832e19e45f8f2ca0 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 15 Apr 2022 10:35:01 +0800 Subject: [PATCH 09/18] =?UTF-8?q?chore.=E6=9B=B4=E6=96=B0=E5=85=AC?= =?UTF-8?q?=E6=8B=9B`=E9=A3=8E=E7=AC=9B`=E3=80=81`=E6=85=91=E7=A0=82`?= =?UTF-8?q?=E3=80=81`=E5=AE=B4`=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/recruit.json | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/resource/recruit.json b/resource/recruit.json index 542345ac01..ac46c23c7f 100644 --- a/resource/recruit.json +++ b/resource/recruit.json @@ -1390,5 +1390,49 @@ "hidden": false, "name-en": "Leizi", "new": true + }, + { + "name": "慑砂", + "type": "狙击", + "level": 5, + "sex": "男", + "tags": [ + "远程位", + "群攻", + "削弱", + "资深干员" + ], + "hidden": false, + "name-en": "Sesa", + "new": true + }, + { + "name": "风笛", + "type": "先锋", + "level": 6, + "sex": "女", + "tags": [ + "近战位", + "输出", + "费用回复", + "高级资深干员" + ], + "hidden": false, + "name-en": "Bagpipe", + "new": true + }, + { + "name": "宴", + "type": "近卫", + "level": 4, + "sex": "女", + "tags": [ + "近战位", + "输出", + "生存" + ], + "hidden": false, + "name-en": "Utage", + "new": true } ] From 2109f821635b8ac7df8a4247523361af7dc6fe7c Mon Sep 17 00:00:00 2001 From: YIU Date: Sun, 17 Apr 2022 04:46:02 +0800 Subject: [PATCH 10/18] =?UTF-8?q?feat.=20=E5=A2=9E=E5=8A=A0=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=98=BE=E7=A4=BA=E4=BD=8D=E7=BD=AE=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=80=89=E9=A1=B9=20(#348)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 通知显示可以设置为屏幕任意 8 个位置的其中一个位置、也可以设置为不显示 * 增加通知时任务栏闪烁提醒 --- src/MeoAsstGui/Helper/ToastNotification.cs | 115 +++++++- src/MeoAsstGui/MeoAsstGui.csproj | 7 + .../UserControl/ToastSettingsUserControl.xaml | 98 +++++++ .../ToastSettingsUserControl.xaml.cs | 26 ++ .../ViewModels/SettingsViewModel.cs | 274 ++++++++++++++++++ src/MeoAsstGui/Views/SettingsView.xaml | 3 + 6 files changed, 510 insertions(+), 13 deletions(-) create mode 100644 src/MeoAsstGui/UserControl/ToastSettingsUserControl.xaml create mode 100644 src/MeoAsstGui/UserControl/ToastSettingsUserControl.xaml.cs diff --git a/src/MeoAsstGui/Helper/ToastNotification.cs b/src/MeoAsstGui/Helper/ToastNotification.cs index 542ce55498..16edc963a4 100644 --- a/src/MeoAsstGui/Helper/ToastNotification.cs +++ b/src/MeoAsstGui/Helper/ToastNotification.cs @@ -13,6 +13,7 @@ using System; using System.ComponentModel; using System.Drawing; using System.Media; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -79,7 +80,7 @@ namespace MeoAsstGui NotificationConstants.NotificationsOverlayWindowMaxCount = 5; // 默认显示位置 - NotificationConstants.MessagePosition = NotificationPosition.BottomRight; + // NotificationConstants.MessagePosition = NotificationPosition.BottomRight; // 最小显示宽度 NotificationConstants.MinWidth = 400d; @@ -294,25 +295,31 @@ namespace MeoAsstGui NotificationSounds sound = NotificationSounds.Notification, NotificationContent notificationContent = null) { - notificationContent = notificationContent ?? BaseContent(); + if (!string.IsNullOrWhiteSpace(ViewStatusStorage.Get("Toast.Position", NotificationPosition.BottomRight.ToString()))) + { + notificationContent = notificationContent ?? BaseContent(); - notificationContent.RowsCount = row; + notificationContent.RowsCount = row; - // 调整显示时间,如果存在按钮的情况下显示时间将强制设为最大时间 - lifeTime = lifeTime < 3d ? 3d : lifeTime; + // 调整显示时间,如果存在按钮的情况下显示时间将强制设为最大时间 + lifeTime = lifeTime < 3d ? 3d : lifeTime; - var timeSpan = _buttonLeftAction == null && _buttonRightAction == null - ? TimeSpan.FromSeconds(lifeTime) - : TimeSpan.MaxValue; + var timeSpan = _buttonLeftAction == null && _buttonRightAction == null + ? TimeSpan.FromSeconds(lifeTime) + : TimeSpan.MaxValue; - // 显示通知 - _notificationManager.Show( - notificationContent, - expirationTime: timeSpan, - ShowXbtn: false); + // 显示通知 + _notificationManager.Show( + notificationContent, + expirationTime: timeSpan, + ShowXbtn: false); + } // 播放通知提示音 PlayNotificationSoundAsync(sound); + + // 任务栏闪烁 + FlashWindowEx(); } /// @@ -371,6 +378,88 @@ namespace MeoAsstGui #endregion + #region 任务栏闪烁 + + /// + /// 闪烁信息 + /// + private struct FLASHWINFO + { + /// + /// 结构大小 + /// + public uint cbSize; + + /// + /// 要闪烁或停止的窗口句柄 + /// + public IntPtr hwnd; + + /// + /// 闪烁的类型 + /// + public uint dwFlags; + + /// + /// 闪烁窗口的次数 + /// + public uint uCount; + + /// + /// 窗口闪烁的频率(毫秒) + /// + public uint dwTimeout; + } + + /// + /// 闪烁类型 + /// + public enum FlashType : uint + { + [Description("停止闪烁")] + FLASHW_STOP = 0, + + [Description("只闪烁标题")] + FALSHW_CAPTION = 1, + + [Description("只闪烁任务栏")] + FLASHW_TRAY = 2, + + [Description("标题和任务栏同时闪烁")] + FLASHW_ALL = 3, + + FLASHW_PARAM1 = 4, + FLASHW_PARAM2 = 12, + + [Description("闪烁直到达到次数或收到停止")] + FLASHW_TIMER = FLASHW_TRAY | FLASHW_PARAM1, + + [Description("未激活时闪烁直到窗口被激活或收到停止")] + FLASHW_TIMERNOFG = FLASHW_TRAY | FLASHW_PARAM2 + } + + [DllImport("user32.dll")] private static extern bool FlashWindowEx(ref FLASHWINFO pwfi); + + /// + /// 闪烁窗口任务栏 + /// + /// 窗口句柄 + /// 闪烁类型 + /// 闪烁次数 + /// + public static bool FlashWindowEx(IntPtr hWnd = default, FlashType type = FlashType.FLASHW_TIMERNOFG, uint count = 5) + { + var fInfo = new FLASHWINFO(); + fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); + fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(Application.Current.MainWindow).Handle; + fInfo.dwFlags = (uint)type; + fInfo.uCount = count; + fInfo.dwTimeout = 0; + return FlashWindowEx(ref fInfo); + } + + #endregion + /// /// 通知使用完后释放已使用的数据 /// diff --git a/src/MeoAsstGui/MeoAsstGui.csproj b/src/MeoAsstGui/MeoAsstGui.csproj index 868cf4051e..7d8ee09952 100644 --- a/src/MeoAsstGui/MeoAsstGui.csproj +++ b/src/MeoAsstGui/MeoAsstGui.csproj @@ -141,6 +141,9 @@ PenguinReportSettingsUserControl.xaml + + ToastSettingsUserControl.xaml + VersionUpdateSettingsUserControl.xaml @@ -189,6 +192,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/src/MeoAsstGui/UserControl/ToastSettingsUserControl.xaml b/src/MeoAsstGui/UserControl/ToastSettingsUserControl.xaml new file mode 100644 index 0000000000..b4bff8d5cc --- /dev/null +++ b/src/MeoAsstGui/UserControl/ToastSettingsUserControl.xaml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +