Skip to content

Commit

Permalink
[DYN-2316] feature: consume librarie.js as npm package (#15228)
Browse files Browse the repository at this point in the history
Co-authored-by: enzo707 <[email protected]>
Co-authored-by: pinzart90 <[email protected]>
Co-authored-by: Aaron (Qilong) <[email protected]>
Co-authored-by: Ashish Aggarwal <[email protected]>
Co-authored-by: Craig Long <[email protected]>
Co-authored-by: Trygve Wastvedt <[email protected]>
Co-authored-by: pinzart90 <[email protected]>
Co-authored-by: Deyan Nenov <[email protected]>
Co-authored-by: Trygve Wastvedt <[email protected]>
  • Loading branch information
10 people authored May 23, 2024
1 parent 6144f8c commit e223c97
Show file tree
Hide file tree
Showing 80 changed files with 237 additions and 179 deletions.
35 changes: 35 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,41 @@ public static MessageBoxResult Show(Window owner, string messageBoxText, string
return dynamoMessageBox.CustomDialogResult;
}

/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
/// </summary>
/// <param name="owner">owning window of the messagebox</param>
/// <param name="messageBoxText">Content of the message</param>
/// <param name="caption">MessageBox title</param>
/// <param name="flags">Provide a list of flags that can be used to customize the dialog box, e.g Scrollable</param>
/// <param name="button">Type of button shown in the MessageBox: Ok, OkCancel; etc</param>
/// <param name="icon">Type of message: Warning, Error</param>
/// <returns></returns>
public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, Dictionary<DialogFlags, bool> flags, MessageBoxButton button,
MessageBoxImage icon)
{
var dynamoMessageBox = new DynamoMessageBox
{
BodyText = messageBoxText,
TitleText = caption,
MessageBoxButton = button,
MessageBoxImage = icon
};
if (owner != null && owner.IsLoaded)
{
dynamoMessageBox.Owner = owner;
}

if (flags.TryGetValue(DialogFlags.Scrollable, out bool scrollable) && scrollable)
{
dynamoMessageBox.BodyTextBlock.Visibility = Visibility.Collapsed;
dynamoMessageBox.ScrollableBodyTextBlock.Visibility = Visibility.Visible;
}
dynamoMessageBox.ConfigureButtons(button);
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}

/// <summary>
/// Displays a dialog to the user and returns their choice as a MessageBoxResult.
/// </summary>
Expand Down
44 changes: 22 additions & 22 deletions src/LibraryViewExtensionWebView2/LibraryViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private string ReplaceUrlWithBase64Image(string html, string minifiedURL, bool m
{
minifiedURL = $"{magicstringprod}\"{minifiedURL}\"";
}
var searchString = minifiedURL.Replace(magicstringprod, @"./dist").Replace("\"", "");
var searchString = minifiedURL.Replace(magicstringprod, @"./dist/").Replace("\"", "");
var base64 = iconProvider.GetResourceAsString(searchString, out ext);
if (string.IsNullOrEmpty(base64))
{
Expand Down Expand Up @@ -287,23 +287,23 @@ private string ReplaceUrlWithBase64Image(string html, string minifiedURL, bool m
//list of resources which have paths embedded directly into the source.
private readonly Tuple<string, bool>[] dynamicResourcePaths = new Tuple<string, bool>[]
{
Tuple.Create("/resources/ArtifaktElement-Bold.woff",true),
Tuple.Create("/resources/ArtifaktElement-Regular.woff",true),
Tuple.Create("/resources/bin.svg",true),
Tuple.Create("/resources/default-icon.svg",true),
Tuple.Create("/resources/library-action.svg",true),
Tuple.Create("/resources/library-create.svg",true),
Tuple.Create("/resources/library-query.svg",true),
Tuple.Create("/resources/indent-arrow-category-down.svg",true),
Tuple.Create("/resources/indent-arrow-category-right.svg",true),
Tuple.Create("/resources/indent-arrow-down.svg",true),
Tuple.Create("/resources/indent-arrow-right.svg",true),
Tuple.Create("/resources/plus-symbol.svg",true),
Tuple.Create("/resources/search-detailed.svg",true),
Tuple.Create("/resources/search-filter.svg",true),
Tuple.Create("/resources/search-filter-selected.svg",true),
Tuple.Create("/resources/search-icon.svg",true),
Tuple.Create("/resources/search-icon-clear.svg",true)
Tuple.Create("resources/ArtifaktElement-Bold.woff",true),
Tuple.Create("resources/ArtifaktElement-Regular.woff",true),
Tuple.Create("resources/bin.svg",true),
Tuple.Create("resources/default-icon.svg",true),
Tuple.Create("resources/library-action.svg",true),
Tuple.Create("resources/library-create.svg",true),
Tuple.Create("resources/library-query.svg",true),
Tuple.Create("resources/indent-arrow-category-down.svg",true),
Tuple.Create("resources/indent-arrow-category-right.svg",true),
Tuple.Create("resources/indent-arrow-down.svg",true),
Tuple.Create("resources/indent-arrow-right.svg",true),
Tuple.Create("resources/plus-symbol.svg",true),
Tuple.Create("resources/search-detailed.svg",true),
Tuple.Create("resources/search-filter.svg",true),
Tuple.Create("resources/search-filter-selected.svg",true),
Tuple.Create("resources/search-icon.svg",true),
Tuple.Create("resources/search-icon-clear.svg",true)
};

async void InitializeAsync()
Expand Down Expand Up @@ -358,10 +358,10 @@ private void Browser_CoreWebView2InitializationCompleted(object sender, CoreWebV
LibraryView view = new LibraryView(model);

var lib_min_template = "LIBPLACEHOLDER";
var libHTMLURI = "Dynamo.LibraryViewExtensionWebView2.web.library.library.html";
var libHTMLURI = "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS.library.html";
var stream = LoadResource(libHTMLURI);

var libMinURI = "Dynamo.LibraryViewExtensionWebView2.web.library.librarie.min.js";
var libMinURI = "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS.build.librarie.min.js";
var libminstream = LoadResource(libMinURI);
var libminstring = "LIBJS";
var libraryHTMLPage = "LIBRARY HTML WAS NOT FOUND";
Expand Down Expand Up @@ -658,11 +658,11 @@ private static void NotifySearchModelUpdate(ILibraryViewCustomization customizat
/// <param name="customization"></param>
private void InitializeResourceProviders(DynamoModel model, LibraryViewCustomization customization)
{
var dllProvider = new DllResourceProvider("http://localhost/dist", "Dynamo.LibraryViewExtensionWebView2.web.library");
var dllProvider = new DllResourceProvider("http://localhost/dist", "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS");
iconProvider = new IconResourceProvider(model.PathManager, dllProvider, customization);
nodeProvider = new NodeItemDataProvider(model.SearchModel, iconProvider);
searchResultDataProvider = new SearchResultDataProvider(model.SearchModel, iconProvider);
layoutProvider = new LayoutSpecProvider(customization, iconProvider, "Dynamo.LibraryViewExtensionWebView2.web.library.layoutSpecs.json");
layoutProvider = new LayoutSpecProvider(customization, iconProvider, "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS.layoutSpecs.json");
}

private void DynamoSliderValueChanged(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit e223c97

Please sign in to comment.