Update the UI while class library is busy

Hi,
I am working on an existing winforms application which contains a UI layer and a Database layer which communicate with each other using a Business layer. That makes 1 winforms application and 2 Class libraries.
I recently implemented a mechanism which allows the UI to be responsive while the DBLayer is working on a long running query. This involved the Query to be run on a BackgroundWorker and a while loop waits in the DBLayer method for the query to
complete in the background thread. While waiting I fire and event from the DBLayer which is handled on the UI layer and I run Application.DoEvents() which helps the UI be responsive.
This solution is working fine but I have a problem now that since the UI is responsive the users are clicking on other buttons and causing an inconsistency of state.
So I was wondering if there is a mechanism to make the UI responsive but not allow the buttons to be clicked (by responsive UI I mean the page shouldnt appear hanged while users drag the form around or when they click on various sections on the form)
or cancel all the events for a certain time ?
Also is there a way to make the UI responsive other than Application.Doevents()
I cannot implement threading or BackgroundWorker in the UI.
-Ajay

Just an update :
I am now looking forward to using the DisableProcessWindowsGhosting() from user32.dll to solve my problem.
This removes the message "Not Responding" from the title bar and the close (X) button is not enabled. So the user has to wait for the response.
My initial issue was : When the form waits for a response from the DBlayer the users try to interact with the form and windows ghosting kicks in after about
5 seconds. Then the form appears to have hung and the user closes the windows (as the close button(X) is still enabled). This becomes a problem as we have open connections. And other technical issues arise since the form didnt close properly(as the process
was killed).
Windows Ghosting E.g.:
I couldnt implement the enabled and disable controls suggestion as there are many forms and its and existing application which would make testing any
code change a huge effort.
The Application.DoEvents() also left a lot of room for new issues as windows messages that should be in the queue and processed after DBLayer response would
be processed before response.
After disabling windows ghosting the user has to wait for the window to repond (which happens after the DBLayer responds). So the user cant close the window in a abrupt state.
Thanks ,
Ajay

Similar Messages

  • My iphone4s can not update the apps while it could download the apps. It shows that the update can not access to itune store.

    My iphone4s can not update the apps while it could download the apps. It shows that the update can not access to itune store. I don't know how to deal with it...

    Many people (including me) are having the same problem at present. There are other threads in the message board with the same complaint.
    There is nothing you can do about it except wait for Apple to fix the problem.

  • I need the Java IDoc Class Library

    Hi,
    I'm desperately looking for the Java IDoc Class Library. What for? I'm doing a project for university and I have a test version running on my own computer (Mini WAS 6.20 with the FlightBooking example installed). The SAP Service Marketplace is for registered customers only. Since I only have a test environment (mentioned above) I can't register there and download it.
    Could anyone please send me this library by mail, to [email protected] Since I don't know how big this package is: my mail provider has a 15MB/per single mail limit. If biiger, please split.
    Yes, I'm asking for much. But I'm pretty desperate and I have to get going, since I'm running out of time.
    If there are other ways to get this library, please tell.
    Thanks
    Jonny

    Hi Johannes
    The SAP Java IDoc Class Library consists of two parts, the SAP Java Base IDoc Class Library and the SAP Java Connector IDoc Class Library. The SAP Java Base IDoc Class Library provides an API which helps navigating, reading, filling, and modifying IDocs. This base package is middleware independent. Creating, sending, and receiving IDocs is middleware dependent. To make use of the SAP Java Base IDoc Class Library you will need an additional middleware dependent add-on package implementing the defined interfaces like the SAP Java Connector IDoc Class Library.
    The SAP JCo can be downloaded from the   
    https://websmp101.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000463649
    of SAP JCo. The SAP JCo package includes the software as well as documentation, tutorial, and examples. The SAP Java IDoc Class Library can be downloaded from the same URL, and then follow the link to SAP Java IDoc Class Library. The SAP Java IDoc Class Library packages include the software as well as documentation.

  • How to update the apps while disable Settings General Restrictions Installing Apps  ??

    Hi
    I will give my old iPad to my mom and I would like to disable  "Settings>General>Restrictions>Installing Apps"  so that she or other famliy kids will not unintentionally install some bad/garbage apps.
    But I found a problem, without Apps Store, the apps already there will not be updated any more !!  Am I right?
    It seems that we need Apps Store for apps update, but disabling the "Settings>General>Restrictions>Installing Apps" will remove the Apps Store.
    Does anybody know any way to work around? I mean the apps already there could be update while "Settings>General>Restrictions>Installing Apps" is disabled.
    Thanks a lot !!

    stanleyoowa wrote:
    You mean I need to unhidden the App Store everytime when I want to update the apps ?
    And then re-hidden the App Store to enforce the restriction again?
    It is reasonable, but sounds like ... not that handy ......
    I just wonder could I use "icloud" to enforce the apps update??
    Purchases, yes, but I don't think it works for updates.

  • Circular reference calling the ImportFileGeneratorTask java class

    Hello,
    I am facing an issue when I generate in my build.xml the import file with the ImportFileGeneratorTask java class:
    Unable to sort files due to circular reference: ROLE-R_ALL_G_T_USER.xml -> ROLE-BR_ALL_G_T_USER.xml -> ROLE-R_ALL_G_T_USER.xmlIt occurs in the ObjectDependencySort java class because a Business Role contains an IT Role.
    Here is an extract of my build.xml:
    <taskdef name='generateImportFile' classname='com.sun.idm.ide.cbe.ImportFileGeneratorTask'>
                <classpath>
                    <fileset dir="tools">
                        <include name="idmcbetasks.jar" />
                    </fileset>
                    <pathelement path="${CLASSPATH}" />
                </classpath>
            </taskdef> 
            <generateImportFile outputFile='${basedir}/${import.file.generated}' incremental='${import.file.incremental}' updateTrackerFile='${import.file.update.tracker}'>
                <fileset dir='${custom-filtered-config-dir}'
                         includes='${xml-autogen-import-includes}'
                         excludes='${xml-autogen-import-excludes}'/>
                <filtermapper>
                    <replacestring from='\' to='/'/>
                    <replaceregex pattern='.*/${custom-filtered-config-dir}/(.*)' replace='WEB-INF/config/\1'/>
                </filtermapper>
            </generateImportFile>Does anyone already been confronted to this issue?
    Thanks,
    Nicolas

    you can just get rid of the ParentRoles tag in every Role. This does make the circular reference to disappear and roles are still contained in each other correctly as far as I tested it.

  • JRockit H27.2.1 for Harmony Class Library released now

    JROCKIT H27.2.1 FOR HARMONY CLASS LIBRARY RELEASED NOW
    BEA has released a 32-bit partial implementation of the Java Standard Edition Version 5 Specification for Windows on the Intel architecture that will work with the Apache Harmony Class Library for evaluation purposes.
    DOWNLOAD(S) AND VERSION(S)
    The JRockit H27.2.1 version has been tested with the Apache Harmony Class Library hdk-r487452 version.
    * JRockit H27.2.1 (http://dev2dev.bea.com/jrockit/jrockitVM)
    * Apache Harmony Class Library hdk-r487452 (http://people.apache.org/builds/harmony/snapshots)
    DISCLAIMER
    JRockit H27.2.1 is an experimental release for evaluation purposes only.
    BEA will not support this VM. BEA does not guarantee updates or service packs to this VM. The supplied class library implementation is incomplete and not Java compatible. Use H27.2.1 on your own risk.
    This BEA JRockit VM is not a part of the Apache Harmony project.
    BEA will follow up issues and questions regarding this release at this forum as time allows, but cannot guarantee responsiveness.
    HOW TO INSTALL
    * Download the Apache Harmony Class Library hdk from http://harmony.apache.org
    Unpack this to a location of your choice.
    * Locate the directory <path-to-jre>/bin. Preferably rename or remove the subdirectory 'default' (this is not required but recommended)
    * Download JRockit H27.2.1 from http://dev2dev.bea.com/jrockit/jrockitVM
    Unpack JRockit H27.2.1 to <path-to-jre>. You should now have a new subdirectory named 'default' in the 'bin' directory.
    * Verify by running '<path-to-jre>/bin/java -version'. If the program reports running JRockit this means the product is now installed.
    KNOWN ISSUES
    * There is no bytecode verifier supplied with JRockit for Harmony.
    * The core class library provided by JRockit for Harmony is not java compliant, nor is it a complete implementation of J2SE 5.
    * There is no support for java.lang.management.
    * There is no support for extended JRockit tools (such as management console).
    * There is no support for debugging via JDI. JRockit for Harmony contains an implementation of JVMTI (Java Tools and Management Interface), but no bridge for JDI.?

    See the documentation on how to disable optimizations for just a single method: http://e-docs.bea.com/jrockit/geninfo/diagnos/crash.html#wp1002526
    If you need a fix, please open a support case with BEA.
    Thanks,
    /Staffan

  • Update the tree

    Hi,
    I want to update the tree in the thread when I click the button. I tried it. But it is not updating the tree.
    I am putting my code beow, please correct me !!!
    import java.awt.BorderLayout;
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Vector;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    public class UserTree extends JFrame {
          DefaultMutableTreeNode root;
          JButton btn = new JButton("Click");
          Vector v ;
         public UserTree(){
               v = new Vector();
               v.add("A");
               v.add("B");
               root = new DefaultMutableTreeNode("Users" );
              for(int i = 0;i < v.size();i++){
                         root.add(new DefaultMutableTreeNode(v));
               JScrollPane js = new JScrollPane( new JTree( root ) );
               getContentPane().add( js );
               getContentPane().add(btn,BorderLayout.SOUTH);
               setSize(400,400);
               setDefaultCloseOperation(EXIT_ON_CLOSE);
              btn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e) {
                        // TODO Auto-generated method stub
                        new UpdateThread(v).start();
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              UserTree ut = new UserTree();
              ut.setVisible(true);
         class UpdateThread extends Thread{
              Vector vector;
              public UpdateThread(Vector v){
                   this.vector = v;
         public void run() {
              // TODO Auto-generated method stub
              EventQueue.invokeLater(new Runnable(){
                   public void run() {                    
                        for(int i=0;i < 5;i++){                         
                             v.add(""+i);               
    }

    Hi corlettk.
    Nice to see u again....
    I can update the JList while I am using DefaultListModel, but I cant update the JTree when using the vector.
    Now whenI clicked the button it is getting hanged the window...
    import java.awt.BorderLayout;
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.DefaultListModel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    public class TableEx extends JFrame{
         JList list;
         JButton btn = new JButton("Click");
         DefaultListModel listModel ;
         public TableEx(){
              listModel = new DefaultListModel();
              list = new JList(listModel);
              JScrollPane sc = new JScrollPane(list);
              getContentPane().add(sc);
              getContentPane().add(btn,BorderLayout.SOUTH);
              btn.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent ae){
                        System.out.println("hello");
                        new UpdateThread(listModel).start();
              setSize(300,200);
         public static void main(String arg[]){
              TableEx ex = new TableEx();
              ex.setVisible(true);
         class UpdateThread extends Thread{
              DefaultListModel listModel;
              UpdateThread(DefaultListModel list){
                   this.listModel = list;
              public void run(){
                   final Random random= new Random();
                   while(true){
                   EventQueue.invokeLater(new Runnable(){
                        public void run(){
                        int      i =random.nextInt();
                             if(listModel.contains(""+i)){
                                  listModel.removeElement(""+i);
                             }else{
                                  listModel.addElement(""+i);
         }Edited by: bhanu on Aug 26, 2008 12:21 PM

  • How do you monitor a background thread and update the GUI

    Hello,
    I have a thread which makes its output available on PipedInputStreams. I should like to have other threads monitor the input streams and update a JTextArea embedded in a JScrollPane using the append() method.
    According to the Swing tutorial, the JTextArea must be updated on the Event Dispatch Thread. When I use SwingUtilities.invokeLater () to run my monitor threads, the component is not redrawn until the thread exits, so you don't see the progression. If I add a paint () method, the output is choppy and the scrollbar doesn't appear until the thread exits.
    Ironically, if I create and start new threads instead of using invokeLater(), I get the desired result.
    What is the correct architecture to accomplish my goal without violating Swing rules?
    Thanks,
    Brad
    Code follows:
    import java.lang.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;
    public class SystemCommand implements Runnable
         private String[] command;
         private PipedOutputStream pipeout;
         private PipedOutputStream pipeerr;
         public SystemCommand ( String[] cmd )
              command = cmd;
              pipeout = null;
              pipeerr = null;
         public void run ()
              exec ();
         public void exec ()
              // --- Local class to redirect the process input stream to a piped output stream
              class OutputMonitor implements Runnable
                   InputStream is;
                   PipedOutputStream pout;
                   public OutputMonitor ( InputStream i, PipedOutputStream p )
                        is = i;
                        pout = p;
                   public void run ()
                        try
                             int inputChar;
                             for ( ;; )
                                  inputChar = is.read();
                                  if ( inputChar == -1 ) { break; }
                                  if ( pout == null )
                                       System.out.write ( inputChar );
                                  else
                                       pout.write ( inputChar );
                             if ( pout != null )
                                  pout.flush ();
                                  pout.close ();
                             else
                                  System.out.flush();
                        catch ( Exception e ) { e.printStackTrace (); }     
              try
                   Runtime r = Runtime.getRuntime ();
                   Process p = r.exec ( command );
                   OutputMonitor out = new OutputMonitor ( p.getInputStream (), pipeout );
                   OutputMonitor err = new OutputMonitor ( p.getErrorStream (), pipeerr );
                   Thread t1 = new Thread ( out );
                   Thread t2 = new Thread ( err );
                   t1.start ();
                   t2.start ();
                   //p.waitFor ();
              catch ( Exception e ) { e.printStackTrace (); }
         public PipedInputStream getInputStream () throws IOException
              pipeout = new PipedOutputStream ();
              return new PipedInputStream ( pipeout );
         public PipedInputStream getErrorStream () throws IOException
              pipeerr = new PipedOutputStream ();
              return new PipedInputStream ( pipeerr );
         public void execInThread ()
              Thread t = new Thread ( this );
              t.start ();
         public static JPanel getContentPane ( JTextArea ta )
              JPanel p = new JPanel ( new BorderLayout () );
              JPanel bottom = new JPanel ( new FlowLayout () );
              JButton button = new JButton ( "Exit" );
              button.addActionListener ( new ActionListener ( )
                                       public void actionPerformed ( ActionEvent e )
                                            System.exit ( 0 );
              bottom.add ( button );
              p.add ( new JScrollPane ( ta ), BorderLayout.CENTER );
              p.add ( bottom, BorderLayout.SOUTH );
              p.setPreferredSize ( new Dimension ( 640,480 ) );
              return p;
         public static void main ( String[] argv )
              // --- Local class to run on the event dispatch thread to update the Swing GUI
              class GuiUpdate implements Runnable
                   private PipedInputStream pin;
                   private PipedInputStream perr;
                   private JTextArea outputArea;
                   GuiUpdate ( JTextArea textArea, PipedInputStream in )
                        pin = in;
                        outputArea = textArea;
                   public void run ()
                        try
                             // --- Reads whole file before displaying...takes too long
                             //outputArea.read ( new InputStreamReader ( pin ), null );
                             BufferedReader r = new BufferedReader ( new InputStreamReader ( pin ) );
                             String line;
                             for ( ;; )
                                  line = r.readLine ();
                                  if ( line == null ) { break; }
                                  outputArea.append ( line + "\n" );
                                  // outputArea.paint ( outputArea.getGraphics());
                        catch ( Exception e ) { e.printStackTrace (); }
              // --- Create and realize the GUI
              JFrame f = new JFrame ( "Output Capture" );
              f.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
              JTextArea textOutput = new JTextArea ();
              f.getContentPane().add ( getContentPane ( textOutput ) );
              f.pack();
              f.show ();
              // --- Start the command and capture the output in the scrollable text area
              try
                   // --- Create the command and setup the pipes
                   SystemCommand s = new SystemCommand ( argv );
                   PipedInputStream stdout_pipe = s.getInputStream ();
                   PipedInputStream stderr_pipe = s.getErrorStream ();
                   // --- Launch
                   s.execInThread ( );
                   //s.exec ();
                   // --- Watch the results
                   SwingUtilities.invokeLater ( new GuiUpdate ( textOutput, stdout_pipe ) );
                   SwingUtilities.invokeLater ( new GuiUpdate ( textOutput, stderr_pipe ) );
                   //Thread t1 = new Thread ( new GuiUpdate ( textOutput, stdout_pipe ) );
                   //Thread t2 = new Thread ( new GuiUpdate ( textOutput, stderr_pipe ) );
                   //t1.start ();
                   //t2.start ();
              catch ( Exception e ) { e.printStackTrace (); }
              

    Thanks for pointing out the SwingWorker class. I didn't use it directly, but the documentation gave me some ideas that helped.
    Instead of using invokeLater on the long-running pipe-reader object, I run it on a normal thread and let it consume the output from the background thread that is running the system command. Inside the reader thread I create a tiny Runnable object for each line that is read from the pipe, and queue that object with invokeLater (), then yield() the reader thread.
    Seems like a lot of runnable objects, but it works ok.

  • Java Class Library

    What's the online Java Class Library reference site?
    I swore it was on this Java.sun.com site, but I can't seem to locate it again.
    Thanks,
    MB

    Are you looking for http://java.sun.com/j2se/1.3/docs/api/index.html by any chance ?

  • Updating the BPM workspace view based on the number of instances in view

    Hi All,
    We are using ALBPM 6.0.5 enterprise with Weblogic 10 server. We have a requirement to update dynamically the view name in the left side panel in BPM workspace. Based on the number of instances created, the view(view name ABC) should carry something like "ABC(2)". 2 being the number of instances in the view. It's more like a mailbox client InBox. Depending on the number of mails, the Inbox changes the number highlighting new mails.
    I've tried using the Workspace API to update the cusom decorator class getRow() method to update the view CSS property. But it doesn't seem to work. All I'm able to do with the decorator class is to update the propeties of instances, but not other panels?
    Is there any API to control the panel properties in BPM workspace?
    By the way, I'm using the standard workspace without any changes.
    Any pointer will be much appreciated.
    Cheers.

    Yes, I'm hoping to fill in DataGridA with all records from dc where dc["ENTITY_ID"] = dr["ENTITY_ID"] 
    I tried your statement and received the following errors:
    Error 1
    The left-hand side of an assignment must be a variable, property or indexer
    C:\ISMG_7210\MedicalSequenceDataAnalysisProject\OTCS_Algorithm\OTCS_Algorithm\Form1.cs
    87 71
    OTCS_Algorithm
    Error 2
    Cannot implicitly convert type 'object' to 'int'. An explicit conversion exists (are you missing a cast?)
    C:\ISMG_7210\MedicalSequenceDataAnalysisProject\OTCS_Algorithm\OTCS_Algorithm\Form1.cs
    87 99
    OTCS_Algorithm
    Thank you for your help.
    Joel Fredrickson
    Yes, please follow example provided by Kristin, the error is because of missing comparison operator ==, and that the dr["ENTITY_ID"] is of type object that needs to be converted to int. I've updated my code, if you have Entity_ID in your DB as
    double use Convert.ToDouble instead.
    Fouad Roumieh

  • My iPad mini won't update my apps.  I have closed all open apps, done multiple resets but I show 24 updates and when I hit the update, the screen is blank.

    My iPad mini won't update my apps.  I have closed all open apps and done multiple resets.  I hit update and the screen is blank, even though the bubble shows 14 to update.

    If you are getting the blank app update screen, many people are having this problem over the last couple of days.
    According to Fly150 in another discussion, this will work.
    If you want to update the Apps while waiting for Apple to fix Updates:
    1. Go to App Store
    2. Select Purchased
    3. Select All
    4. Scroll down to find the Apps showing update
    5. Select update on the Apps
    This should update the Apps and get rid of the update count in App Store. Apple needs to fix this. It is a workaround only until then.

  • HT5622 My iPad 2 won't update the apps I've purchased from the App Store.

    When I go to the App Store, I continually have Apps to update yet when I hit the update button all I get is a blank white screen. None of the Apps needing to be updated are shown.

    This is an ongoing issue.
    Many people are having this problem for the last couple of days. This is a problem that Apple has to fix. If you look around the forum, you will see many, many discusssions about this and they have been going on for a few days.
    According to Fly150 in another discussion, this is a workaround - for the time being.
    If you want to update the Apps while waiting for Apple to fix Updates:
    1. Go to App Store
    2. Select Purchased
    3. Select All
    4. Scroll down to find the Apps showing update
    5. Select update on the Apps
    This should update the Apps and get rid of the update count in App Store.

  • How do I find all the purchased items on my iPhone? When I try to update the iPhone iOS while connected to my MacBook it says there are purchased items on the phone that have not been transferred to my iTunes library and that I should transfer them.

    How do I find all the purchased items on my iPhone? When I try to update the iPhone iOS while connected to my MacBook it says there are purchased items on the phone that have not been transferred to my iTunes library and that I should transfer them before updating.

    Thanks. This seems to have worked easily.

  • My Mobile restart while update the media library.

    I am using 3110 it some time restarts while update the media library. I also want to flash the software, because it restarts while I applying any themes, adding new files in memory card... also I want to disable the PTT but it not working... Please any one help me....

    Try a reset first.
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    If that doesn't help, follow the instructions for recovery mode >  iOS: Unable to update or restore

  • Buller? Anybody? The system extension "/System/Library/Extensions/ZD1211Mac.kext" was installed improperly and cannot be used. Please try reinstalling it, or contact the product's vendor for an update. This has been going on for a while.

    Anyone find a fix for this? Most programs installed invoke this error.
    The system extension “/System/Library/Extensions/ZD1211Mac.kext” was installed improperly and cannot be used. Please try reinstalling it, or contact the product’s vendor for an update.

    That driver appears to be for a Zydas wireless usb adapter. Zydas has been through a couple of different acquisitions and no updates appear to be available, so you'll probably need to delete that extension.
    Regards.

Maybe you are looking for

  • Hierarchical ID Recursion for Chart of Accounts

    This must be a pretty standard report format but so far it looks as though I’m not smart enough to figure out how to get ‘er done. I’m using 2008 R2 to work with a hierarchy of about 30k GL accounts. The hierarchy is narrow at the top—only 5 subtrees

  • Help line just hanging up on me!

    Anyone else having an issue with the help line? After dealing with the stupid computer prompts, I get "Please wait while I transfer you to a customer representative" 15 seconds later line goes dead. 4 times in a row!  

  • CRS Engine restarts every 2-3 days due to NOT_OK response from Watchdog

    Hi, we have 2 Cisco Unified IP IVR servers running version 7.0(1)SR03_Build011. Every 2-3 days, the CRS engine restarts at different times on both servers due to a Watchdog Thread received NOT_OK response from process CRS Engine. These servers run in

  • How do I stop MacMail defaulting to Yahoo in OS Mavericks?

    I can no longer access BT mail accounts through MacMail on a Macbook with OS 10.9.4, Mavericks. Until now BT mail was linked to Yahoo, and when this MacMail was first set up our mail accounts (2 POP accounts) obviously went through Yahoo. This link h

  • PEOPLE HELP!! THIS IS URGENT!!:(

    Hey I own nokia 5500Sport(black edition) and few days ago, my keyboard from phone unsticked from my phone.I used it only for month and half. Bat thats not my main problem. I live in country(Bosnia and Herzegovina) where there is no Nokia Center. I bo