ui-thread

Multiple Swing event-dispatch threads

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 15:11:35
问题 I would like to create a new event-dispatch thread in Swing, and I'm having trouble finding any references online for how to do this. I have done this in .NET by creating a new thread and calling Application.run(...). Has anyone done this? Is it possible in Swing? FYI the reason I am trying to do this is because I am writing an Eclipse plug-in, and I would like to pop up dialogs that are not modal to the IDE but that are modal (blocking) to my UI logic. I could accomplish this using non-modal

Why does my Thread freeze the UI-Thread?

只谈情不闲聊 提交于 2019-12-07 09:14:43
问题 I cant figure it out. For what ever reason, this thread's code is actually running on the UI thread. If i break point it the UI stops. or Sleep it, UI stopped. and hence network activity is unallowed as its on the "ui" thread. Ive not used Async task, because I am unaware of the proper way of looping it. (calling a new instance of it in onPostExecute seems like bad practice, and as if async is for one off tasks. I extend Thread. public class SyncManager extends Thread { public SyncManager

Using HandlerThread and Handler on a separate thread freezes UI thread

一世执手 提交于 2019-12-07 05:46:25
In my project, I want to implement a timer in another thread that counts down the time spent executing a certain method in my application, and do something if it is taking too much time. When executing the MyManager.startCommand() method, the application is freezing and I don't know why since I think I am not doing anything on the UI thread. Is there anything wrong with my code? I had originally asked this question and was not experiencing an app freeze, so I don't think it's because I'm sleeping the thread: Runnable posted in another runnable not executed . public class MyManager{ private

Edge: In-Process native extension and Windows.System.Launcher.LaunchFileAsync

≯℡__Kan透↙ 提交于 2019-12-06 16:58:31
问题 I have developed an edge browser extension (native messaging) using the in-process mechanism as described here (through an activation of OnBackgroundActivated ). Within OnBackgroundActivated , or to be more specific in OnAppServiceRequestReceived of the established app service connection, I am attempting to call Windows.System.Launcher.LaunchFileAsync(IStorageFile) . This doesn't appear to happen on the UI-Thread (although it does work in debug mode with a debugger attached). The problem that

How to properly keep the UI updated while transferring packets in C#?

纵然是瞬间 提交于 2019-12-06 11:36:14
问题 I have this form that spawns a new thread and starts listening and waiting for UDP packets in a loop. What I need is to keep the UI updated with the number of bytes received. For that, I have setup an event which I'll raise as soon as a packet is received and pass the number of bytes received as an argument. Since I'm not running on the UI thread, I cannot simply update the UI directly. Here's what I'm currently doing: private void EVENTHANDLER_UpdateTransferProgress(long receivedBytes) { if

Will Runnables block the UI thread?

倾然丶 夕夏残阳落幕 提交于 2019-12-06 08:15:54
I am trying to understand how UI thread's event queue works. I'm trying to run a code that can be broken into many parts but unfortunately it must run on the UI thread. So, in order to not block the UI thread and receive a ANR I was wondering if I can break that code in many Runnable objects and run them using runOnUiThread from another thread. My question is, will this block the UI thread? If, for example, I have a piece of code that definitely runs in over 5 seconds and I break this code into, let's say 1000 Runnable objects, and add them to the event queue of the UI thread, will other

Multiple Swing event-dispatch threads

一曲冷凌霜 提交于 2019-12-05 20:30:05
I would like to create a new event-dispatch thread in Swing, and I'm having trouble finding any references online for how to do this. I have done this in .NET by creating a new thread and calling Application.run(...). Has anyone done this? Is it possible in Swing? FYI the reason I am trying to do this is because I am writing an Eclipse plug-in, and I would like to pop up dialogs that are not modal to the IDE but that are modal (blocking) to my UI logic. I could accomplish this using non-modal dialogs and callbacks, but that requires the overhead of making my code multi-threaded. I'll revert to

Edge: In-Process native extension and Windows.System.Launcher.LaunchFileAsync

我的梦境 提交于 2019-12-04 22:58:23
I have developed an edge browser extension (native messaging) using the in-process mechanism as described here (through an activation of OnBackgroundActivated ). Within OnBackgroundActivated , or to be more specific in OnAppServiceRequestReceived of the established app service connection, I am attempting to call Windows.System.Launcher.LaunchFileAsync(IStorageFile) . This doesn't appear to happen on the UI-Thread (although it does work in debug mode with a debugger attached). The problem that I am facing is, that the application is headless, and therefore there is no CoreWindow

how to indicate to main UI thread when background task has completed? (performSelectorInBackground)

自古美人都是妖i 提交于 2019-12-04 18:44:40
How can I get an indication to main UI thread in an iPhone app IOS program, when background task has completed? Background I'm trying to setup a loading indicator per the concept at How to add a UIActivityIndicator to a splash screen in a iphone application? was going to in AppDelete use "performSelectorInBackground" to load up the model data what I need therefore is in the RootViewController some way of telling when the data has finished loading in the background so that it can (a) update the tableview with the data and (b) remove any activity indicator I'm assuming way to do things here is

How to properly keep the UI updated while transferring packets in C#?

删除回忆录丶 提交于 2019-12-04 18:06:28
I have this form that spawns a new thread and starts listening and waiting for UDP packets in a loop. What I need is to keep the UI updated with the number of bytes received. For that, I have setup an event which I'll raise as soon as a packet is received and pass the number of bytes received as an argument. Since I'm not running on the UI thread, I cannot simply update the UI directly. Here's what I'm currently doing: private void EVENTHANDLER_UpdateTransferProgress(long receivedBytes) { if(InvokeRequired) { Invoke(new MethodInvoker(() => { totalReceivedBytes += receivedBytes; Label.Text =