TestStand Non blocking deportees to interface (c#)

Hello

I wish to have a graphical interface (c#) for managing TestStand (read/write variables FileGlobals, Notifications of waiting/Set,...). This interface must be enabled during the activity of TestStand (graphical indicators of the status of tests, allows the activation of the subsequences, etc.), and it must use the TestStand interface (make a break, step by step debugging, see variable, States in discussions, etc...).

I start from the example of NI TestStand '\TestStand 4.2.1\Examples\Demo\DotNet' and make a few changes:

-call the constructor of the windows dialog with a new SequeceCall thread

-Added management of Notification (unsing TSSyncLib, modify the constructor of the dialog box and send my FileGlobals.Notifier variable create during the stage of creation of Notification).
-Added a button. When you press on, a variable FileGlobals number is read, + 1, then write and display in the label. And another button set a Notification.

-Add a breackpoint in the step next to the SequanceCall of the dialog Windows

My problem is, as long as I do not close the windows, TestStand still 'running' and do not stop on my breakpoint and unresponsive when you "Break everything" change watch Variables...

If I change this.mDialog. ShowDialog (by this.mDialog). Show(), TestStand responds but the mistake of report of dialog Windows with FileGlobals read/write and Notification.

My need is achievable?

As an attachment, the file .seq (TS4.2) with the generated dll and the DotNet project.

Thanks for help; (o)

You must use Thread.ExternallySuspended (see using the API for more details) while your dialog box is running. Also you should consider using Execution.InitTerminationMonitor and Execution.GetTerminiationMonitorStatus.

That said, the description of what you want to do, I thought you were going to start with a UI examples. If you really want to write a custom user interface, it is perhaps a better way to go.

Hope this helps,

-Doug

Tags: NI Software

Similar Questions

  • reading non-blocking

    Hello

    I'm trying to implement a lock read along the lines of peekdata() in matlab http://www.mathworks.de/access/helpdesk/help/toolbox/daq/index.html?/access/helpdesk/help/toolbox/da...

    I found I can do readings not blocked from using the reading + http://forums.ni.com/ni/board/message?board.id=230&thread.id=2862 reminders

    Is there another way to get non-blocking reads?   The reason is that if the above, I've implemented the matlab Matlab mex interface calls the file (mex) C and I do read (must wait the trigger occurs) before returning from the C file (aka it becomes again blocking). So that callbacks are not really useful if the thought in a single thread passing that matlab works.

    Thanks for reading.

    The way in which the driver is written is to block on a reading DAQmx.  In a single threaded method will always call blocking as I know.

  • Non-blocking with Perl VI API monitor task

    I am writing a perl script that needs...

    1. Suspend a virtual machine
    2. Do 'some other supervision' while the virtual machine in the suspension process
    3. Make sure that the task is complete suspension

    I was looking at the documentation for the API, but also the code example and there are many examples which have helped me understand how to do #1 and to some extent #3 by calling SuspendVM() on the managed virtual computer object (see my sample code "Option 1").  But it is not perfect for #3 and does not allow me to do #2 at all.  API documentation leads me to believe that I should be able to use SuspendVM_Task() on the virtual computer object for a task monitor-a measure of object (see 'Option 2') in my sample code.)

    However, I can't understand how to use this object task to track progress.  I think it must be something like "Block monitor" in my code, but that doesn't seem to work.  Watching a dump of the task object, "info" property seems to not even be there.  I can bless the object to its class real slot (instead of the generic ManagedObjectReference, it starts as), but then the property of the info is just empty.

    I know I probably stopped next to a simple shade of perlOO/perl/perlReference, but can not find where I'm going wrong... any help out there?

    Output of dump of the object of the task

    ========================

    $VAR1 = bless ({}
    'value' = > ' haTask-1808 - vim.VirtualMachine.suspend - 1852795401',
    'type' = > 'task '.
    (}, "ManagedObjectReference");

    Code example

    ==========

    #! / usr/bin/perl - w

    use strict;

    use warnings;

    Use Data::Dumper;

    use VMware::VIRuntime;

    past #./vmSuspend.pl--mot, username - XXXX XXXX - Server XXX.XXX.XXX. XXX - vmname XXXX

    My % opts =)

    'vmname' = > {}

    Type = > "s =",

    help = > "the name of the virtual machine.

    required = > 1,

    },

    'filter' = > {}

    Type = > "s =",

    help = > 'filter to select corresponding virtual machines. "

    required = > 0,

    },

    );

    OPTS::add_options (%OPTS);

    OPTS::parse();

    OPTS::Validate();

    Util::Connect();

    My $retval = 0;

    my $name = Opts::get_option ('vmname');

    My $vm_view = Vim::find_entity_view (view_type = > 'VirtualMachine',)

    filter = > {'name' = > $name});

    my $state = $vm_view-> run - > powerState-> val;

    Print "$name is $state\n";

    # Option 1 - blocking

    # $vm_view-> SuspendVM();

    # Option 2 - non-blocking

    My $suspendTask = $vm_view-> SuspendVM_Task();

    print Dumper ($suspendTask);

    # Block monitor

    # everything in ($suspendTask-> info-> status-> val eq 'running' | $suspendTask-> info-> status-> val eq 'pending') {}

    # < < some other surveillance > >

    #}

    $vm_view-> update_view_data();

    $state = $vm_view-> run - > powerState-> val;

    Print "$name is $state\n";

    Take a look at this script for example: http://communities.vmware.com/docs/DOC-10269 there is a method in there called getStatus() that shows you a task queue is complete before continuing. You are on the right track, but must do a few more things to get the display of the task and make sure that you update the view after sleep/wait and then check again.

  • How to use a KeyManager custom in SSLSocketChannel non-blocking

    In our existing project I had to replace the SocketChannel non-blocking by SSLSocketChannel no blocking. My implementation of the SSLSocketChannel non-blocking mask all the SSL stuff and can be used as a SocketChannel overall of the project that just use the SSLSocketChannelProvider instead of SocketChannelProvider in one place.

    Now I have a new requirement. Different server-certificate should be used for various IPS on the same SSLServerSocket. The relationship between the IPs and certificates is well known. The first idea was to use a custom KeyManagerDelegate that extends from X509ExtendedKeyManager to select the certificate from the server. The KeyManagerDelegate should delegate calls to a KeyManager obtained by
    KeyManagerFactory.getInstance("NewSunX509").getKeyManagers();
    It works if I use a blocking SSLServerSocket obtained by SSLContext.getServerSocketFactory () .createServerSocket ();

    But the KeyManagerDelegate is never called by the SSLContext if I use my own non blocking SSLServerSocketChannel. Instead of calling my KeyManagerDelegate the SSLEngineImpl throws an Exception
    javax.net.ssl.SSLHandshakeException: no cipher suites in common
         at com.sun.net.ssl.internal.ssl.Handshaker.checkThrown(Handshaker.java:951)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:466)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1092)
         at com.sun.net.ssl.internal.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1064)
         at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:452) 
    The next thing I'm going to try would be to get the SSLContext to use my own SSLSocketChannelProvider as ServerSocketFactory.

    Or I use different SSLContext for each incoming connection, which would break my own design because the server had to waste his time with the construction of new SSLContext. Another possibility is to implement a callback in the ServerSocketChannel to get a new SSLContext for each accepted connection. It would be sure my design but looks like a ugly workaround solution for me and I do not know if it works.

    All the best ideas?

    Thanks Domi

    I just tested this with my SSLSocketChannel and it works like correctly, the KeyManager methods called as expected. You hurt something else ;-) Do not extend X509ExtendedKeyManager to work properly with the engine.

  • Web HTTP proxy using IO Non blocking

    Solved thank you...

    customer. Register (selector, SelectionKey.OP_READ
    | SelectionKey.OP_WRITE);

    OP_READ only at this stage. OP_WRITE is always 'ready' unless the socket buffer is full, so your selector will turn only. Do not save OP_WRITE until you have something to write.

    ByteBuffer bferClient = ByteBuffer.allocate (4096);

    You do this each time around the loop, and you don't even know if the key is still readable. Do it when you accept a connection, and then save it as the essential accessory for this channel.

    client.configureBlocking (false);

    It is already in non-blocking mode. Why you do it again?

    try {}
    If ((bytesRead = client.read (bferClient))! = - 1) {}

    bferClient.flip ();
    String msgFromClient = new String (bferClient.array ());

    new String (bferClient.array (), 0, bferClient.limit () - 1), but you're assuming that you've got a complete command here. You do not have. This is another reason why you need a ByteBuffer by channel.

    Channel.Connect (SocketAddress);

    You should do it in non-blocking mode, save the channel for OP_CONNECT and leave the select loop to take care to complete the connection.

    Channel.Write (bferClient);

    The incoming command is CONNECT. You do not write than upstream.

    If (!) » ». {Equals (msgFromClient.Trim ()))}
    int bytesReadServer;
    response from Byte [] = new ubyte [4096];
    try {}
    ByteBuffer bufferNIO = ByteBuffer.allocateDirect (1024);
    While ((channel.read (bufferNIO))! = - 1) {}
    bufferNIO.flip ();
    customer. Write (bufferNIO);
    bufferNIO.clear ();
    }

    And you don't do that here. Register the new channel for OP_CONNECT, then when you get finishConnect() and then save it to OP_READ, and moving forward in your select loop. You also need to associate the channel with the channel that read you the CONNECTION since. If you really need an object of attachment key for the original channel that contains the buffer of bytes and the channel upstream; Similarly, the channel upstream must a key attachment that contains sound buffer and its channel downstream. The effect of making all this stuff here rather than around the loop of selection is that you're never going back to the loop of the selection: you manage what a customer here in blocking mode, until the connection is dropped. Completely wrong.

    } catch (IOException e) {}

    Hang up. If bytesRead a-1, you must close the channel.

    e.printStackTrace ();

    And if you get an IOException here you must also close the channel.

    If (channel! = null) {}
    try {}
    Channel.Close ();

    This is a really strange place to close this channel.

    When you get this fixed upward, your zip code and I will tell you how to handle the OP_WRITE.

  • Modal dialog box non-blocking

    Hello world

    I want to display a modal dialog box, capture user input and use it for further processing, as below:

    showWindow(); PopupManager.createPopUp () calls
    code to deal with user input

    My problem is that the showWindow() call is non-blocking, i.e. the code to deal with user input is executed immediately after the posting of the modal window. How can I do to run when the modal window is closed?

    Any help will be greatly appreciated.

    Thank you

    Rajesh Jayaprakash

    You can register a listener for the event of closure of the pop-up window and then on this listener, call the method that you want to run when the window is closed.

  • UTL_TCP (mode of blocking or non-blocking sockets)

    Hi all,

    Please, does anyone know if the UTL_TCP using blocking or non-blocking mode sockets? I did a search but cannot find this information.

    Kind regards

    UTL_TCP.open_connection has a parameter of tx_timeout. If set to 0, the connection is not blocking. A value of n will trigger the connection block for n seconds before exhaling. Null value causes the connection to block indefinitely.

    Published by: Cyn on February 11, 2010 10:49

  • TestStand freezes when calling user interface

    Hello

    I did a bit of seraching but the problem I have is intermittent for one of the positions that I have found useful. I have a built in CVI user interface that is called the part edit-a type of step in time. When I call the UI for several times now (same step over and over) TestStand eventually freezes. Sometimes I get error messages, most of the time that it just hangs. When she throws and error, it is usually a one .NET. I received this message before the "object reference is not attached to an instance of an object", so that system level exceptions. I can't figure out exactly what is the cause. I posted my code below. If I comment on either of the two sections "BOLD" no error occurs. Also, if I do not change the setting in the user interface between the calls to the user interface I have never it freezes. So he definitley has something to do with the fill/adjustment control of the ring, or even reading the property 'ThisContext.Step.ConfigProperties.ParameterID' of TestStand. If I get more descriptive errors, I will update this post.

    Code:

    ----------------------------------------------------------------------------------------------------------------------------------------------------

    void __stdcall __declspec(dllexport) ReadParameterTSEdit (CAObjHandle seqContextCVI, char reportText [1024], short * errorOccurred, long * errorCode, char errorMsg [1024])
    {
    ErrMsg errMsg = {'\0'};
    int hpanel;
    int executed;
    int index;
    int count;
    int numParams;
    char paramIDs [100] [64];
    char param [64];
    char indexparam [64];
    char * ActCntrlTLA = NULL;
    char * temp = NULL;
    char activecntlr [23] = "active controller: ';"
    VBOOL CntrlExists;
    TSObj_Property paramids = NULL;
    TSObj_PropertyObjectFile propObjFile;
    CAObjHandle seqfileobj;
       
    Check that the system has been initialized and a profile was loaded!
    TS_PropertyExists (seqContextCVI, NULL, "ThisContext.FileGlobals.ActCntrlTLA", 0, & CntrlExists);
    If (!.) CntrlExists)
    {
    MessagePopup ("read setting", "no profile has been loaded for this sequence!");
    GoTo error;
    }
    TS_PropertyGetValString (seqContextCVI, NULL, "ThisContext.FileGlobals.ActCntrlTLA", 0, & ActCntrlTLA);
    Initializes the parameter reading UI
    hpanel = LoadPanelEx (0, "ReadParamUI.uir", READ_PARAM, __CVIUserHInst);
     
    TS_PropertyGetPropertyObject (seqContextCVI, NULL, "ThisContext.FileGlobals.ParamIDs", 0, & paramids);
    TS_PropertyGetNumElements (paramids, NULL, & numParams);
     
    for (count = 0; count)< numparams;="">
    {
         TS_PropertyGetValStringByOffset (County of paramids, NULL, 0, &temp);)
    strcpy (param, Temp);
    InsertListItem (hpanel, READ_PARAM_PARAMETERS, count, param, count);
    }

    Build a string them of active controller
    strcat (activecntlr, ActCntrlTLA);
    SetCtrlVal (hpanel, READ_PARAM_ACTIVETLA, activecntlr);
     
    TS_PropertyGetValString (seqContextCVI, NULL, "ThisContext.Step.ConfigProperties.ParameterID", 0, &temp);)
    strcpy (param, Temp);
     for (count = 0; count)< numparams;="">
    {
    GetLabelFromIndex (hpanel, READ_PARAM_PARAMETERS, count, temp);
    strcpy (indexParam, Temp);
    If (strcmp (indexParam, param) == 0)
    {
    SetCtrlIndex (hpanel, READ_PARAM_PARAMETERS, count);
    GoTo done;
    }
    }
    Fact:
     
    The display panel and run the user interface
    Does not return until that of RunUserInterface until the
    you press the Finish"" button.
    DisplayPanel (hpanel);
    Run = RunUserInterface ();
    Get the index of the selected parameter
    If (run<>
    {
    GetCtrlIndex (hpanel, READ_PARAM_PARAMETERS, &index);)
    GetLabelFromIndex (hpanel, READ_PARAM_PARAMETERS, index, param);
    TS_PropertySetValString(seqContextCVI,,"ThisContext.Step.ConfigProperties.ParameterID",0,param);
    }
     
    Output:
    / * Release resources and return * /.
    DiscardPanel (hpanel);
    TS_PropertyGetPropertyObject (seqContextCVI, NULL, "ThisContext.RunState.SequenceFile", 0, & seqfileobj);
    TS_SeqFileAsPropertyObjectFile (seqfileobj, NULL, & propObjFile);
    TS_PropertyObjectFileIncChangeCount (propObjFile, NULL);
    If (& ActCntrlTLA)
    {
    CA_FreeMemory (ActCntrlTLA);
    }
    If (& temp)
    {
    CA_FreeMemory (temp);
    }
    If (& paramids)
    {
    CA_DiscardObjHandle (paramids);
    }
    CA_DiscardObjHandle (propObjFile);
    CA_DiscardObjHandle (seqfileobj);
     
    Error:
    }

    /*---------------------------------------------------------------------------*/
    / * Callback functions * /.
    /*---------------------------------------------------------------------------*/

    int CVICALLBACK Done(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
    If (event is EVENT_COMMIT)
    {
    QuitUserInterface (0);
    }
    return 0;
    }

    int CVICALLBACK CLOSEPANEL(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    {
    If (event is EVENT_COMMIT)
    {
    QuitUserInterface (1);
    }
    return 0;
    }

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------

    Thank you

    Josh

    The problem was with this line:

    GetLabelFromIndex (hpanel, READ_PARAM_PARAMETERS, count, temp);

    I shouldn't have been past at the time to write the label that I had previously used temp with functions of API of TS. Who should have caught before posting... but it's been a long day.

  • How to create the TCP non-blocking server?

    Hello

    I would like to have a TCP server at my request.  It will go about their business as usual, but in the background a TCP server sits waiting for a client connection.  If such a link exists, the normal code will send stuff on this topic otherwise it will just not send.  Currently, I do not see how to stop this blocking while it waits for a client (block waiting on TCP listener).  I looked at the example of client/server TCP, but it remains blocked in the same way.

    I would like advice on how I'm framing such a request.  I also want to do the same on the client side.  Go about business as usual and if a connection can be established at a time given, then send stuff on that connection otherwise just not worth it.

    Concerning

    Ashley

    LabVIEW parallel code usually runs in parallel. This is true even a wait - if inside a loop, you wait 100ms and other code in parallel, it is not delay execution of other code, rather he runs forward and the other code at the same time. When both have completed, the loop can proceed to the next iteration. So yes, if you have a loop with a 1000ms wait and another with an expectation of 100 ms and waits take longer to execute any parallel code in loops, then the loop of 100ms will last about 10 times as many times as the loop with the 1000ms wait.

    I recommend that you put the waiting on the listener in a separate loop and also have another parallel loop that manages the communication when the connection is established. You can then use a timeout (forever) of-1 on waiting on the listener, and this loop will be almost never run or use resources except what is first of all establish a connection. To kill this loop, close the listener somewhere which depends on waiting on execution of the listener. When a new connection is established, put the link in a queue, where the communications loop can pick it up.

  • Subvi non-blocking output terminals?

    Is it possible to prevent an output jack of a Subvi of blocking during the Subvi execution?

    Thank you

    Mike

    Consider the following excerpt

    When you run this you'll (almost) immediately see the value of "Numeric outside." You can see the results in the table after one second. If you were to do a Subvi and calling it from another VI you will see two update indicators after a second. One quick expected a slow. This is normal and is how LabVIEW and has always worked. It makes sense, and the code is easy to follow and debug.

    But what happens if you inline the Subvi? What would be the expected behavior? In fact what is happening is that LabVIEW encapsulates a barrier synchronization of the structure sequence around the code like this before to apply inlining a VI

    That's why the VI Inline act as a normal VI. NOR said that it would be very easy to just not put the barrier around the code as a configuration option online. I call this hard line , but there is probably a better name for it. (Either by the way, there is an excellent exchange of views in this thread)

    To be honest I don't know what I'd do with this option. At the back of my head that nagging voice always tells me that it could be a very useful option someday. It gives us the opportunity to do something that isn't currently possible. Someone will come up with a very clever trick if it becomes possible.

  • How to create a non-blocking Popup screen?

    Hello

    Basically, I want to do something similar to the State. Show (String message, bitmap Bitmap, int, long, style, boolean allowDismiss, boolean, int priority block) API where I can display a modeless popup containing various fields and still allow the user to continue to work on the screen below the pop-up window.

    Thanks for any help and suggestions.

    It is not possible. you could draw directly on the screen, it would look like a popup, but would in fact part of the screen. We do overlays in this way, for example.

  • non-blocking applications

    Hello

    Can you help
    I blocked the apps so that my kids can not access things like McAfee or Netgear parent controls, I click on save and reboot the laptop, but when its reloaded, I find that the applications are still there and totally accessible to my children under their log in. That is something I don't want, I'd rather not, they have access to these and be able to change them.
    could you tell
    your

    Thank you

    I restarted the laptop several times and everything seems to work fine now.
    Fortunately I had nothing to do more.
  • can I route private IP block via external interface directly

    Hi all

    Thanks in advance for anyone who can give you your proposal!

    the title is not exactly what I would like to present.

    say, I have a 5510 and two ISP, simple as diagram below:

    outside1 IPX1 - isps1 GW IP X 2

    10.0.0.0 - HQ 5510 - 5520 IPZ outside - 192.168.0.0

    outside2 IPY1 - ISP2 GW IP Y2

    the goal is

    1. internet traffic through isps1

    2 VPN traffic (10.0.0.0 - 192.168.0.0) through ISP2

    OK, let's say VPN tunnel, NAT and so on... are all good, work expected.

    My question is can I configure route like below to achieve my objextive?

    Route 0.0.0.0 outside1 0.0.0.0 X 2

    Route outside2 192.168.0.0 255.255.0.0 Y2

    or only the public IP could be routing in external interface like this:

    Route 0.0.0.0 outside1 0.0.0.0 X 2

    Route outside2 z 255.255.255.248 Y2

    I hope your help, thank you!

    Yes, you certainly can, and your display configuration is correct.

    You must also configure the route for the address of peer VPN as follows:

    Route outside2 255.255.255.255 Y2

  • Uncaught exception on HttpConnection when the URL is blocked

    I access my request, a service URL web restful. Whenever the device is connected, but the URL is not accessible or non-responsive for some reason, I get an untrapped exception. All I want is to catch the exception and displays an appropriate message.

    Ideally, I'd like

    1. check whether the URL is accessible

    2. wait a little longer if the URL is accessible but slow

    Please suggest. Thank you.

    Code: (relevant articles)

        public void fieldChanged(Field field, int context) {
    
            if (field == btnOK) {
                UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                    public void run() {
                                    String value=VerifyPinCode(rdPinCode.getText(),rd.getText());
    
                                    if (value.substring(0,4).equals("true")) {
                                                                            // do stuff
                                    } else {
                                        count = count++;
                                    }
                                  }
                });
    
            } else if (field == btnCancel) {
                close();
            }
    
        }
    
        public String VerifyPinCode(String PinCode, String VRN) {
            try {
    
                if (WebService.CheckConn())
                        {
                            try{
                        WebService wb = new WebService(
                                "http://webservice.somewhere.com:8088/mywebservice.svc/WebTestMethod/"
                                            + VRN
                                        + "/" + PinCode);
                               wb.start();
                        wb.join();
                        Responce = wb.Call();
                        }
                        catch(InterruptedException  ex)
                        {
                            Dialog.alert("No Internet Connection");
                        }
                    }
    
    public class WebService extends Thread {
        static HttpConnection con = null;
        static InputStream is = null;
        static StringBuffer rawResponse;
        String URL;
        public String resultant;
    
        WebService(String url) {
            URL = url + getConnectionString() + ";ConnectionTimeout=20000";
    
        }
    
        public void run() {
    
            try {
                con = (HttpConnection) Connector.open(URL, Connector.READ_WRITE,
                        true);
                int rcc = con.getResponseCode();
    
            } catch (IOException e) {
                // TODO Auto-generated catch block
                con = null;
                // Status.show(e.getMessage());
            }
    
            //catch (Exception ex) {
            // TODO Auto-generated catch block
            //con = null;
            // Status.show(e.getMessage());
            //}
    
        }
    
        public String Call() {
            try {
    
                // ConnectionTimeout=9000;";
                if (CheckConn()) {
    
                    if (con == null) {
                        rawResponse = new StringBuffer();
                        rawResponse.append("Timed out");
    
                    } else {
                        is = con.openInputStream();
                        // // Status.show("3");
    
                        byte[] responseData = new byte[10000];
                        int length = 0;
                        rawResponse = new StringBuffer();
                        while (-1 != (length = is.read(responseData))) {
                            rawResponse.append(new String(responseData, 0, length));
                            // Status.show("4");
    
                        }
                    }
                } else {
                    Status.show("Internet service is not avaiable.");
                }
                // Status.show(result);
    
            } catch (Exception ex) {
                Status.show("Internet is not responding");
            } finally {
                try {
                    if (is != null) {
                        is.close();
                    }
                    if (con != null) {
                        con.close();
                    }
                } catch (Exception e) {
                    // Status.show(e.getMessage());
                }
            }
            return rawResponse.toString();
    
        }
    
        public String getConnectionString() {
    
            String connectionString = "";
            if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
                connectionString = ";interface=wifi";
            }
    
            else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS) {
                connectionString = ";deviceside=false";
            } else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT) {
                String carrierUid = getCarrierBIBSUid();
                if (carrierUid == null) {
                    connectionString = ";deviceside=true";
                } else {
                    connectionString = ";deviceside=false;connectionUID="
                            + carrierUid + ";ConnectionType=amdeeas-public";
                }
            } else if (CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE) {
                connectionString = ";None";
    
            }
    
            return connectionString;
        }
    
        public String getCarrierBIBSUid() {
    
            net.rim.device.api.servicebook.ServiceRecord[] records = ServiceBook
                    .getSB().getRecords();
            int currentRecord;
    
            for (currentRecord = 0; currentRecord < records.length; currentRecord++) {
                if (records[currentRecord].getCid().toLowerCase().equals("ippp")) {
                    if (records[currentRecord].getName().toLowerCase()
                            .indexOf("bibs") >= 0) {
                        return records[currentRecord].getUid();
                    }
                }
            }
    
            return null;
        }
    
        public static boolean CheckConn() {
            try {
                if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
                    return true;
                } else if (CoverageInfo.getCoverageStatus() >= 2) {
                    return true;
                } else if (CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_DIRECT) {
                    return false; //false for device, true for simulator
                } else {
                    return false;
                }
            } catch (Exception ex) {
                Dialog.alert("No Internet Connection");
                return false;
            }
        }
    
    }
    

    remove the thread.join and the call to Call(), you block the user interface and the device to start a thread at all.
    To get a response from the thread, you can use the callback model, for example.

  • How can I do to block the main thread when to display a dialog box

    I have a problem to block the user interface main thread when to display a dialog box (the dialog was created by the main Application), and when the dialog box is closed, the main Application can go to the next step.
    Here is my code:

    SerializableAttribute public class TitledPaneExample extends Application {}
    instance of TitledPaneExample private;
    StackPane mainModalDimmer;

    /*
    * (non-Javadoc)
    *
    * @see javafx.application.Application #start (javafx.stage.Stage)
    */
    @Override
    public void start (point primaryStage) bird Exception {}
    instance = this;
    primaryStage.setTitle (this.getClass () m:System.NET.SocketAddress.ToString ());

    final StackPane layerPane = new StackPane();
    layerPane.setDepthTest (DepthTest.DISABLE);
    layerPane.setStyle ("background - fx - color: BLACK ;"); ")

    Vb VBox = new VBox();
    vb.setStyle ("background - fx - color: BLUE ;"); ")
    vb.getChildren () .add new (Label ("1"));
    vb.getChildren () .add (Label ("2")) new;
    vb.getChildren () .add new (Label ("3"));
    vb.getChildren () .add (Label ("4")) new;

    Bt1 button = new Button ("bt1");
    BT1.setOnAction (new EventHandler < ActionEvent > () {}
    {} public void handle (ActionEvent event)
    System.out.println ("bt1 trying to the new dialog box > > >");
    Dialogue di = new dialog box (instance, "some trick here!");
    System.out.println ("bt1 dialogue again successfully, try to show");
    di. Show();
    System.out.println ("bt1 dialog hide? < < < < ");"
    }
    });
    vb.getChildren () .add (bt1).

    layerPane.getChildren () .add (vb);

    mainModalDimmer = new StackPane();
    mainModalDimmer.setId ("MainModalDimmer");
    mainModalDimmer.setMaxSize (Double.MAX_VALUE, Double.MAX_VALUE);
    mainModalDimmer.setVisible (false);
    mainModalDimmer.setStyle ("background - fx - color: RED ;"); ")
    layerPane.getChildren () .add (mainModalDimmer);

    Scene sc = new scene (layerPane, 800, 600);
    primaryStage.setResizable (true);
    primaryStage.setScene (sc);
    primaryStage.show ();

    }

    /**
    * Display the node given as a floating dialog on the entire application, with
    * the rest of the application grayed out and blocked from mouse events.
    *
    @param message
    */
    {} public void showModalMessage (message from node)
    mainModalDimmer.getChildren () .add (message);
    mainModalDimmer.setOpacity (0);
    mainModalDimmer.setVisible (true);
    mainModalDimmer.setCache (true);
    TimelineBuilder
    . Create()
    () .keyFrames
    new KeyFrame (Duration.seconds (1),)
    new EventHandler < ActionEvent > () {}
    {} public void handle (ActionEvent t)
    mainModalDimmer.setCache (false);
    }
    }, new KeyValue (mainModalDimmer
    . opacityProperty(), 1.
    Interpolator.EASE_BOTH))) infrastructure)
    . Play();
    }

    /**
    Hide the any modal message that appears
    */
    public void hideModalMessage() {}
    mainModalDimmer.setCache (true);
    TimelineBuilder
    . Create()
    () .keyFrames
    new KeyFrame (Duration.seconds (1),)
    new EventHandler < ActionEvent > () {}
    {} public void handle (ActionEvent t)
    mainModalDimmer.setCache (false);
    mainModalDimmer.setVisible (false);
    mainModalDimmer.getChildren () .clear ();
    }
    }, new KeyValue (mainModalDimmer
    . opacityProperty(), 0,.
    Interpolator.EASE_BOTH))) infrastructure)
    . Play();
    }

    /**
    @param args
    */
    Public Shared Sub main (String [] args) {}
    Launch();
    }

    Dialogue/public class extends TitledPane {}
    private owner of TitledPaneExample = null;
    instance of TitledPane private;

    Dialogue (owner of TitledPaneExample, String message) {}
    This.Owner = owner;
    this.parentThreand = Thread.currentThread ();
    This.instance = this;
    this.setExpanded (true);
    this.setText ("Dialog");
    this.setMaxWidth (400);
    this.setPrefWidth (300);
    this.setMinWidth (200);

    Label the tx = new Label ("message");
    tx.setTooltip (new Tooltip (message));
    tx.setWrapText (true);
    tx.setContentDisplay (ContentDisplay.LEFT);

    Bt button = new Button ("OK");
    bt.setOnAction (new EventHandler < ActionEvent > () {}
    {} public void handle (ActionEvent event)
    masquer();
    }
    });

    Sp ScrollPane = new ScrollPane();
    sp.setHbarPolicy (ScrollBarPolicy.AS_NEEDED);
    sp.setVbarPolicy (ScrollBarPolicy.AS_NEEDED);
    sp.setContent (tx);

    Hb HBox = new HBox (30);
    hb.setPrefHeight (40);
    hb.setAlignment (Pos.CENTER_RIGHT);
    hb.getChildren () .add (bt);

    BP BorderPane = new BorderPane();
    bp.setCenter (sp);
    bp.setBottom (hb);

    this.setContent (bp);
    }

    {} public void show()
    System.out.println ("dialogue show() 1 > > >");

    owner.showModalMessage (instance);

    System.out.println ("dialogue show() 2 > > >");

    }

    public void masquer() {}
    System.out.println ("dialogue masquer() 1 > > >");
    this.owner.hideModalMessage ();

    System.out.println ("dialogue masquer() 2 > > >");
    }
    }

    }

    I'm also interested in how to do this without the use of a step.

    But, if you are ready to use a step for this, you can create a useful first step (without borders) with its owner being your current stage. Then, you can call the function showAndWait on stage that allows to block the thread of your application. For example, I implemented a DialogStage like this:

    package hs.mediasystem.util;
    
    import javafx.animation.KeyFrame;
    import javafx.animation.KeyValue;
    import javafx.animation.Timeline;
    import javafx.event.EventHandler;
    import javafx.scene.effect.ColorAdjust;
    import javafx.stage.Modality;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import javafx.stage.Window;
    import javafx.stage.WindowEvent;
    import javafx.util.Duration;
    
    public class DialogStage extends Stage implements Dialog {
    
      public DialogStage() {
        super(StageStyle.TRANSPARENT);
    
        this.setTitle("MediaSystem-dialog");
    
        initModality(Modality.APPLICATION_MODAL);
      }
    
      protected void setParentEffect(Stage parent) {
        ColorAdjust colorAdjust = new ColorAdjust();
    
        Timeline fadeOut = new Timeline(
          new KeyFrame(Duration.ZERO,
            new KeyValue(colorAdjust.brightnessProperty(), 0)
          ),
          new KeyFrame(Duration.seconds(1),
            new KeyValue(colorAdjust.brightnessProperty(), -0.5)
          )
        );
    
        parent.getScene().getRoot().setEffect(colorAdjust);
    
        fadeOut.play();
      }
    
      protected void removeParentEffect(Stage parent) {
        parent.getScene().getRoot().setEffect(null);
      }
    
      protected void recenter() {
        Window parent = getOwner();
    
        sizeToScene();
    
        setX(parent.getX() + parent.getWidth() / 2 - DialogStage.this.getWidth() / 2);
        setY(parent.getY() + parent.getHeight() / 2 - DialogStage.this.getHeight() / 2);
      }
    
      @Override
      public final void showDialog(final Stage parent, boolean synchronous) {
        initOwner(parent);
    
        setParentEffect(parent);
    
        setOnShown(new EventHandler() {
          @Override
          public void handle(WindowEvent event) {
            recenter();
            onShow();
          }
        });
    
        if(synchronous) {
          showAndWait();
        }
        else {
          show();
        }
      }
    
      protected void onShow() {
      }
    
      @Override
      public void close() {
        removeParentEffect((Stage)getOwner());
        super.close();
      }
    }
    

Maybe you are looking for