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

Use webview2 control, fix background color of webview #182

Merged
merged 9 commits into from
Dec 17, 2023

Conversation

DineshSolanki
Copy link
Owner

No description provided.

The async tasks 'GetBitmap' and 'GetMovieTrailer' methods have been refactored for readability and performance. The async/await semantics are now properly used instead of 'ContinueWith'. Moreover, an exception handling block has been added to 'GetMovieTrailer' method to log any errors during the movie trailer fetching process.
Optimized the process of choosing YouTube trailers from a collection in SearchResultViewModel. Replaced a sequential Any-First search pattern with more efficient FirstOrDefault. Additionally, updated Dispatcher.Invoke to Dispatcher.InvokeAsync in HtmlBox.xaml.cs to ensure the method is called asynchronously while keeping UI responsiveness.
This commit introduces the replacement of WebBrowser with WebView2 in the HtmlBox view of the FoliCon application. The WebView2 control provides more capabilities and better performance compared to the older WebBrowser control. Accordingly, the code is modified to use the functionality of WebView2, which includes the 'NavigateToString' method being called on the 'CoreWebView2' object instead of the outdated 'Browser' object. The 'InitializeAsync' method has also been added to ensure the WebView2 control is correctly initialized.
This commit primarily refactors HtmlBox's ProcessBrowse method to streamline its operations. A minor change to the _backgroundColor method is also included, adjusting color values for dark themes. The dependency property OnHtmlTextPropertyChanged has been tweaked to ensure proper access, and InitializeAsync has been updated to manage Browser settings and navigation.
A constant string value was revised for better readability in the conditional statement. The structure of the HTML code inside GenerateHtmlContent() method was also reorganized for cleaner representation. The 'IE=Edge' meta tag was removed as it's no longer necessary.
The project file FoliCon.csproj has been updated to include the Microsoft.Web.WebView2 package. This new addition, with version 1.0.2210.55, will be used for showing media videos instead of the old control.
The IsVideoAvailable property is now implemented with a getter method and simplified html generation logic by introducing an HtmlTemplate constant. Additionally, checks for video availability have been moved directly into the OnHtmlTextPropertyChanged event handler, leading to enhanced code maintainability and readability.
A new word, 'FoliCon', is added to the UserDictionary within the solution's DotSettings configuration. This addition helps with IDE spell-checking, as it will now recognize 'Foli' as a valid word and won't mark it as a spelling error.
@DineshSolanki DineshSolanki self-assigned this Dec 17, 2023
@DineshSolanki DineshSolanki added the enhancement New feature or request label Dec 17, 2023
@DineshSolanki DineshSolanki merged commit 8c1239c into master Dec 17, 2023
2 checks passed
@DineshSolanki DineshSolanki deleted the chore/performance branch December 17, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant