Black window remains open even after closing the window programatically

I have an application which has multiple windows. From mainwindow button click event I am closing the child form of the application. The child window is opened after a successful socket, serial or gateway connection attempt, after which the application
do work with some threads and while clicking on a button on mainwindow I am closing this child window after disconnecting the respective connection mode. But after the close event the child window background gets black and it remains open unless and until
I just do a minimize and maximize the application. Please help me on this to get this issue fixed.

Well the details are rather going to depend on what it's doing.
It's a very open ended question really.
But...
Your options include.
Background worker.
https://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx
DIspatcherTimer
https://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer(v=vs.110).aspx
Async Await
https://msdn.microsoft.com/en-us/library/hh191443.aspx
Tasks
Task.Factory.StartNew(() => { Dosomething(); });
Or just a plain thread
using System.Threading;
new Thread(() =>
Thread.CurrentThread.IsBackground = true;
// DoSomething();
}).Start();
Where DoSomething is a method.
You can also have inline code of course instead of a method.
Whilst on a different thread to the UI you can't update UI objects.
You'll get a thread affinity error message if you try.
That means you either return your results to the ui thread and process them there ( particularly convenient with async await ).
Or you update something which doesn't have thread affinity.
An observablecollection bound to an itemssource doesn't have thread affinity eg.
You do need to raise property changed at the end of your processing with that option because it notifies collectionchanged on the wrong thread and the UI won't know it changed.
Or you can dispathcher.begininvoke to get back to the UI thread.
All depends what you're doing but hopefully one of those options there will suit you.
Hope that helps.
Recent Technet articles:
Property List Editing ;  
Dynamic XAML

Similar Messages

  • Window Memory usage even after closing windows

    I've included links to a test app that does nothing but
    launch a window, play a sound, close window / repeat.
    When application launches it uses about 20mb of memory. When
    you click on the only button, it will launch a secondary window
    that will simply play a wav file. (I set the volume low but you may
    want to mute it :D)
    After launching and closing the window several times the
    memory usage goes up considerably and *never* falls back a
    significant %. (I got it to about 100MB before I decided to quit
    trying to increase the memory usage. Right now it's been running
    w/o any user interaction since opening about 10 windows and it's
    fairly stable at around 61MB (although that appears to be
    increasing w/o user interaction).
    Does anyone know of any methods I can use to ensure that the
    memory consumed by secondary windows does not just persist forever
    even after closing the window? Is there something I'm doing wrong
    here?
    Example Code:
    http://www.vf-server.com/air/memorytest.air
    (AIR)
    http://www.vf-server.com/air/memorytest.zip
    (source ZIP)
    Note: When I *minimize* the window it looks like garbage
    collection is forced and app drops back to 11MB (on restore back to
    19mb).
    Edit: note in your task manager, application appears as
    JBTest.exe

    You can call System.gc() to force the garbage collector to
    run.
    Try removing the event listeners when they aren't needed
    anymore. I think it is more difficult for the gc to cleanup objects
    when there are host objects (like Sound) refering to JavaScript
    objects and JavaScript objects refering to host objects, so you
    need to be especially careful about those. It SHOULD clean them up
    eventually, but it may take longer for it to figure out that those
    objects are no longer in use.
    You might also clear the secondaryWindow reference in the
    parent document when the window closes. That reference might retard
    garbage collection, too.

  • HT5037 Iphoto Still wont open even after installed the prepare file

    Still wont open even after installed the prepare file. I haven't felt this frostation since window 5 

    Go to Applications /Utilities. Find the upgrader app there. Double click on it to run it.
    I haven't felt this frostation since window 5
    Sorry, no idea what this means.

  • When I close and reopen firefox, it restores my tabs, but it restores tabs from hours or days ago, not the ones that were open when I closed the window - why?

    I normally keep my Firefox window open for long periods of time because I have a lot of active tabs. When I close the window and reopen it, I am still able to restore tabs, but as of a few weeks ago, it has stopped restoring the most recent version. Normally, when I would close and reopen, the tabs would be the same ones that were open when I closed the window. Now, it restores to a version from a few days ago instead of the current version. I have to revert to pulling my more recent tabs out of the recent history. I checked my options and I can't figure out any way to control this. How can I fix it so that I can count on my Firefox window to restore the tabs that I actually care about?

    You can check for problems with the sessionstore.js and sessionstore.bak files in the Firefox Profile Folder that store session data.
    Delete the sessionstore.js file and possible sessionstore-##.js files with a number and sessionstore.bak in the Firefox Profile Folder.
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Deleting sessionstore.js will cause App Tabs and Tab Groups and open and closed (undo) tabs to get lost, so you will have to create them again (make a note or bookmark them).
    *http://kb.mozillazine.org/Multiple_profile_files_created
    *http://kb.mozillazine.org/Session_Restore

  • I had original iPhoto app from 2007, but in the last year it stopped working seemingly out of nowhere.  Now I just installed iPhoto 9.5.1 but it won't open even after downloading the iPhoto Library Updater.  My pictures are lost in the abyss.

    I had original iPhoto app from 2007 or 2008, but in the last year it stopped working seemingly out of nowhere.  Now I just installed iPhoto 9.5.1 but it won't open even after downloading the iPhoto Library Updater.  My pictures are lost in the abyss.
    I'm using OS Extended 10.9.5.  I don't know what the original version of iPhoto was.

    I just installed iPhoto 9.5.1 but it won't open even after downloading the iPhoto Library Updater
    Have you run the iPhoto Library Upgrader? You need to direct it to the location of your old iPhoto Library by clicking the "Choose Library" button in the lower right corner of the panel you are seeing when the upgrade starts.

  • SAPgui.exe is running even after closing the GUI components

    Hello All,
    Even after closing the SAP GUI components like Bex, WAD or RSA1 etc... i am able to see these processes are running under the Task Manager--> Processes....
    even if i try to restart the system, error messages are occuring...saying that SAP is still opend...
    Why it is happening, any ideas?
    Thanks,
    Ravi

    Hi Dirk,
    Thanks for your infomation. Infact, apart from this problem, i have the problem with saving the webtemplate. As it is taking much time to save a template after modifications, i had to terminate the wad process. It seems above 2 problems are related....any ideas?
    Thanks
    ravi
    Message was edited by: Ravi Pasumarty

  • Music continuously plays even after closing the tab which played youtube video, restarting does not help either.

    Music continuously plays even after closing the tab which played youtube video, restarting does not help either.

    please update your version of the flash plugin & see if that works:
    [http://get.adobe.com/flashplayer/] (make sure to uncheck the "McAfee Security Scan Plus" checkbox first if you don't want to install the bundled software)

  • Why does the print cue window stay open even after job is done?

    In Tiger, and every other version of OSX I have any recollection of using, the printer window opens to display what's in the cue when you select to print something. Once printing is done, this cue closes. Since installing Leopard, everytime we print from our iMac, MacBook or MBP, the print cue window stays open indefinitely after the job is done, requiring a manual closing of the window. I can't for the life of me fathom what benefit this brings or who would want this. Is this part of Leopard or a problem with our install? Something I can turn off?

    If you control-click (or right click) on the open printer queue in the Dock you can choose to have it auto close once the spool file is sent.
    As to why this is necessary in Leopard, well I haven't seen a good enough answer to date...
    PaHu

  • Backend BSP session not closing on server after closing the window

    Hi All,
    We have SAP EP (7.0 SP21) and there is a BSP transaction ivew (Interaction Center ) intergrated in the portal. The issue is when the user performs any transactions inside the BSP and then closes the browser, session remains on the server till the timeout. Is there a way to end those sessions on server after closing the browser immediately?
    Portal domain : xx.mycomp.com
    ABAP system domain :mycom.com
    Should the domains be same for the DSM of Portal to work or is there any solution that can be considered.
    regards
    Uday

    Hi Uday,
    These are the main issues that can cause issues with DSM:
    JavaScript Origin Policy:
    Scripting
    between different domains is not allowed because of “JavaScript origin policy”.
    Also
    communication between mixed protocols (http\https) is forbidden.
    Therefore
    the portal server and the content server must be on the same domain and must
    use the same protocol.
    For
    detailed explanation see:
    http://mozilla.org/projects/security/components/same-origin.html
    Popup Blocker:
    •Popup blockers may cause troubles
    in relation with SRA feature.
    •Terminator handles notifications in
    new window when current window is being destroyed (logoff, closing browser
    window) – popup blocker prevents the opening of new window, hence no session
    handling performed.
    please also check SAP Note #596698 for more information typical problems and troubleshooting.
    In general, the 2 domains should be the same.
    xxx.mycomp.com, meaning that first part of the url can change but what comes after should be the same domain.
    Best regards,
    Etay

  • CK40N - Still open even after applying the note

    Hello Everyone!
    Greetings!
    Experiencing issues in the costing run. SAP ECC 5.0
    After the marking job completion observed that there are some u2018Still Openu2019 items. After some research found the SAP notes u2013 0000542790, 0001321242 & 0001402978.
    SAP note 0000542790 is not applicable to us as the client is on SAP ECC 5.0. For the short term fix, as per the note 542790 have executed the command u2018=cksuu2019. It worked.
    To apply the notes 0001321242, 0001402978 was testing in the test systems and I still see the u2018STILL OPENu2019 items even after implementing the SAP notes 0001321242 and 0001402978. Both the notes have been sucessfully implemented and also verified the corrections.
    Any suggestions/advice, please. Thanks in advance !
    Satish

    Hi Satish,
    There can be valid reasons for the 'still open' Materials.
    The following are reasons for 'still open'
    1. the materials were included in another costing run so there was an
    overlap in released cost estimates
    2. there was already a released cost estimate for those materials so
    the system did not allow for another one - this could have been costed
    manually and released manually (ck11) rather than in ck40n
    3. there was a stop in the job that ran to release them (you mentioned
    periods were closed). After the restart, some of the statistics could
    have been incorrectly updated.
    Furthermore, please see the note:
    542790     Inconsistency correction: Costing run statistics
    If need need to find the 'still open' Materials.
    If you run tCode 'SE16' and view the table table KALM which contains
    the entries for all materials costed within the costing run.
    Field 'KALM-FEH_STATUS is the cost estimate's status after step costing.
    1) Find cost estimates created originally within cstg run
    So, you have to select all entries of KALM for the specific costing
    run which are having KALM-FEH_STATUS = 'KA'.
    This is the number of cost estimates which should have been marked in
    the later marking step.
    2) Find cost estimates released successfully
    The set of released cost estimates is given by selection of table
    KEKO: specify KALAID and KALADAT and FEH_STA = 'FR'.
    3) Find missing cost estimates
    Compare the results of 1) and 2):
    Which material/plant have an KALM entry, but not a released cost
    cost estimate ?
      > this will be the set of cost estimates you are looking for...
    Regards,Declan

  • How can I add comments in genius bar reservation after closing the window?

    I was typing my additional comments in the genius bar reservation for servicing my Macbook Pro but i accidentally closed the window. Is it possible to get back to the reservation window and type in my comments??
    Thanks a lot.

    Call the Apple store where you are having your computer serviced.  Give the comments over the phone.

  • Why FF usaes 25% of CPU, even after closing the application..?

    After opening two or more browser, automatically FF stars using 24/25% of CPU.
    Even one tab having Youtube running.
    As well as using huge amount of memory, and this gradually increases.
    Closing the application doesn't solves the problem.
    After that the application doesn't opens. A window appears and shows.. Firefox already running and is not responding.
    Going to Task manager and kill the process solves the problem.
    And it's happening every time.
    In cyclic order need to follow the annoying process.
    .....Tried the processes but NO result found.....
    Re-installation of FF didn't worked.
    Re-installed Flash player.
    No malware found by Malwarebytes.
    Even tried running FF in safe mode. (disabling all plugin and extensions)
    And the result is.... NO progress. CPU 25% usage and had to kill the task.
    Please some one help.
    (OS: windows 7 professional)

    Your computer isn't getting slower, it's other things demanding faster.  If you are installing all the possible updates to software those will be designed for newer computers.  Once you start browsing you're browsing a web designed by people who because they spend all their time designing pages they themselves have powerful machines with fast connections because it is their job.  It's like if all city streets were designed by racecar drivers.  A 2008 computer is already considered vintage by Apple and close to no longer being supported in any manner.  Vintage and obsolete products - http://support.apple.com/kb/HT1752  I have an even older computer than you and it is annoying but that's the way things are.
    Frankly 4-6 icon bounces doesn't sound long to me.  Don't forget that for applications such as iTunes how long it takes to open will also depend upon the size of the library.
    I don't think CPUs wear down.  Conceivably some slow-down could be the result of excessive bad sectors on a hard drive but you say you replaced that (and I would expect it to have shown more serious symptoms were that happening).
    You can use Activity monitor to check your RAM usage.  Newer applications and newer OS versions will require much more RAM than posted "minimum"  If a computer doesn't have enough RAM it starts using the hard drive which is slower than chips.

  • Serial port is still open even after closing it explicitly

    Hello,
    I need to close a VI that is using a COM port and use the same port through some other program. But for some reason even after I stop the VI where I explicitly close the com port, I can not still use the hypterterminal to connect to the port. It says port is being used by some other program.  What can be the reason? Any thought ?
    Thanks,
    Ananda

    Is the VISA close the last action you perform on the VISA reference?
    If not, then your port will probably be opened again, so make sure it's the last one.
    Also, I seem to remember reading something about some bug where VISA close wouldn't properly close the port. I would suggest you try searching for it and also make sure you have an updated version of VISA.
    Try to take over the world!

  • Chat window stays open even after i log off

    When ever i log off with a chat window open...it stays open when i log back on. Is it possible to not do that, Leopard never did that???

    Hi Carolyn and Lud@,
    I must admit I would have suggested that as well.
    If the iChat 4 setting for Remembering Chats had been set there is nothing in iChat 5 to reset it.
    In Theory clearing the window and Quitting iChat should delete the item from the .plist
    Deleting the said .plist and restarting iChat would have caused iChat to recreate the .plist from Defaults and the Remember Chats Across Launch item would not be there.
    What we could do with knowing now is, does the Window have any info at the top as to who and/or what room the chat is associated with ?
    It may pay to check the File Menu of iChat to Check if this "Chat" that keeps popping up is in the Recents lists.
    8:33 PM Tuesday; September 1, 2009
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"

  • Executable VI remains in memory after closing the program

    Using LabVIEW 8.5.1
    I've had two problems like this now.  One in a vista machine and the other in a windows 2000 machine.  The program is the same with minor changes between the machines.  At first I thought the problem was in the installer and I had to change the target OS to Vista only, but now I'm not sure that is the issue as it is happening in a win2K machine as well.
    The program runs fine but when we stop the execution and then close the program by hitting the X on the upper right corner of the window it closes the window but the instance remains loaded in memory and I have to go to the task manager to end the task. 
    Any leads on the fixt to this would be helpful.
    Thanks,

    I will check for code left running as this may be the most likely cause.
    As to what Pnt wrote:
    "Although i don't agree with your programming style. The program should not be terminated at that point. It should pass to an idle state, waiting either for a button "Run" to be pressed, or the "X"."
    I am giving you a glimpse of what the code does.  I'm not saying that I'm an expert programer as it is not my full time responsibility.  However, I am asking for help on figuring out what is going on with my code and I understand that it will be hard to pin point the problem without posting the entire program for members to disect.  Having said that, it would also be difficult to get but a glimpse on my programming style without me posting what I would consider a finished program.  For example, (here is another glimpse at my style) the program does go into an idle state waiting for the user to run another recipe or to terminate the program.  If the user decides to run a recipe but needs to abort the recipe, there is an option to do that and the program goes back to idle.  Further more the program can only be stopped while it is idle, a recipe has to be aborted prior to stopping the program (this is required to avoid leaving the furnace in an unsafe state) unless the user forces the program to quit by way of the "end task" which thanks to the note posted in a previous reply I know how to hadle now...  
    Sorry for the deviation from the actual topic, I could go on and on about what the program is supposed to do and how I'm meeting the end user requirements but I don't see the value of that at the momment.

Maybe you are looking for

  • Iphone cant find hp 210a airprint

    iphone cant find any printer airprint., have a hp aio wifi b210a, it is on the same network and i have no problems printing from my imac on wifi,?????? what to do.???

  • Bubble Chart

    Hi! Is there any way to control the bubble size in a chart? I would like to make the bubbles smaller because they're too close. The actual size makes a bubble occupies a piece of another bubble. I have changed the value of bubblePercentSize in XML (A

  • I seem to have disabled an ipad - is it possible to reverse this

    I seem to have disabled my ipad - is it possible to reverse this?

  • 64-bit compilation problem on Solaris/Intel: 7th argument not initialized

    I have a problem when compiling a program on a 64-bit Solaris Intel server. The problem is that when calling a function, if the 7th or next arguments are long arguments and I pass uncasted small integers values to it, the first 32-bit of my values ar

  • Error while running RC

    Hi All, Recieved following error whiel running RCU (11.1.1.5) File E:\upgrade\repostory_creation_utiltiy\rcuhome\rcu\integration\cremdsinds.sql statement create index MDS_COMPONENTS_N1 COMP_PARTITION_ID.... All though there is option to ignore and pr