- ago
Hi community,

currently i try to find out how to add my glyph icon to the dataset.
My goal is to have the icon beside the dataset in the datasets tree view,
like in this image.


As statet in the documentation, there should be an image property for that:
https://www.wealth-lab.com/Support/ApiReference/DataSet#Glyph

So i tried to find it on the dataset type, which only offers a Glyphresource property of type string.


What do i have to enter here??

i am using the glyphmanager already to get my embedded icon ressource to be shown in the extension method which works, but i have no idea how that glyphresource property interacts with.

Kind regards
Mike
0
486
Solved
11 Replies

Reply

Bookmark

Sort
Cone8
 ( 4.83% )
- ago
#1
The reference to the embedded resource should just be the project name (e.g., My.Provider) followed by the project path and file name using dot field separators.

e.g.
My.Provider.Images.MyGlyph.png
0
- ago
#2
as in the documentation stated i followed the rule described with the glyphmanager.
here is a screenshot of a simple solution where its not working.
maybe you can tell me what string i have to put in the glyphresource property.
the same icon is actually working using the glyphmanager.



kind regards
Mike

btw i did not mark your answer as solved yet
0
- ago
#3
Mike,
It seems like you're referencing a non-existent resource or you're providing the wrong format in the string for the reference. For example, the following shows the candlesticks a-ok in the tree:

CODE:
using System.Collections.Generic; using WealthLab.Core; using WealthLab.Data; namespace WL8Extensions { public class MyDataSetProvider : DataSetProviderBase { private List<DataSet> _dataSet; public override List<DataSet> DataSets => _dataSet; public override string Name => "Provider Name"; public override void Initialize() { base.Initialize(); var anyDS = new DataSet { Name = "Name it", GlyphResource = "WealthLab.Candlesticks.WPF.Glyphs.Candlesticks.png", Symbols = ["SPY"] }; _dataSet = [anyDS]; } } }
0
- ago
#4
glad you gave an example,
unfortunatley its not working, therefore i quickly share the project.
i used your example only.
hope i can share the transfer link. its a zipped sln.
if you have installed wealthlab at a different location, change it in the launchsettings.json.
The solution will auomatically put the build into the wealth lab bin folder after successull build
if its working on your side i will give it a try reinstalling wealthlab.
i am developing on win11 pro mashine using latest vs 2022 comunity edition.

/LINK REMOVED by Eugene/

kind regards
0
- ago
#5
I get a DNS probe on the link, but that's probably on my side. But before persuing that further, are you sure you're not overlooking a workflow sequence problem?

So, you're developing in VS and building a DLL.
Build the DLL.
Exit WealthLab.
Copy the DLL over into the WealthLab folder (where all of it's DLLs are).
Run WealthLab.

I have a workflow for doing that for my extensions, but sometimes I forget a step and therefore I'm not getting the new DLL, and then I wonder why my changes didn't get picked-up. Check you're not just making a workflow sequence error.
0
- ago
#6
i have forgotten to say that i have set the launchprofile to start wealthlab.exe after the build and copy is done. my symbols get loaded too, so it should be fine.

in case you cant read the zip, here some content.

project file content - i have embedded a folder with the resource image.
CODE:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0-windows</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>disable</Nullable> <UseWPF>true</UseWPF> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <Platforms>x64</Platforms> <!-- Enter your individual wealth lab installation folder, inkluding trailing slash. --> <WealthLabInstallationFolder>C:\Program Files\Quantacula, LLC\WealthLab 8\</WealthLabInstallationFolder> </PropertyGroup> <ItemGroup> <None Remove="Resources\user.png" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\user.png" /> </ItemGroup> <ItemGroup> <Reference Include="WealthLab.Core"> <HintPath>$(WealthLabInstallationFolder)WealthLab.Core.dll</HintPath> </Reference> <Reference Include="WealthLab.WPF"> <HintPath>$(WealthLabInstallationFolder)WealthLab.WPF.dll</HintPath> </Reference> <Reference Include="WealthLab.ChartWPF"> <HintPath>$(WealthLabInstallationFolder)WealthLab.ChartWPF.dll</HintPath> </Reference> </ItemGroup> <Target Name="PostBuild" AfterTargets="PostBuildEvent"> <ItemGroup> <FilesToCopy Include="$(TargetDir)WLExtension.*" /> </ItemGroup> <Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(WealthLabInstallationFolder)" /> </Target> </Project>


the launchsettings.json
CODE:
{ "profiles": { "Profile 1": { "commandName": "Executable", "executablePath": "$(WealthLabInstallationFolder)WealthLab8.exe", "workingDirectory": "$(WealthLabInstallationFolder)" } } }


and finally the whole WLExtension.cs file.
CODE:
using WealthLab.Core; using WealthLab.Data; namespace WLExtension { public class MyDataSetProvider : DataSetProviderBase { private List<DataSet> _dataSet; public override List<DataSet> DataSets => _dataSet; public override string Name => "Provider Name"; public override void Initialize() { base.Initialize(); var anyDS = new DataSet { Name = "Name it", GlyphResource = "WealthLab.Candlesticks.WPF.Glyphs.Candlesticks.png", Symbols = ["SPY"] }; _dataSet = [anyDS]; } } }


0
- ago
#7
QUOTE:
unfortunatley its not working, therefore i quickly share the project.

You can try to share a Github repo but please do not post here links to lesser known file transfer services. Thanks.
0
- ago
#8
Mike,

The candlesticks.png is in WealthLab.Candlesticks.WPF.DLL which might be from the candlesticks extension (I don't know), and you might not have that installed. So, try this instead. Reference the Short.png that is in the WealthLab.Core DLL which you're sure to have. That is,

GlyphResource = "WealthLab.Core.Glyphs.Short.png",

Try that. I get the big green short triangle.
0
Glitch8
 ( 11.08% )
- ago
#9
This was a bit tricky, but here's the problem and the solution.

The GlyphManager sees that you're trying to load a Glyph for a plain vanilla DataSet, and has no way of knowing what assembly to look in to find your resource.

The solution is to provide the GlyphManager the information that your named GlyphResource resides in your DLL. The GlyphManager will add the image to a Dictionary and then it will be able to find it when resolving the GlyphResource for your DataSet.

Change your Initialize method like this:

CODE:
public override void Initialize() { base.Initialize(); _ = GlyphManager.GetImageSource("WLExtension.Resources.user.png", this); var anyDS = new DataSet { Name = "Name it", GlyphResource = "WLExtension.Resources.user.png", Symbols = ["SPY"] }; _dataSet = [anyDS]; }


Sending "this" in the first GlyphManager call provides the GlyphManager the instance of your DataSetProvider, and using that it can get the assembly to use to load the glyph.

Also note that named my assembly WLExtension and not WL.Extension like you did, so be sure to use the right assembly name.
1
Best Answer
- ago
#10
yeah, that was a tough one. you saved my day.
that did the trick.
Thank you very much.
0
Glitch8
 ( 11.08% )
- ago
#11
I’ll make a note to update the documentation with this!
1

Reply

Bookmark

Sort