Hi,
I just noted by chance that there is a new update (1.2.5) available. Could please keep us posted about the changes and additions?
Thanks!
Thanks, Tiago.
I have logged WJ-7293 for this issue.
Best regards
Frank
Hi Luca,
I have to add uc.BringToFront() to make it worked. Another option is to put another panel, dock it to Fill and make it as a container of the UserControl.
Thanks
Cris
It works here. Which means that you probably don’t have WebSocket enabled. In Chrome use F12 and Network and you will see that it never switches to WebSocket.
Apparently IIS 8 Express supports WebSocket but only from Windows 8 up: http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-80-express-readme
Without WebSocket you can still update the client asynchronously but you need a request (any request) to be started from the client. If you add a Wisej Timer component to the form it will fire an event every interval and cause a client update. The thread code above will still work but the client will be updated at the timer interval.
Forgot: you can also check using
Application.IsWebSocket
Hi Nic,
I have just tried the sample you attached and it works fine here.
Did you try with the latest Wisej build ?
Best regards
Frank
Hi Luca,
Thanks for the explanation and the sample but my test program (attached) stubbornly refuses to change the colour of my panel. Any chance you can tell me what I am doing wrong?
TIA
Nic
Hi Cris,
Docking is applied using the z-order of the controls so Fill will fill whatever space is left available by other docked controls. When you use Controls.Add() the new control is rendered first since the z-order is from further away coming toward the viewer. For the Fill to use the remaining space use uc.BringToFront() after adding it to the parent.
You can test the order of docking and how the different sides overlap in the designer using right-click -> SendToBack/BringToFront.
Best,
Luca
Hi Nic,
The background task sample uses Application.StartTask which internally restores the context before calling the task method. To use Application.Update() in a different thread other than the “request thread” (which has the session restored, including a reference to the ResponseManager connected to the WebSocket) you have to save the context and then restore it in the new thread.
The easiest way is to use a closure, change your test code like this:
var context = Application.Context;
timer.Elapsed += (s, e) => {
// restore the context on the current thread.
using (new Wisej.Base.ApplicationContext(context))
{
// here you can call any other method, or place the code to run in the new thread, or a thread loop.
// to test it I did this:
Application.OpenForms[0].Text = Thread.CurrentThread.ManagedThreadId.ToString();
// this works now because the context has been restored by the using statement.
Application.Update();
}
}
When running in the main (or request thread) you can call Application.Update() at any time and force the client to update. The downside of having long running operations in the request thread is that Wisej on the client side will automatically show a mask and a loading gif covering the control that fired the event and that is not receiving an answer within a certain amount of time.
HTH
Best,
Luca
I must confess I didn’t try to convert a VWG project to Wisej since all my projects depend on MvvmFx. Wisej isn’t stable enough to port this library to Wisej so I must wait.
Anyway, I guess you also have to remove the ProjectTypeGuids on the project file.
Thanks Nic!
Basically the process is exactly what Nic described:
The modal workflow is a great feature (VWG had it too, by the way, but it had to be enabled in web.config). We also have the async approach. The Show (for MessageBox as well) and ShowDialog methods have an optional onclose parameter that is called asynchronously and a modal optional argument that disables the modal workflow. It’s an Action, so you can use it like this:
form.Show(onclose: (result) => {
});
// ShowDialog is always modal, but the onclose callback works as well.
form.ShowDialog(onclose: (result) => {
});
And you can make a non-modal form show the modal mask on the client and act as a modal dialog but completely asynchronous:
form.ShowModalMask = true;
form.Show(onclose: (result) => {
});
result is DialogResult.
One additional tip about testing. Sometimes when testing you may need to start a new session to force the re-creation of the controls and Load events. Instead of closing the browser you can simply add ?sid=new or ?sid={anything} and Wisej will interpret it as an invalid session and will create a new one.
Best,
Luca
Hi all,
I agree that the NullableValue is the best way to go.
regards,
Alex
As per release 1.2.5, when I click the column header the error doesn’t show but:
If the data in the gris isn’t sortable, clicking the column’s header should have no effect at all.
Morning Ewan,
I’ve been doing exactly that. It’s been pretty simple. I’ve removed all references to VWG and replaced them with the references to WiseJ. I’ve also had to go and undo all the non-modal closing form code I as WiseJ works just like Winforms but other than that it has been a very straight forward process.
The bonus has been that WiseJ apps seem much more stable than VWG (i.e no cache clearing to get rid of issues).
HTH
Nic
The “NullableValue” Property is a good idea and probably the best solution for the DateTime Picker.
Add a new bindable property “NullableValue” looks like the best solution, as it doesn’t compromise the core functionality and supports the null concept. While we are talking about “bindable” properties, I’d like to see components, like MenuItem etc. to implement IBindableComponent, i.e. to be “bindable”.
OK, thanks. But if we change DateTime to DateTime? and Decimal to Decimal? it must be done early one. It’s not something we can change after the release. Another option would be to add a new bindable property “NullableValue”.
Hi Luca,
I have done exactly that in my custom DateTimePicker UserControl, i.e. I have it return a DateTime? value and binding works correctly. But I wouldn’t like to test an experimental build now, I think we should keep playing with one bet product at the moment and not “deviate” to different versions.
However, I don’t see why not make your controls return nullable types if this is possible. What is the opinion of other beta testers?
Best regards,
Alex
The problem with null dates and numbers is that Microsoft left them out when they designed .NET from the start. DateTime and Decimal don’t have an IsNull property and cannot be null. In addition, ADO.NET expects and returns DBNull.Value when the db field is null.
We have a similar issue in our other .NET framework and we added IsNull and UseMinValueAsNull and we have an IDbValue interface for binding on our custom types. However those solutions cannot be applied to Wisej.
We could change the Value type of DateTimePicker and NumericUpDown to DateTime? and Decimal? nullable types. That would allow the control to return null when empty. I’m not sure how a database bound data source would react, need to test this.
Would you like to receive an experimental build with DateTime? and Decimal? Value properties in DateTimePicker and NumericUpDown and give it a try on your end?
Hi,
Thanks for your answers.
Best regards,
Alex
