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

[SANITIZE PHASE] UI Changes and Runtime Improvements (Part 2) #434

Merged
merged 91 commits into from
Apr 12, 2024

Conversation

neon-nyan
Copy link
Member

@neon-nyan neon-nyan commented Mar 20, 2024

Important

Do NOT push into this branch unless its a direct fix for change(s) that already happened into it.
If you want to make an improvement, please make a new branch based on this branch or wait until the PR is properly merged.

Important

Run XamlStyler.bat once before merge and DO NOT use squash to merge this PR.

Warning

Due to heavy changes in window size and image handler, need to inform user to clear image cache.

Description

This second part of UI Changes and Runtime Improvements PR is focused on moving some custom UI element builder using UIElementExtensions with builder methods to assign the element's properties (for example: Margin, Padding, Columns and Row for Panels like Grid and StackPanel, etc.)

Method Usage Example for UIElementExtensions

Case example

Creating a Grid with 2x2 panel and addin TextBlocks inside it and modify its text

using CollapseLauncher.Extension;

Grid aGrid = UIElementExtensions.CreateGrid()
    .WithColumns(new(1, GridUnitType.Star), new(1, GridUnitType.Star))
    .WithRows(new(1, GridUnitType.Star), new(1, GridUnitType.Star))
    .WithCornerRadius(8d)
    .WithWidthAndHeight(256d);

TextBlock aTextBlock = aGrid.AddElementToGridRowColumn(new TextBlock(), 0, 0);
TextBlock bTextBlock = aGrid.AddElementToGridRowColumn(new TextBlock(), 0, 1);
TextBlock cTextBlock = aGrid.AddElementToGridRowColumn(new TextBlock().WithHorizontalAlignment(HorizontalAlignment.Center), 1, 0, 0, 2);

aTextBlock.Text = "Test A";
bTextBlock.Text = "Test B";
cTextBlock.Text = "Test C";

This PR also brings a new BackgroundMediaUtility to handle the background image/video routine.
Wait, I said "video" there? YES, I also added a support for Video Background. This is a long-waited feature that we have struggled to implement but finally, we are managed to implement this feature thanks to the new BackgroundMediaUtility and its interface to make the implementation easier and more unified.


Video Background Support Overview

2024-04-08.04-22-13.webm

Instant Region Change Overview

  • Instantly change the region when selected game or region is changed.
  • Hide the "Change" button.
  • Enabled by default when "Show Region Warning" is disabled

image

Video Showcase

20240331-0431-38.1779307.mp4

Required PR

Copy link

github-actions bot commented Mar 20, 2024

Qodana for .NET

268 new problems were found

Inspection name Severity Problems
Possible 'System.NullReferenceException' 🔶 Warning 33
Virtual member call in constructor 🔶 Warning 21
Invalid XML documentation comment 🔶 Warning 17
Possible 'null' assignment to non-nullable entity 🔶 Warning 14
Incorrect indent (around child statement) 🔶 Warning 13
Bitwise operation on enum is not marked by [Flags] attribute 🔶 Warning 13
Expression is always 'true' or always 'false' 🔶 Warning 10
Conditional access qualifier expression is known to be null or not null 🔶 Warning 10
Return value of [MustUseReturnValue] annotated method is not used 🔶 Warning 10
Assignment is not used 🔶 Warning 10
Redundant catch clause 🔶 Warning 10
Non-readonly type member referenced in 'GetHashCode()' 🔶 Warning 9
Parameter hides member 🔶 Warning 8
Redundant base constructor call 🔶 Warning 6
Redundant type declaration body 🔶 Warning 6
Unused local variable 🔶 Warning 6
'??' condition is known to be null or not null 🔶 Warning 5
Possible overflow in unchecked context 🔶 Warning 5
Non-accessed local variable 🔶 Warning 5
Underlying type of enum is 'int' 🔶 Warning 4
Heuristically unreachable code 🔶 Warning 4
Unsafe context declaration is redundant 🔶 Warning 4
Use null check pattern instead of a type check succeeding on any not-null value 🔶 Warning 3
Empty general catch clause 🔶 Warning 3
Mismatch of optional parameter value in overridden method 🔶 Warning 3
Possible 'System.InvalidOperationException' 🔶 Warning 3
Redundant cast 🔶 Warning 3
Redundant lambda expression parameter type specification 🔶 Warning 3
Possible null reference argument for a parameter. 🔶 Warning 2
Member initialized value ignored 🔶 Warning 2
Redundant 'partial' modifier on type declaration 🔶 Warning 2
Possible loss of fraction 🔶 Warning 2
Property value is equal to style-provided 🔶 Warning 2
Avoid using 'async' lambda when delegate type returns 'void' 🔶 Warning 1
Collection content is never queried (private accessibility) 🔶 Warning 1
Expression is always 'true' or 'false' according to nullable reference types' annotations 🔶 Warning 1
Conditional access qualifier expression is not null according to nullable reference types' annotations 🔶 Warning 1
Empty constructor 🔶 Warning 1
Non-accessed field (private accessibility) 🔶 Warning 1
Cannot resolve symbol in text argument 🔶 Warning 1
Redundant 'partial' modifier on method declaration 🔶 Warning 1
The source expression always matches the provided pattern 🔶 Warning 1
Redundant explicit type in array creation 🔶 Warning 1
Redundant control flow jump statement 🔶 Warning 1
Redundant nullable directive 🔶 Warning 1
Redundant nullable warning suppression expression 🔶 Warning 1
Return value of pure method is not used 🔶 Warning 1
Do not use object initializer for 'using' variable 🔶 Warning 1
Missing grid column/row setter for non-first child 🔶 Warning 1
Redundant resource 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

Shatyuka and others added 7 commits March 21, 2024 01:59
(waifu2x) Handle Vulkan initialization exception

(waifu2x) Fix crash when exiting from console

(waifu2x) Fix black output checker

Fix NullReferenceException while trying to get alt. CDN stream

Fix exception while generating local app notification

[skip ci] Sync translation Translate en_US.json in id_ID

100% reviewed source file: 'en_US.json'
on 'id_ID'.

[skip ci] Sync translation Translate en_US.json in fr_FR [Manual Sync]

100% reviewed source file: 'en_US.json'
on 'fr_FR'.

Check process existence for GameBoost

Fix join Discord button crash

(GLC) Disable spellcheck on commands input textbox

Fix tray icon not disposed on close

Also contains failed attempt at fixing multi instance tray icon

Add AssemblyName to properties

Organize InvokeProp.cs

(TrayIcon) Use SecondWindow mode on Preview

Update NuGet(s)

Markdig
- Add support for GitHub markdown alert
xoofx/markdig#774

- WASDK
seems to only documentation changes and some dependencies update...
microsoft/WindowsAppSDK@v1.5.0...v1.5.1

Remove unused arm64 lib after build

Bump version

Remove space on AssemblyName

Move close method to use CloseApp()

Also do the same for TrayIcon stuff

Get the ref pointer to the array explicitly in BSDiff
Fix Genshin repair

Switch from reflection based json serialization

Set assembly infos

(TrayIcon) Fix multi instance disappearing tray icon

Now set both console and main window name if >1 instance is found using `- #x` prefix

Simplify ChangeTitleDragArea

Fix default drag area overlapping the region selector
@neon-nyan neon-nyan marked this pull request as draft March 22, 2024 22:02
@neon-nyan neon-nyan self-assigned this Mar 22, 2024
@neon-nyan neon-nyan added the Area: UI/UX Issue labeled for User Interface/eXperience related issue label Mar 22, 2024
neon-nyan and others added 4 commits March 24, 2024 02:38
- Removing BackgroundManagement and replacing it with BackgroundImageUtility
- Move BackgroundImageUtility source to a proper folder
- Move Color Palette generation related code to its own ColorPaletteUtility class
- Adding StillImageLoader to load still image
- Adding interface to be used by later implementation of Video Background support
Please do not use merge & squash for syncing a branch....
@neon-nyan neon-nyan marked this pull request as ready for review March 29, 2024 19:36
@bagusnl bagusnl changed the title UI Changes and Runtime Improvements (Part 2) [SANITIZE PHASE] UI Changes and Runtime Improvements (Part 2) Apr 7, 2024
@neon-nyan
Copy link
Member Author

neon-nyan commented Apr 9, 2024

All the changes are finished and no more changes on my end will be pushed.
Feel free If you guys have other changes need to be pushed before we can move into finalization step.

I will be summarizing all the changes that I made into this PR later.
Summary has been moved to #450 and written by @bagusnl

@bagusnl bagusnl mentioned this pull request Apr 11, 2024
@bagusnl bagusnl merged commit 17e6be3 into main Apr 12, 2024
3 of 4 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Runtime Issue labeled for runtime, Hi3Helper.Core and other libraries used by Collapse Area: UI/UX Issue labeled for User Interface/eXperience related issue Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: If Collapse updates while game is running, playtime counter does not restart after update.
4 participants