Hi Hadi,
Did you follow the guides in these videos?
https://docs.wisej.com/hybrid/development/local-application
If you still have issues, please send a video repeating the process from the videos and demonstrating the error to support AT wisej DOT com.
Thanks,
Levie
Hi there,
Populating a ComboBox with SerialPort.GetPortNames() doesn’t work.
The combobox remains empty?
SerialPort.GetPortNames() does return an array of the server ports, though.
The tutorial in question uses Dapper to access a SQLite database.
Some alternative ways to design this project would be:
– Read the data from a JSON file (The JSON file is your “database”)
– Create the data in C# code, as C# objects
– Use SQL commands to access a SQLite or SQL database (instead of using Dapper, we just write the code to connect to the database ourselves).
Each of these examples would have different code for creating new rows and editing existing rows, based on how it’s accessing the database, and what type of database it is.
The code to create a modal/popup is the same though.
Here is a sample that uses the simplest method- it creates the data in C# code, as C# objects. So this sample has no code for database access. The code just opens the modal and edits the data in the datagridview.
Some relevant bits of code from the sample:
This creates a BindingLIst, binds it to the DataSource of the datagridview, and then fills it with data: Note that data can be added to the BindingList before and after it is bound to the datagridview- it will all show up in the datagridview.
//Page1.cs
BindingList PeopleList = new BindingList(); //create empty BindingList
private void Page1_Load(object sender, System.EventArgs e)
{
PeopleList.Add(new Person() { FirstName = "John", LastName = "Doe", Age = 40 });
dataGridView1.DataSource = PeopleList; //bind the datagridview to the BindingList
PeopleList.Add(new Person() { FirstName = "Jane", LastName = "Doe", Age = 30 });
PeopleList.Add(new Person() { FirstName = "Tom", LastName = "Smith", Age = 21 });
PeopleList.Add(new Person() { FirstName = "Emily", LastName = "Brown", Age = 57 });
PeopleList.Add(new Person() { FirstName = "Susan", LastName = "Green", Age = 46 });
}
This code opens a modal dialog on button click. It also gets data from the modal dialog and uses that data to add a new entry to the table.
//Page1.cs
private void button1_Click(object sender, System.EventArgs e)
{
//dialog will not exist outside of this using statement
//handy because then it doesn't clog up memory and you don't have to remember to dispose of it.
using (var dialog = new ModalPopup())
{
dialog.ShowDialog();
PeopleList.Add(new Person() { FirstName = dialog.FirstName, LastName = dialog.LastName, Age = dialog.Age });
}
}
Here I attached an event handler to the CellEndEdit event. All it does is display a message. If you were connecting to an external database, this would be a good time to write data to the database,
//Page1.cs
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
AlertBox.Show("You edited a value. If we were connected to a database, this would be a great time to save it.");
}
The code for the modal popup is ModalPopup.cs and it looks like this. I created several public fields (FirstName, LastName, Age) to store the data. In the button1_Click event, I show an AlertBox, and assign values to the public variables. I then close the popup.
//ModalPopup.cs
public string FirstName { get; private set; }
public string LastName { get; private set; }
public int Age { get; private set; }
public ModalPopup()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
AlertBox.Show("submitted");
FirstName = textBox1.Text;
LastName = textBox2.Text;
Age = int.Parse(typedTextBox1.Text);
this.Close();
}
Hope this helps!
-Julie
If your javascript code is very simple, there’s an easier way to do this: you can just use Eval instead of Call. You will just put the entire contents of the function inside of Eval, like so:
Eval("javascript code here");
Here’s the documentation on using javascript in Wisej, you will find this helpful:
https://docs.wisej.com/docs/concepts/javascript
Note that it’s not enough to just create a .js file, like startup.js and put it in the solution.
There’s some extra steps to get the C# code (in this case CKEditor.cs) to access it:
1.
startup.js is an embedded resource. If you click on starup.js and look at the file properties, you will notice the build action is set to “embedded resource” (see screenshot)
2.
Look at this code from CKEditor.cs:
private string BuildInitScript()
{
IWisejControl me = this;
dynamic options = new DynamicObject();
string script = GetResourceString("Wisej.Web.Ext.CKEditor.JavaScript.startup.js");
options.config = this.Options;
options.fonts = this.FontNames;
options.basePath = CKEditor.BaseUrl;
options.showFooter = this.ShowFooter;
options.showToolbar = this.ShowToolbar;
options.externalPlugins = this.ExternalPlugins;
script = script.Replace("$options", options.ToString());
return script;
}
Specifically, we care about this line: string script = GetResourceString("Wisej.Web.Ext.CKEditor.JavaScript.startup.js"); This reads the contents of the file as a string from the embedded resource.
Note that some widgets like the CKEditor also rely on packages, those are the JS core packages of the component itself.
For example this cdn: https://cdn.ckeditor.com/4.12.1/full-all/
If you look at the Wisej extensions, which are open source on github, you can see some examples which are similar to what you are trying to do.
For example, if we look at the CKEditor code: https://github.com/iceteagroup/wisej-extensions/tree/3.2/Wisej.Web.Ext.CKEditor
From CKEditor.cs:
public bool ReadOnly
{
get { return this._readOnly; }
set
{
if (this._readOnly != value)
{
this._readOnly = value;
Call("setReadOnly", value);
}
}
}
private bool _readOnly = false;
You’ll notice it is calling the function setReadOnly and sending in the parameter value
The javascript code is located in the file startup.js, and looks like this:
// applies the read only state.
this.setReadOnly = function (value) {
try {
if (this.editor.readOnly != value)
this.editor.setReadOnly(value);
} catch (e) { }
}
So, instead of embedding your javascript in HTML, it should be in a .js file.
Hi Ruben,
Looks like you have some sort of a background process that’s constantly pushing data or firing events to the application.
It can also be a Timer component that you’re using to get data?
Best,
Alaa
//
Hi Ali,
We have some documentation here for Wisej.NET Hybrid which should help explain some of the topics you saw in the session:
https://docs.wisej.com/hybrid/start/introduction
The Hybrid Client is required to interact with native features on the device such as the tab bar, toolbar, statusbar, etc and offline functionality. Without the Hybrid Client the project will function as any other Wisej.NET project on ASP.NET Core. The only difference is that you will not be able to use the Device static singleton that acts as your “gateway” to native device functionality.
If you build a Hybrid Remote Application you can deploy it to Kestrel, IIS, or any reverse proxy and access it through a traditional web browser. You cannot do this with the Hybrid Local (offline) project.
HTH,
Levie
Hi Sam,
We have a few resources here to get you started:
https://docs.wisej.com/hybrid/start/introduction
Best regards,
Levie
Hi Abdul,
That error is coming from NuGet Package Manager, because it looks like a certain package source is not available anymore.
You have to omit that source by going to VS -> Options -> Tools and then look for NuGet.
HTH,
Alaa
//
Hi Ali,
The concept is to have a local persistent data layer, most applications tend to use SQLite.
This concept is not specific to Wisej.NET Hybrid, but as a good starting point I would recommend checking out https://learn.microsoft.com/en-us/azure/developer/mobile-apps/azure-mobile-apps/howto/data-sync
The challenge would be how to adjust both the app and the infrastructure to handle the synchronized data flow.
HTH,
Alaa
Hi,
Our license model changed earlier in 2022 and Wisej.NET is only available on a subscription basis.
Existing licenses remain valid, but cannot be upgraded.
In order to get access to the latest release, please purchase new Wisej.NET licenses.
If you want extended licenses valid for years we can do that once we know which keys.
We will then send an invoice for the extended year(s)
Thx & Br
This has been fixed in Wisej-3.NavigationBar 3.5.2
Hi Kim
Wisej.NET 3.5.2 was just released that fixes this issue.
Best regards
Frank
Hi Onur,
Thank you for reporting this issue.
This will be logged as an enhancement and will be added to ChartJS3 and other compatible ChartJS versions.
The correct syntax for this kind of implementation is the following:
chartJS1.Options.Plugins.Legend.Labels = new CustomLegendLabels()
{
UsePointStyle = true,
BoxWidth = 100,
};
CustomLegendLabels in this case is a class that extends the OptionsLegendLabels base class.
I have attached a sample.
HTH,
Alaa
//
Hi Juan,
Wisej.NET has a built in extension method ToClientTime() that you can use on DateTime structs to convert the Server DateTime to the Client DateTime.
Best,
Alaa
//
Hi Ali,
We have a similar post to this one: https://wisej.com/support/question/commandargs-how-to-use
The attached example in that post will give you an overview on how to use the Command feature.
Best,
Alaa
//
Hi Ali,
To be able to use the injected services like a regular ASP.NET Core application, it would be better to use Microsoft’s implementation.
We have that documented this approach, please visit https://docs.wisej.com/docs/concepts/dependency-injection#alternative-iserviceprovider for more information!
Best,
Alaa
//
Hi Ali,
Sorry for the delay. It’s on the TO DO list, unfortunately together with so many other things. My plan to have a new video online before Christmas.
Best
Joe
Hi Ali,
did you check out our documentation at
https://docs.wisej.com/docs/concepts/dependency-injection
Best regards
Frank
