Showing complex modal dialog causes problems for DataGridView on main form.

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

Hi,

I have an issue with showing a complex modal dialog window and painting of the DataGridView’s on the main window. I think it is a timing issue.

It works fine on my dev environment. But not if I deploy to a production server and run it there.

public partial class DialogWindow : Form
{
public static void Show(string Caption)
{
using (var form = new DialogWindow())
{
form.Text = Caption;

form.ShowDialog();

System.Threading.Thread.Sleep(5000);
}
}

To simulate cleanup of a complex form with a lot of dynamically added controls I have added a Sleep(5000).

Code in the click event of a button on the main form:
private void button1_Click(object sender, EventArgs e)
{
DialogWindow.Show(“something”);

bindingSource1.Add(new Knight(Title.King, “Uther”, true));
bindingSource1.Add(new Knight(Title.King, “Arthur”, true));
bindingSource1.Add(new Knight(Title.Sir, “Mordred”, false));
bindingSource1.Add(new Knight(Title.Sir, “Gawain”, true));
bindingSource1.Add(new Knight(Title.Sir, “Galahad”, true));

dataGridView1.DataSource = bindingSource1;
}

If i run this on the production server the dataGridView is empty after the click on the button.

I have included a sample project that i hope demonstrate the problem.

Best regards,
Wilfred

Attachment
  • You must to post comments
0
0

Hi Wilfred,

the fix for http that Luca mentioned was logged as WJ-7849 and is included in our latest build (1.3.15).

Best regards
Frank

  • You must to post comments
0
0

Hi Luca,

Thanks for looking at this.

The behavior i get is that the grid remain empty after the 5 seconds. If I then hit the browser refresh button the page is refreshed and the 5 lines in the grid is there as they should be.

It is like everything on the page behind the seenes behaves as it shold. Just that the lines in the grid is not painted and clicking on where the lines should be also does nothing.

I see that it works on the amazon server so it must be something with my production server and the site configuration. Do you have any suggestions on what I should look for?

Best,

Wilfred

  • Luca (ITG)
    I can reproduce the problem if I disable WebSocket mode. Make sure that WebSocket is working on the production server – that’s probably why it works in your dev environment. WebSocket support starts with W8 or W2012. For W2012 you have to enable the server feature. The modal state requires a second thread to release the first modal thread. The problem when running without WebSocket is that the first thread (in modal state) cannot send back any update since the request was already freed (terminated). Wisej uses the second thread (when in http mode) to collect changes in the components and update the client. Looks like the Sleep() delay causes the second thread to complete without being able to collect component changes. I will check if we can make it work with http as well. When WebSocket is enabled, we don’t have these issues since the connection can send back updates at any time.
  • Wilfred Schønegge
    Thanks Luca. The server is w2008R2 and no support for WebSocket. Happy you fond the reason. Thanks again. Need to find a new server :-)
  • Luca (ITG)
    Hi Wilfred, we fixed this for http mode too, it seems to work also when websocket are off now. Will be in the next update.
  • You must to post comments
0
0

Hi Wilfred,

I can’t reproduce the issue. I tried locally and on a remote server (on amazon): http://demo.wisej.com/apps/delayeddialog

The code shows the dialog and enters the modal state at line 14 in DialogWindow.cs (form.ShowDialog()). After the user clicks OK or Cancel, execution resumes to the next line and then it’s suspended for 5 seconds (System.Threading.Thread.Sleep(5000)), after the 5 seconds delay the grid is populated.

What’s the behavior that you get on your server? Does the grid populate after the 5 seconds delay in the code?

Best,

Luca

  • You must to post comments
0
0

Hi Wilfred,

When form.ShowDialog(); of DialogWindow.cs is hit, it halts execution of the code below the DialogWindow.Show("something");.
In effect, nothing is loaded in the datagridview until after the DialogWindow is closed.

I suggest you populate the datagridview in Load event of your main window.

Please refer to http://wisej.com/docs/html/ModalWorkflow.htm.

Hope this helps

  • Wilfred Schønegge
    Hi Cris, This is not actual code from a real application. It just demonstrates the issue. The dialog window is supposed to take input from the user and then show the result in the grid based on the user input. So, nothing is supposed to load in the grid until after the dialog is closed.
  • You must to post comments
Showing 4 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json