Ciao Tiziano, here is the explanation.
What you see with the base64 image is the local javascript image cache implemented in Wisej client side components. There is also a bit more complexity to this related to using images in cells because cells in a datagrid are not components, they don’t exists as javascript components since they are rendered on demand when scrolling. So:
But:
Additionally, looking at the sample:
Your sample could be
dataGridView1.Rows.Add(row1);
dataGridView1.Rows.Add(row2);
dataGridView1[0, 0].Value = “resource.wx/Wisej.Ext.MaterialDesign/android-logo.svg?color=#fca326”;
dataGridView1[0, 1].Value = “resource.wx/Wisej.Ext.MaterialDesign/android-logo.svg”;
Or
dataGridView1.SetValue(0, 0, “resource.wx/Wisej.Ext.MaterialDesign/android-logo.svg?color=#fca326”);
dataGridView1.SetValue(0, 1, “resource.wx/Wisej.Ext.MaterialDesign/android-logo.svg”);
Using SetValue() prevents the forced creation of a row when the grid is data bound.
HTH
First of all, thank you for your help.
I attach the project, and I think I understand one more detail.
In the project I load a DataGridView with two rows. The first column will contain the images whose render of our discussion.
The first row has an image with the color changed ( directive ?color=#…).
“resource.wx/DG.Ext.Font/lock.svg?color=#fca326”
The second row has a natural unmanipulated svg image (black)
“resource.wx/DG.Ext.Font/fax.svg”
It appears that color modification excludes from simple cashing.
In fact, by pressing F12 and hovering over the respective images, the first one is inline with many fonts, the second one has been downloaded to the browser’s source folder.
In fact, going to “Sources” and expanding the folders in the subfolder of “localhost:5000” > “resource.wx > DG.Ext.Font” we find the image of the second row of the table “fax.svg” (see the attachment Screenshot.png)
I wanted to ask you if you think the problem doesn’t exist, so should I ignore the inline of the first immegine because the browser will take care of it or should I pose the problem in pages where colored .svg’s are used to save having to load them in the resource file.
Bests Regards
Tiziano
Hi Andrew,
We have identified an issue similar to this one and fixed it.
The fix will be released with the new 3.2.4 release of Wisej.NET.
Best,
Alaa
Thanks!
We don’t produce any HTML. The html you see is Chrome’s representation of the DOM. Base64 sources are used routinely by our local image caching system and improve performance by a lot. Wisej doesn’t assemble or concatenate HTML, it uses dom elements directly (through a shadow fast dom system). When you inspect the HTML chrome rebuilds the HTML representation. Otherwise our HTML is simply the empty Default.html page.
Can you attach a small runnable sample project so we can give you a better explanation on why the URL is used in one case and why the base64 is embedded in another?
Hi Jun,
All Widgets / Containers have the “ShowLoader” property, you can control the “Spinner” that way.
There are a lot of samples in the forum, as a starting point please visit https://wisej.com/support/question/asyncawait-best-practices-in-wisej for more info!
Best,
Alaa
Hi Alaa,
There is no requirement, I can just use
Application.Session.MyVar = “value”;
But I saw this example in your migration documentation like this:
// Session is a dynamic object
Application.Session.MyVar1 = 1;
Application.Session.MyVar2 = “Test”;
// Statics moved to session
MyClass.Static1 = “Hello”;
// Becomes
Statics.MyClass.Static1 = “Hello”;
// It’s an easy search/replace.
Statics {
MyClass { get {
return Application.Session.MyClass; }}}
Wrapping your Session variables in a static class is just a little easier as the Variables are type casted and you don’t have to remember what they were you cant just type “Statics.” in VS and all your Session variables show up.
But since it’s a static class I was wondering about thread safety, maybe bad idea.
Thanks,
Devin
Hi Devin,
I’m not sure I understand the requirement, why would you “need” to wrap everything in a Static class?
The Application.Session is a dynamic class, you can have anything assigned to it.
“I thought I saw in an example this was how you could change static variables to session variables.” We strongly recommend using Session variables instead of static classes, not the other way around as it makes more sense in a web application.
HTH,
Alaa
Hi Kurt,
The placeholder is shown when the textbox is empty and the Date native textbox is managed by the browser, that means depending on what browser you’re using to test the textbox, it can’t be selected.
It’s not a Wisej.NET issue.
Best,
Alaa
Hello,
We do have the FullCalendar extension that looks similar to the screenshot you sent, did you take a look at that ?
Best,
Alaa
There’s not a C# property for this, so you have to do it in JavaScript.
You can do this through the following line of JavaScript code:
this.widget.chart.scales['x-axis-0'].labelRotation = 90
You can use the Eval function to call JavaScript from C# code
chartJS1.Eval(@"this.widget.chart.scales['x-axis-0'].labelRotation = 90");
You MUST put this code as part of the Page Appear Event. If you put the code as part of the Page Load event, you will get the following error: “Cannot read properties of undefined (reading ‘chart’)” Essentially, you must make sure the chart in the widget is initialized before this code runs.
private void Page1_Appear(object sender, EventArgs e)
{
chartJS1.Eval(@"this.widget.chart.scales['x-axis-0'].labelRotation = 90");
}
You can add labels in the Page Load event like so:
chartJS1.Labels = new string[] {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"};
You can use similar code to modify the rotation of the labels on the y axis:
this.widget.chart.scales['y-axis-0'].labelRotation = 45
I have attached a sample.
-Julie
Hi Alaa,
Thank you for your answer and example. I am not sure this is the issue I am having, I think the problem I am having is in static class functions in my library are not thread safe. Anyways could you verify something for me, I want to make sure how I am handling Session variables is thread safe.
I made a static class for my Application.Session look ups like this.
public static class AppSession
{
public static IConfig Config { get { return (IConfig)Application.Session.Config; } set { Application.Session.Config = values; } }
public static IUser User { get { return (IUser)Application.Session.User;} set {Application.Session.User = value; } }
}
then in my code event I would
private async void myForm_DisplayUser(object sender, EventArgs e)
{
var user = AppSession.User;
lblUserName.Text = User.Username;
Application.Update(this);
}
Would putting your Application Session variables in a static class a bad idea? I thought I saw in an example this was how you could change static variables to session variables.
Thanks,
Devin
Hi Ali, the meaning of “concurrent clients” is explained here:
https://docs.wisej.com/license/license-model-2023/server-licenses#concurrent-clients
The Wisej.NET Community Edition might be sufficient in your scenario, but please keep in mind that there are some limitations around commercial use. As long as these are met, feel free to use it!
https://docs.wisej.com/license/license-model-2023/community-edition
Best
Thomas
Hi Devin,
Attached is a sample to demonstrate how you could use async tasks with Wisej.NET.
You’ll have to use Application.StartTask with whatever method you’d want to use for it to be ran on the “Current context”.
HTH,
Alaa
Here’s an example from the ChartJS documentation, in case you find it helpful: https://masteringjs.io/tutorials/chartjs/two-y-axes#:~:text=To%20add%20more%20axes%20to,chart%20has%20two%20Y%20axes (It’s written in JavaScript, not C#, but it can give you an idea of the relevant property names).
Here’s how to do it in Wisej.NET:
1.Create a new Wisej project and install the Wisej-3-ChartJS NuGet Package.
2. Add a new ChartJS in the designer. It will be named chartJS1 if you don’t change the default name.
3. Add this to the Page1_Load() function:
//Add a new dataset so we have some points on our example chart
object[] array1 = new object[] { 1, 3, 5, 7, 9 };
chartJS1.DataSets.Add("Data Set").Data = array1;
//Access the y axis and set the position to the right side of the graph
var firstyaxis = chartJS1.Options.Scales.yAxes[0];
firstyaxis.Position = HeaderPosition.Right;
//Create a second Y axis
var newYaxis = new OptionScalesAxesY();
//uncomment this if you want the newly created Y axis to be the one on the right
//newYaxis.Position = HeaderPosition.Right;
//Set the Y axes of the chart so that it has 2 axes.
chartJS1.Options.Scales.yAxes = new OptionScalesAxesY[] { firstyaxis, newYaxis };
I’ve also attached a sample.
-Julie
Hi Manu,
SQLite is tricky to get up in dotnet 4.x and seems impossible to get Entity Framework 6 to work with it, although SQLite is supposed to work with EF in Core, I don’t know why it’s not backported from core to .net?
Solution : Maybe use MsLocalDb from SqlLocalDB.msi via SQL Server Express LocalDB – SQL Server as per EFDesigner2022/src/Examples at master · msawczyn/EFDesigner2022 (github.com) or SqlServer Express although these are both out of process and require admin rights to install support software
Problem: EF 6 does not offer code first for SQLite in .net. EF Core supports code first and migrations for SQLite.
Failing to get a working: Wisej, Sqlite Ef6 and .net48 example at Opzet/WjSqlite (github.com)
Web.config changes required to register provider and Factory.
<configSections>
<!-- For more information on Entity Framework configuration, visit ... -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="sqliteCon" connectionString="Data Source=|DataDirectory|db.sqlite;" providerName="System.Data.SQLite.EF6" />
</connectionStrings>
Step 1:
Install SQLite in GAC
Download the latest sqlite-netFx46-setup-bundle-x86-2015-1.0.xxx.0.exe
a. Select “Full Installation”
b. Select:
– Install the assemblies into the global assembly cache
– Install VS designer components
Step 2: Sqlite provider and engine
Install-Package System.Data.SQLite
Step 3: Entityframework ORM – EF 6.4.4
Tools> NuGet Package Manager> Package Manager Console
Install-Package EntityFramework -Version 6.4.4
Step 4 :Download and install Entity Framework Visual Editor
https://marketplace.visualstudio.com/items?itemName=michaelsawczyn.EFDesigner2022
Visual EFDesigner is github tool makes light work database work Entity Framework Designer 2022: Entity Framework visual design surface (github.com) it has lots of examples too EFDesigner2022/src/Examples at master · msawczyn/EFDesigner2022 (github.com) [ btw I am the author 😉 ]
David
For background processing I am using successfully the Windows Task Scheduler to run a separate stand-alone process (command line exe file).
That process is polling in a database queue and does as requested.
This has also an advantage of decoupling the concerns, the memory management and the releases.
From withing WiseJ the Task Scheduler can be easily managed with a NuGet Extension (https://github.com/dahall/taskscheduler) .
Hi Manfred,
usually, Web servers don’t do anything without a browser request.
IIS has a way to preload an assembly on startup and possibly invoke a method to register a module.
It´s maybe possible to start a thread there. But you´d have to look that up and experiment on your own.
Unfortunatly, it’s outside of Wisej.NET scope.
Hope that helps anyways.
Best regards
Frank
You can replace the & with && to have the & displayed and not treated as an indicator for the mnemonic.
Otherwise replace the & with just nothing.
&& is a bit like an escape sequence. Similar to how \n is newline, but \\ is just \.
Thanks, Frank. I tried this very thing with the version I am working with (2.2.x) and it didn’t work. Just want to confirm that this got fixed in more recent versions and I am not missing anything.
