Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyImage 控件 #4868

Merged
merged 13 commits into from
Oct 13, 2024
Merged

MyImage 控件 #4868

merged 13 commits into from
Oct 13, 2024

Conversation

tangge233
Copy link
Contributor

@tangge233 tangge233 commented Oct 1, 2024

支持加载本地和在线 WebP 的图片控件,适配之后的帮助库图片格式变更

需要帮助解决在使用缓存时 UseCache 属性应当先于 Source 属性设置才可以生效的问题

代码写的非常不怎么样

相关 Issue LTCatt/PCL2Help#393

@3gf8jv4dv 3gf8jv4dv added · 新功能 等待确认 已经过社区确认,等待开发者确认 labels Oct 1, 2024
@LTCatt LTCatt added 社区处理中 社区正在调查或处理该项 and removed 等待确认 已经过社区确认,等待开发者确认 labels Oct 1, 2024
@tangge233
Copy link
Contributor Author

修改了下实现方式,支持 WebP 的同时支持使用 Base64 编码的图片

@tangge233 tangge233 requested a review from LTCatt October 2, 2024 04:10
@tangge233
Copy link
Contributor Author

tangge233 commented Oct 2, 2024

还需修改 Completed

  • 不清理图片缓存以帮助帮助库图片加载 (加入 UseCache 以减少图片的网络获取频率)
  • 没必要支持 base64(那玩意纯增加文件体积…)

Plain Craft Launcher 2/Modules/Base/MyBitmap.vb Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Controls/MyImage.vb Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Controls/MyImage.vb Outdated Show resolved Hide resolved
@tangge233 tangge233 requested a review from LTCatt October 2, 2024 09:22
@LTCatt LTCatt added 处理中 开发者正在调查或处理该项 🟥 高 优先度:高 and removed 社区处理中 社区正在调查或处理该项 labels Oct 3, 2024
Copy link
Member

@LTCatt LTCatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

又研究了下,这个实现思路不行,在 UI 线程进行网络请求下载图片是不能接受的……
或许需要在 MyImage 中先把 Source 设置为空,然后后台进行网络请求,在下载结束后再把 Byte() 传给 MyBitmap 进行加载?

@LTCatt LTCatt added 等待提交者 需要提交者补充信息或进行操作 and removed 处理中 开发者正在调查或处理该项 🟥 高 优先度:高 labels Oct 8, 2024
@tangge233
Copy link
Contributor Author

考虑放上一个“加载中”图片?

@LTCatt LTCatt added 处理中 开发者正在调查或处理该项 and removed 等待提交者 需要提交者补充信息或进行操作 labels Oct 8, 2024
@LTCatt LTCatt added the 🟨 中 优先度:中 label Oct 8, 2024
Plain Craft Launcher 2/Controls/MyImage.vb Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Controls/MyImage.vb Outdated Show resolved Hide resolved
@LTCatt LTCatt added 等待提交者 需要提交者补充信息或进行操作 and removed 处理中 开发者正在调查或处理该项 🟨 中 优先度:中 labels Oct 13, 2024
@tangge233 tangge233 requested a review from LTCatt October 13, 2024 13:35
Plain Craft Launcher 2/Controls/MyImage.vb Outdated Show resolved Hide resolved
Comment on lines 13 to 15
''' <summary>
''' 是否使用缓存,需要先于 Source 属性设置,否则无效
''' </summary>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要注册为 DependencyProperty。
默认值为 True。

Copy link
Contributor Author

@tangge233 tangge233 Oct 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emmmmm
我这出了点问题,不知道为什么设置还是需要顺序……

NEED HELP

@LTCatt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我改完了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emmmm 似乎是 WPF 的特性?
新改后的代码测试发现顺序还是会影响实际结果……

使用下面代码很显然是期望不触发缓存机制,但是却使用了缓存

<local:MyImage Source="https://objects.lihaoyu.cn/bigcake-blog-images/2024/10/05/6700c8f7cd4b2.jpeg" EnableCache="False"/>

EnableCache 属性移到前面才会正常工作……

<local:MyImage EnableCache="False" Source="https://objects.lihaoyu.cn/bigcake-blog-images/2024/10/05/6700c8f7cd4b2.jpeg" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修了,等更新的时候再推送 :D

@LTCatt LTCatt merged commit 2ad1a6b into Hex-Dragon:main Oct 13, 2024
2 checks passed
@HexDragon-Bot HexDragon-Bot added 完成 已被处理,将在下次更新之后生效 and removed 等待提交者 需要提交者补充信息或进行操作 labels Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
· 新功能 完成 已被处理,将在下次更新之后生效
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants