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

Dyn 5118 webview2 library #13330

Merged
merged 6 commits into from
Oct 4, 2022
Merged

Dyn 5118 webview2 library #13330

merged 6 commits into from
Oct 4, 2022

Conversation

RobertGlobant20
Copy link
Contributor

Purpose

Changes for replacing the WebBrowser component in Library by WebView2 component:
(Please keep in mind that most of the files were copied from LibraryViewExtensionMSWebBrowser to LibraryViewExtensionWebView2, only around 9 files were changed, so if you want to see the real changes you will need to compare both folders with a tool like Meld or WinMerge).

  • I added a new .NET 4.8 VS Library Project that will display the Library using WebView2
  • All the files from "LibraryViewExtensionMSWebBrowser\Handlers" were copied to "LibraryViewExtensionWebView2\Handlers" without modifications.
  • All the files from "LibraryViewExtensionMSWebBrowser\ViewModels" were copied to "LibraryViewExtensionWebView2\ViewModels" without modifications.
  • All the files from"LibraryViewExtension\web\library\resources" were copied to "LibraryViewExtensionWebView2\web\library\resources" without modifications.
  • The next files were copied from "LibraryViewExtensionMSWebBrowser" without modifications: EventObserver.cs, LibraryViewCustomization.cs, LibraryViewToolTip.cs
  • The files that were mainly modified/created are: LibraryViewController.cs, LibraryViewExtensionWebView2.csproj, ScriptingObject.cs, ViewExtension.cs, library.html, LibraryView.xaml

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

Release Notes

Changes for replacing the WebBrowser component in Library by WebView2 component:

Reviewers

@QilongTang

FYIs

I did the next changes for replacing the WebBrowser component in Library by WebView2:
- I added a new  .NET 4.8 VS Library Project that will display the Library using WebView2
- All the files from "LibraryViewExtensionMSWebBrowser\Handlers" were copied to "LibraryViewExtensionWebView2\Handlers" without modifications.
- All the files from "LibraryViewExtensionMSWebBrowser\ViewModels" were copied to "LibraryViewExtensionWebView2\ViewModels" without modifications.
- All the files from"LibraryViewExtension\web\library\resources" were copied to "LibraryViewExtensionWebView2\web\library\resources" without modifications.
- The next files were copied from "LibraryViewExtensionMSWebBrowser" without modifications: EventObserver.cs, LibraryViewCustomization.cs, LibraryViewToolTip.cs
- The files that were mainly modified/created are: LibraryViewController.cs, LibraryViewExtensionWebView2.csproj, ScriptingObject.cs, ViewExtension.cs, library.html, LibraryView.xaml
@RobertGlobant20
Copy link
Contributor Author

GIF showing the Library behavior in DynamoSandbox.
LibraryWebView2 Behavior

@RobertGlobant20
Copy link
Contributor Author

GIF showing the behavior in DynamoRevit.
LibraryWebView2 Revit Behavior

</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
</PropertyGroup>
Copy link
Contributor

@QilongTang QilongTang Sep 22, 2022

Choose a reason for hiding this comment

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

These are not needed and handled by the copy step

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@QilongTang I did similar changes like the ones you did for switch from cefSharp to WebBrowser component, I think is you don't specify an output path it will take the one from "$(SolutionDir)Config\CS_SDK.props" (it will be generating the dll files in Dynamo\bin\AnyCPU\Debug).
Please check the changes done for switching to WebBrowser:
https://github.com/DynamoDS/Dynamo/pull/11957/files

@QilongTang
Copy link
Contributor

Good stuff, can you summarize the changes from these files

LibraryViewController.cs, LibraryViewExtensionWebView2.csproj, ScriptingObject.cs, ViewExtension.cs, library.html, LibraryView.xaml

Fixing tests that were failing related to the change from WebBrowser to WebView2.
Also addressing some comments that Aaron suggested.
Some functionalities when interacting with the packages guide were broken like:
- highlight installed package (with glow animation).
- scrolldown automatically.
- show/hide dark overlay over Library
- show/hide Library when is not needed.
- Locate the Guide popup in the right place vertically next to Library

Basically the changes are to now use the WebView2.ExecuteScriptAsync() method and  passing the parameters correctly, additionally some methods were converted so async for supporting ExecuteScriptAsync() method.
Also I noticed that an extra argument for the js method findPackageDiv was added but not all the methods were updated so some functionalities were invalidated due to that.
Finally for scrolling down automatically the Library I had to find a specific section of the Library and then scrolling down, because otherwise was not working.
@RobertGlobant20
Copy link
Contributor Author

This is a GIF showing that the interaction between the Library and the Packages guide was fixed.
LibraryPackagesGuide_Interaction

@QilongTang QilongTang added this to the 2.17.0 milestone Oct 3, 2022
currentGuide.LibraryView = GuideUtilities.FindChild(mainRootElement, libraryViewName);
var dynamoView = (mainRootElement as DynamoView);
if (dynamoView == null) return;
currentGuide.LibraryView = dynamoView.sidebarGrid.Children.OfType<UserControl>().FirstOrDefault();
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we have a name we can refer to instead of lookup?

Copy link
Contributor Author

@RobertGlobant20 RobertGlobant20 Oct 3, 2022

Choose a reason for hiding this comment

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

@QilongTang I've tried to use a Name for it but when compiling there are errors, seems that is an issue with WebView2 and XAML files, I've reported this issue in the next channel:
https://autodesk.slack.com/archives/C042HLQU5HV/p1664561901005029

@QilongTang
Copy link
Contributor

Although this one looks good from review so far, I am holding on merging since release pipeline blocked for now

@QilongTang QilongTang merged commit 0bb974b into DynamoDS:master Oct 4, 2022
@QilongTang QilongTang deleted the DYN-5118-WebView2-Library branch October 4, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants